[*] Bug fix: NT registry read function conflated array length with count
[*] Locale convert wchar -> utf count was not respected under non-nt targets
This commit is contained in:
parent
dc59e59e2a
commit
e665714341
@ -60,7 +60,7 @@ namespace Aurora::Locale
|
||||
WideCharToMultiByte(CP_UTF8, 0, in, length, ret.data(), ret.size(), NULL, NULL);
|
||||
return ret;
|
||||
#elif !defined(AU_NO_CPPLOCALE)
|
||||
return gUtf8Conv.to_bytes(std::wstring(in, wcslen(in)));
|
||||
return gUtf8Conv.to_bytes(std::wstring(in, wcsnlen(in, length)));
|
||||
#else
|
||||
SysPushErrorUnimplemented("ConvertFromWChar");
|
||||
return {};
|
||||
|
@ -43,7 +43,7 @@ namespace Aurora::SWInfo
|
||||
|
||||
std::wstring in;
|
||||
|
||||
if (!AuTryResize(in, dwBufferSize))
|
||||
if (!AuTryResize(in, dwBufferSize / sizeof(wchar_t)))
|
||||
{
|
||||
SysPushErrorMem();
|
||||
return false;
|
||||
@ -55,7 +55,10 @@ namespace Aurora::SWInfo
|
||||
return false;
|
||||
}
|
||||
|
||||
strValue = Locale::ConvertFromWChar(in.data(), in.size());
|
||||
auto c = dwBufferSize / sizeof(wchar_t);
|
||||
if (c) c--;
|
||||
|
||||
strValue = Locale::ConvertFromWChar(in.data(), c);
|
||||
return strValue.size();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user