Two bugs in Encoding

This commit is contained in:
Henrik Rydgård committed 2026-08-07 14:43:56 +02:00
1 parent a47edbf6ef
commit 0323598941
2 files changed
+4 -3

No files matched your search

+3 -2
View File
@@ -110,8 +110,9 @@ struct ShiftJIS {
} else if (row < 0x5F) {
// Reduce by 0x40 to account for the above range.
*dest++ = 0xE0 + ((row - 0x40 + 1) >> 1);
} else if (row >= 0x80) {
// TODO
} else {
// Rows 0x5F-0x7F and 0x80+ are not encodable.
return 0;
}
if (row & 1) {
+1 -1
View File
@@ -207,7 +207,7 @@ void ConvertUTF8ToWString(wchar_t *dest, size_t destSize, std::string_view sourc
destSize -= 1; // account for the \0.
int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.data(), len, NULL, 0);
MultiByteToWideChar(CP_UTF8, 0, source.data(), len, dest, std::min((int)destSize, size));
dest[size] = 0;
dest[std::min(size, (int)destSize)] = 0;
}
std::wstring ConvertUTF8ToWString(const std::string_view source) {