forked from fmtlib/fmt
Fix UTF8ToUTF16.
This commit is contained in:
@@ -176,12 +176,12 @@ fmt::internal::UTF8ToUTF16::UTF8ToUTF16(fmt::StringRef s) {
|
|||||||
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, 0, 0);
|
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, 0, 0);
|
||||||
static const char ERROR[] = "cannot convert string from UTF-8 to UTF-16";
|
static const char ERROR[] = "cannot convert string from UTF-8 to UTF-16";
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
ThrowSystemError(GetLastError(), ERROR);
|
ThrowWinError(GetLastError(), ERROR);
|
||||||
buffer_.resize(length);
|
buffer_.resize(length);
|
||||||
length = MultiByteToWideChar(
|
length = MultiByteToWideChar(
|
||||||
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
|
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
ThrowSystemError(GetLastError(), ERROR);
|
ThrowWinError(GetLastError(), ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) {
|
fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) {
|
||||||
|
Reference in New Issue
Block a user