From 84e8cb3e7d00eaef65ac51d1ed922b466674e09c Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Thu, 8 Dec 2016 00:35:44 +0300 Subject: [PATCH] Don't force const pointers be modifyable It's workaround, and must not be that --- LunaDll/GlobalFuncs.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LunaDll/GlobalFuncs.cpp b/LunaDll/GlobalFuncs.cpp index 06cd7e817..e1da4c9fd 100644 --- a/LunaDll/GlobalFuncs.cpp +++ b/LunaDll/GlobalFuncs.cpp @@ -163,7 +163,7 @@ std::wstring Str2WStr(const std::string &str) { std::wstring dest; dest.resize(str.size()); - int newlen=MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), (wchar_t*)dest.c_str(), str.length()); + int newlen=MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), &dest[0], str.length()); dest.resize(newlen); return dest; } @@ -172,7 +172,7 @@ std::string WStr2Str(const std::wstring &wstr) { std::string dest; dest.resize((wstr.size()*2)); - int newlen = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), wstr.length(), (LPSTR)dest.c_str(), dest.size(), NULL, NULL); + int newlen = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), wstr.length(), &dest[0], dest.size(), NULL, NULL); dest.resize(newlen); return dest; } @@ -181,7 +181,7 @@ std::string WStr2StrA(const std::wstring &wstr) { std::string dest; dest.resize((wstr.size()*2)); - int newlen = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), wstr.length(), (LPSTR)dest.c_str(), dest.size(), NULL, NULL); + int newlen = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), wstr.length(), &dest[0], dest.size(), NULL, NULL); dest.resize(newlen); return dest; } @@ -190,7 +190,7 @@ std::wstring StrA2WStr(const std::string &str) { std::wstring dest; dest.resize(str.size()); - MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), (wchar_t*)dest.c_str(), str.length()); + MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.length(), &dest[0], str.length()); return dest; }