Common: Rename UTF16ToUTF8

This function does *not* always convert from UTF-16. It converts
from UTF-16 on Windows and UTF-32 on other operating systems.

Also renaming UTF8ToUTF16 for consistency, even though it
technically doesn't have the same problem since it only was
implemented on Windows.
This commit is contained in:
JosJuice
2020-07-08 14:51:35 +02:00
parent cd51552fe4
commit 15d9fab0bb
14 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ std::vector<std::string> CommandLineToUtf8Argv(PCWSTR command_line)
std::vector<std::string> argv(nargs);
for (int i = 0; i < nargs; ++i)
{
argv[i] = UTF16ToUTF8(tokenized[i]);
argv[i] = WStringToUTF8(tokenized[i]);
}
LocalFree(tokenized);
+3 -3
View File
@@ -180,7 +180,7 @@ void ResetCurrentProgress()
void Error(const std::string& text)
{
auto wide_text = UTF8ToUTF16(text);
auto wide_text = UTF8ToWString(text);
MessageBox(nullptr,
(L"A fatal error occured and the updater cannot continue:\n " + wide_text).c_str(),
@@ -200,7 +200,7 @@ void SetCurrentProgress(int current, int total)
void SetDescription(const std::string& text)
{
SetWindowText(label_handle, UTF8ToUTF16(text).c_str());
SetWindowText(label_handle, UTF8ToWString(text).c_str());
}
void MessageLoop()
@@ -256,7 +256,7 @@ void LaunchApplication(std::string path)
{
// Hack: Launching the updater over the explorer ensures that admin priviliges are dropped. Why?
// Ask Microsoft.
ShellExecuteW(nullptr, nullptr, L"explorer.exe", UTF8ToUTF16(path).c_str(), nullptr, SW_SHOW);
ShellExecuteW(nullptr, nullptr, L"explorer.exe", UTF8ToWString(path).c_str(), nullptr, SW_SHOW);
}
void Sleep(int sleep)