diff --git a/include/stdex/unicode.hpp b/include/stdex/unicode.hpp index 95413579c..1fb4f5fbb 100644 --- a/include/stdex/unicode.hpp +++ b/include/stdex/unicode.hpp @@ -197,10 +197,9 @@ namespace stdex stdex_assert(count_src < INT_MAX || count_src == SIZE_MAX); // Try to convert to stack buffer first. - DWORD dwFlagsMBWC = static_cast(m_from_wincp) < CP_UTF7 ? MB_PRECOMPOSED : 0; WCHAR szStackBuffer[1024 / sizeof(WCHAR)]; #pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpMultiByteStr parameter wrong? - int cch = MultiByteToWideChar(static_cast(m_from_wincp), dwFlagsMBWC, reinterpret_cast(src), static_cast(count_src), szStackBuffer, _countof(szStackBuffer)); + int cch = MultiByteToWideChar(static_cast(m_from_wincp), 0, reinterpret_cast(src), static_cast(count_src), szStackBuffer, _countof(szStackBuffer)); if (cch) { // Append from stack. dst.append(reinterpret_cast(szStackBuffer), count_src != SIZE_MAX ? wcsnlen(szStackBuffer, cch) : static_cast(cch) - 1); @@ -209,10 +208,10 @@ namespace stdex DWORD dwResult = GetLastError(); if (dwResult == ERROR_INSUFFICIENT_BUFFER) { // Query the required output size. Allocate buffer. Then convert again. - cch = MultiByteToWideChar(static_cast(m_from_wincp), dwFlagsMBWC, reinterpret_cast(src), static_cast(count_src), NULL, 0); + cch = MultiByteToWideChar(static_cast(m_from_wincp), 0, reinterpret_cast(src), static_cast(count_src), NULL, 0); size_t offset = dst.size(); dst.resize(offset + static_cast(cch)); - cch = MultiByteToWideChar(static_cast(m_from_wincp), dwFlagsMBWC, reinterpret_cast(src), static_cast(count_src), &dst[offset], cch); + cch = MultiByteToWideChar(static_cast(m_from_wincp), 0, reinterpret_cast(src), static_cast(count_src), &dst[offset], cch); dst.resize(offset + (count_src != SIZE_MAX ? wcsnlen(&dst[offset], cch) : static_cast(cch) - 1)); return; } @@ -250,10 +249,10 @@ namespace stdex stdex_assert(count_src < INT_MAX || count_src == SIZE_MAX); // Try to convert to stack buffer first. - DWORD dwFlagsMBWC = static_cast(m_from_wincp) < CP_UTF7 ? MB_PRECOMPOSED : 0, dwResult; + DWORD dwResult; WCHAR szStackBufferMBWC[512 / sizeof(WCHAR)]; #pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpMultiByteStr parameter wrong? - int cch = MultiByteToWideChar(static_cast(m_from_wincp), dwFlagsMBWC, reinterpret_cast(src), static_cast(count_src), szStackBufferMBWC, _countof(szStackBufferMBWC)); + int cch = MultiByteToWideChar(static_cast(m_from_wincp), 0, reinterpret_cast(src), static_cast(count_src), szStackBufferMBWC, _countof(szStackBufferMBWC)); if (cch) { // Append from stack. size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szStackBufferMBWC, cch) : static_cast(cch) - 1; @@ -283,9 +282,9 @@ namespace stdex dwResult = GetLastError(); if (dwResult == ERROR_INSUFFICIENT_BUFFER) { // Query the required output size. Allocate buffer. Then convert again. - cch = MultiByteToWideChar(static_cast(m_from_wincp), dwFlagsMBWC, reinterpret_cast(src), static_cast(count_src), NULL, 0); + cch = MultiByteToWideChar(static_cast(m_from_wincp), 0, reinterpret_cast(src), static_cast(count_src), NULL, 0); std::unique_ptr szBufferMBWC(new WCHAR[cch]); - cch = MultiByteToWideChar(static_cast(m_from_wincp), dwFlagsMBWC, reinterpret_cast(src), static_cast(count_src), szBufferMBWC.get(), cch); + cch = MultiByteToWideChar(static_cast(m_from_wincp), 0, reinterpret_cast(src), static_cast(count_src), szBufferMBWC.get(), cch); size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szBufferMBWC.get(), cch) : static_cast(cch) - 1; // Query the required output size. Allocate buffer. Then convert again.