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:28 UTC

[42/50] mesos git commit: Windows: Made `os::user()` use Unicode.

Windows: Made `os::user()` use Unicode.

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


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

Branch: refs/heads/master
Commit: 293c7e1b4073e65085750ee695d7d16e10256516
Parents: 0f2bfe7
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Jul 10 15:22:42 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jul 10 17:15:38 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/windows/su.hpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/293c7e1b/3rdparty/stout/include/stout/os/windows/su.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/su.hpp b/3rdparty/stout/include/stout/os/windows/su.hpp
index 573fdef..1bfbb26 100644
--- a/3rdparty/stout/include/stout/os/windows/su.hpp
+++ b/3rdparty/stout/include/stout/os/windows/su.hpp
@@ -81,18 +81,19 @@ inline Result<std::string> user(Option<uid_t> uid = None())
 
   EXTENDED_NAME_FORMAT username_format = NameSamCompatible;
   ULONG buffer_size = 0;
-  if (::GetUserNameEx(username_format, nullptr, &buffer_size) == FALSE) {
+  if (::GetUserNameExW(username_format, nullptr, &buffer_size) == FALSE) {
     if (::GetLastError() != ERROR_MORE_DATA) {
       return WindowsError("os::user: Failed to get buffer size for username");
     }
   }
 
-  std::vector<TCHAR> user_name(buffer_size);
-  if (::GetUserNameEx(username_format, &user_name[0], &buffer_size) == FALSE) {
+  std::vector<wchar_t> user_name(buffer_size);
+  if (::GetUserNameExW(username_format, user_name.data(), &buffer_size)
+      == FALSE) {
     return WindowsError("os::user: Failed to get username from OS");
   }
 
-  return std::string(&user_name[0]);
+  return stringify(std::wstring(user_name.data()));
 }