You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/07/11 01:39:32 UTC

[46/50] mesos git commit: Windows: Made version info use Unicode.

Windows: Made version info use Unicode.

The `GetVersionEx` family of functions have been marked deprecated; not
just the non-Unicode version as the previous comment implied. Thus we do
not hide the valid deprecation warning, and should replace the use of
this API.

Review: https://reviews.apache.org/r/60342/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/76c58f45
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/76c58f45
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/76c58f45

Branch: refs/heads/master
Commit: 76c58f458d4d49551f19a431bea3b4fc75b914e0
Parents: fd40752
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Jul 10 15:39:06 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jul 10 17:15:39 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/windows/os.hpp | 38 ++++++++----------------
 1 file changed, 13 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/76c58f45/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp
index e0909d1..b234e15 100644
--- a/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/stout/include/stout/windows/os.hpp
@@ -49,20 +49,14 @@
 namespace os {
 namespace internal {
 
-inline Try<OSVERSIONINFOEX> os_version()
+inline Try<OSVERSIONINFOEXW> os_version()
 {
-  OSVERSIONINFOEX os_version;
-  os_version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-#pragma warning(push)
-#pragma warning(disable : 4996)
-  // Disable compiler warning asking us to use the Unicode version of
-  // `GetVersionEx`, because Mesos currently does not support Unicode. See
-  // MESOS-6817.
-  if (!::GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&os_version))) {
+  OSVERSIONINFOEXW os_version;
+  os_version.dwOSVersionInfoSize = sizeof(os_version);
+  if (!::GetVersionExW(reinterpret_cast<LPOSVERSIONINFO>(&os_version))) {
     return WindowsError(
         "os::internal::os_version: Call to `GetVersionEx` failed");
   }
-#pragma warning(pop)
 
   return os_version;
 }
@@ -116,7 +110,7 @@ inline std::string machine()
 }
 
 
-inline std::string sysname(OSVERSIONINFOEX os_version)
+inline std::string sysname(OSVERSIONINFOEXW os_version)
 {
   switch (os_version.wProductType) {
     case VER_NT_DOMAIN_CONTROLLER:
@@ -128,20 +122,20 @@ inline std::string sysname(OSVERSIONINFOEX os_version)
 }
 
 
-inline std::string release(OSVERSIONINFOEX os_version)
+inline std::string release(OSVERSIONINFOEXW os_version)
 {
   return stringify(
       Version(os_version.dwMajorVersion, os_version.dwMinorVersion, 0));
 }
 
 
-inline std::string version(OSVERSIONINFOEX os_version)
+inline std::string version(OSVERSIONINFOEXW os_version)
 {
   std::string version = std::to_string(os_version.dwBuildNumber);
 
-  if (os_version.szCSDVersion[0] != '\0') {
+  if (os_version.szCSDVersion[0] != L'\0') {
     version.append(" ");
-    version.append(os_version.szCSDVersion);
+    version.append(stringify(os_version.szCSDVersion));
   }
 
   return version;
@@ -437,17 +431,11 @@ inline Try<Memory> memory()
 
 inline Try<Version> release()
 {
-  OSVERSIONINFOEX os_version;
-  os_version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-#pragma warning(push)
-#pragma warning(disable : 4996)
-  // Disable compiler warning asking us to use the Unicode version of
-  // `GetVersionEx`, because Mesos currently does not support Unicode. See
-  // MESOS-6817.
-  if (!::GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&os_version))) {
+  OSVERSIONINFOEXW os_version;
+  os_version.dwOSVersionInfoSize = sizeof(os_version);
+  if (!::GetVersionExW(reinterpret_cast<LPOSVERSIONINFO>(&os_version))) {
     return WindowsError("os::release: Call to `GetVersionEx` failed");
   }
-#pragma warning(pop)
 
   return Version(os_version.dwMajorVersion, os_version.dwMinorVersion, 0);
 }
@@ -456,7 +444,7 @@ inline Try<Version> release()
 // Return the system information.
 inline Try<UTSInfo> uname()
 {
-  Try<OSVERSIONINFOEX> os_version = internal::os_version();
+  Try<OSVERSIONINFOEXW> os_version = internal::os_version();
   if (os_version.isError()) {
     return Error(os_version.error());
   }