Use known size instead of calculation

This commit is contained in:
Andrew Schwartzmeyer
2015-08-13 20:32:30 -07:00
parent fd8352c469
commit 77f9757a05
+1 -2
View File
@@ -120,8 +120,7 @@ BOOL GetUserNameW(WCHAR_T* lpBuffer, LPDWORD lpnSize)
icu::UnicodeString username8(username.c_str(), "UTF-8");
int32_t targetSize = username8.extract(0, username8.length(),
reinterpret_cast<char*>(&username16[0]),
(username16.size()-1)*sizeof(char16_t),
"UTF-16LE");
LOGIN_NAME_MAX, "UTF-16LE");
// Number of characters including null
username16.resize(targetSize/sizeof(char16_t)+1);