diff --git a/src/impl/getusername.cpp b/src/impl/getusername.cpp index 6f11b516ae..35c034fb9d 100644 --- a/src/impl/getusername.cpp +++ b/src/impl/getusername.cpp @@ -7,11 +7,6 @@ #include #include -using std::string; -using std::vector; - -using SCXCoreLib::Utf8ToUtf16le; - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms724432(v=vs.85).aspx // Sets errno to: // ERROR_INVALID_PARAMETER - parameter is not valid @@ -79,9 +74,9 @@ BOOL GetUserName(WCHAR_T *lpBuffer, LPDWORD lpnSize) } // Convert to char * to WCHAR_T * (UTF-8 to UTF-16 LE w/o BOM) - string input = string(userName); - vector output; - Utf8ToUtf16le(input, output); + std::string input(userName); + std::vector output; + SCXCoreLib::Utf8ToUtf16le(input, output); if (output.size()/2 + 1 > *lpnSize) { errno = ERROR_INSUFFICIENT_BUFFER; diff --git a/src/tests/test-getusername.cpp b/src/tests/test-getusername.cpp index 825e949608..c7bbc14b47 100644 --- a/src/tests/test-getusername.cpp +++ b/src/tests/test-getusername.cpp @@ -5,10 +5,6 @@ #include #include "getusername.h" -using std::string; -using std::vector; -using SCXCoreLib::Utf16leToUtf8; - TEST(GetUserName,simple) { // allocate a WCHAR_T buffer to receive username @@ -21,7 +17,7 @@ TEST(GetUserName,simple) ASSERT_EQ(1, result); // get expected username - string username = string(getlogin()); + std::string username(getlogin()); // GetUserName sets lpnSize to length of username including null ASSERT_EQ(username.size()+1, lpnSize); @@ -30,10 +26,10 @@ TEST(GetUserName,simple) unsigned char *begin = reinterpret_cast(&lpBuffer[0]); // -1 to skip null; *2 because UTF-16 encodes two bytes per character unsigned char *end = begin + (lpnSize-1)*2; - vector input(begin, end); + std::vector input(begin, end); // convert to UTF-8 for assertion - string output; - Utf16leToUtf8(input, output); + std::string output; + SCXCoreLib::Utf16leToUtf8(input, output); EXPECT_EQ(username, output); }