diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-11-15 17:55:05 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-11-15 18:33:09 +0200 |
commit | d8edf07ed9e7a3e2f2ab43ffd2935b93326f2caa (patch) | |
tree | fcc91844900827238324f8ad93f1dbf64306b13b /shell/source/win32/shlxthandler/util/utilities.cxx | |
parent | 42782fddff98eeab5c8249918e9ba000f08c22e8 (diff) |
Bin use of UTF-16 expat variant in the Windows shell extension
Thus we can drop that variant completely.
Change-Id: I11a8e40436921219bd6dd4afad4c7907ccb6b84c
Diffstat (limited to 'shell/source/win32/shlxthandler/util/utilities.cxx')
-rw-r--r-- | shell/source/win32/shlxthandler/util/utilities.cxx | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx index a92a69cce8aa..c62ec833b4fc 100644 --- a/shell/source/win32/shlxthandler/util/utilities.cxx +++ b/shell/source/win32/shlxthandler/util/utilities.cxx @@ -32,36 +32,30 @@ const size_t MAX_RES_STRING = 1024; const wchar_t SPACE_CHAR = _T(' '); -//--------------------------------- -/** -*/ -std::wstring StringToWString(const std::string& String) +static std::wstring StringToWString(const std::string& String, int codepage) { int len = MultiByteToWideChar( - CP_ACP, 0, String.c_str(), -1, 0, 0); + codepage, 0, String.c_str(), -1, 0, 0); wchar_t* buff = reinterpret_cast<wchar_t*>( _alloca(len * sizeof(wchar_t))); MultiByteToWideChar( - CP_ACP, 0, String.c_str(), -1, buff, len); + codepage, 0, String.c_str(), -1, buff, len); return std::wstring(buff); } -//--------------------------------- -/** -*/ -std::string WStringToString(const std::wstring& String) +static std::string WStringToString(const std::wstring& String, int codepage) { int len = WideCharToMultiByte( - CP_ACP, 0, String.c_str(), -1, 0, 0, 0, 0); + codepage, 0, String.c_str(), -1, 0, 0, 0, 0); char* buff = reinterpret_cast<char*>( _alloca(len * sizeof(char))); WideCharToMultiByte( - CP_ACP, 0, String.c_str(), -1, buff, len, 0, 0); + codepage, 0, String.c_str(), -1, buff, len, 0, 0); return std::string(buff); } @@ -69,6 +63,30 @@ std::string WStringToString(const std::wstring& String) //--------------------------------- /** */ +std::wstring StringToWString(const std::string& String) +{ + return StringToWString(String, CP_ACP); +} + +//--------------------------------- +/** +*/ +std::string WStringToString(const std::wstring& String) +{ + return WStringToString(String, CP_ACP); +} + +//--------------------------------- +/** +*/ +std::wstring UTF8ToWString(const std::string& String) +{ + return StringToWString(String, CP_UTF8); +} + +//--------------------------------- +/** +*/ std::wstring GetResString(int ResId) { wchar_t szResStr[MAX_RES_STRING]; |