Use known size instead of calculation

This commit is contained in:
Andrew Schwartzmeyer 2015-08-13 17:55:29 -07:00
parent fd8352c469
commit 77f9757a05
No known key found for this signature in database
GPG key ID: D50036A9A84A216F

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);