From 47eb86cf925e4c76f563a8efffb337d0fffc480b Mon Sep 17 00:00:00 2001 From: yami-hack Date: Mon, 13 Jun 2016 16:56:09 +0800 Subject: [PATCH] Update string_util.cpp --- src/common/string_util.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 0aabffd5b..17e5cd7f2 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -323,11 +323,13 @@ std::u16string UTF8ToUTF16(const std::string& input) static std::wstring CPToUTF16(u32 code_page, const std::string& input) { auto const size = MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), nullptr, 0); - std::wstring output; + + std::wstring output; output.resize(size); if (size == 0 || size != MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), &output[0], static_cast(output.size()))) output.clear(); + return output; }