Skip to content

Commit

Permalink
Don't force const pointers be modifyable
Browse files Browse the repository at this point in the history
It's workaround, and must not be that
  • Loading branch information
Wohlstand committed Dec 7, 2016
1 parent cd4bd6e commit 84e8cb3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions LunaDll/GlobalFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 84e8cb3

Please sign in to comment.