diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2021-04-02 18:35:00 +0200 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2021-04-07 09:31:47 +0200 |
commit | 746f1ca11a18af97e4fed06e5ac1af622bf21d35 (patch) | |
tree | f8d9ef3b48b570d3b6827f19092c92e3acf74e6e /src | |
parent | e0561dbded57f195e7842cf69764e3ee2c3a71da (diff) | |
download | openttd-746f1ca11a18af97e4fed06e5ac1af622bf21d35.tar.xz |
Codechange: Remove the now meaningless console_cp parameter from OTTD2FS
Diffstat (limited to 'src')
-rw-r--r-- | src/debug.cpp | 2 | ||||
-rw-r--r-- | src/os/windows/crashlog_win.cpp | 14 | ||||
-rw-r--r-- | src/os/windows/font_win32.cpp | 6 | ||||
-rw-r--r-- | src/os/windows/win32.cpp | 4 | ||||
-rw-r--r-- | src/os/windows/win32.h | 2 | ||||
-rw-r--r-- | src/stdafx.h | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/src/debug.cpp b/src/debug.cpp index eb8dc5d4f..25a0f1a82 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -133,7 +133,7 @@ static void debug_print(const char *dbg, const char *buf) seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf); #if defined(_WIN32) wchar_t system_buf[512]; - convert_to_fs(buffer, system_buf, lengthof(system_buf), true); + convert_to_fs(buffer, system_buf, lengthof(system_buf)); fputws(system_buf, stderr); #else fputs(buffer, stderr); diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 9768bcc82..a7ff8e411 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -705,21 +705,21 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA /* Add path to crash.log and crash.dmp (if any) to the crash window text */ size_t len = wcslen(_crash_desc) + 2; - len += wcslen(convert_to_fs(CrashLogWindows::current->crashlog_filename, filenamebuf, lengthof(filenamebuf), false)) + 2; - len += wcslen(convert_to_fs(CrashLogWindows::current->crashdump_filename, filenamebuf, lengthof(filenamebuf), false)) + 2; - len += wcslen(convert_to_fs(CrashLogWindows::current->screenshot_filename, filenamebuf, lengthof(filenamebuf), false)) + 1; + len += wcslen(convert_to_fs(CrashLogWindows::current->crashlog_filename, filenamebuf, lengthof(filenamebuf))) + 2; + len += wcslen(convert_to_fs(CrashLogWindows::current->crashdump_filename, filenamebuf, lengthof(filenamebuf))) + 2; + len += wcslen(convert_to_fs(CrashLogWindows::current->screenshot_filename, filenamebuf, lengthof(filenamebuf))) + 1; wchar_t *text = AllocaM(wchar_t, len); - int printed = _snwprintf(text, len, _crash_desc, convert_to_fs(CrashLogWindows::current->crashlog_filename, filenamebuf, lengthof(filenamebuf), false)); + int printed = _snwprintf(text, len, _crash_desc, convert_to_fs(CrashLogWindows::current->crashlog_filename, filenamebuf, lengthof(filenamebuf))); if (printed < 0 || (size_t)printed > len) { MessageBox(wnd, L"Catastrophic failure trying to display crash message. Could not perform text formatting.", L"OpenTTD", MB_ICONERROR); return FALSE; } - if (convert_to_fs(CrashLogWindows::current->crashdump_filename, filenamebuf, lengthof(filenamebuf), false)[0] != L'\0') { + if (convert_to_fs(CrashLogWindows::current->crashdump_filename, filenamebuf, lengthof(filenamebuf))[0] != L'\0') { wcscat(text, L"\n"); wcscat(text, filenamebuf); } - if (convert_to_fs(CrashLogWindows::current->screenshot_filename, filenamebuf, lengthof(filenamebuf), false)[0] != L'\0') { + if (convert_to_fs(CrashLogWindows::current->screenshot_filename, filenamebuf, lengthof(filenamebuf))[0] != L'\0') { wcscat(text, L"\n"); wcscat(text, filenamebuf); } @@ -738,7 +738,7 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA wchar_t filenamebuf[MAX_PATH * 2]; char filename[MAX_PATH]; if (CrashLogWindows::current->WriteSavegame(filename, lastof(filename))) { - convert_to_fs(filename, filenamebuf, lengthof(filenamebuf), false); + convert_to_fs(filename, filenamebuf, lengthof(filenamebuf)); size_t len = lengthof(_save_succeeded) + wcslen(filenamebuf) + 1; wchar_t *text = AllocaM(wchar_t, len); _snwprintf(text, len, _save_succeeded, filenamebuf); diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index 1d923ddb2..59d5e0ad8 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -606,12 +606,12 @@ void LoadWin32Font(FontSize fs) /* See if this is an absolute path. */ if (FileExists(settings->font)) { - convert_to_fs(settings->font, fontPath, lengthof(fontPath), false); + convert_to_fs(settings->font, fontPath, lengthof(fontPath)); } else { /* Scan the search-paths to see if it can be found. */ std::string full_font = FioFindFullPath(BASE_DIR, settings->font); if (!full_font.empty()) { - convert_to_fs(full_font.c_str(), fontPath, lengthof(fontPath), false); + convert_to_fs(full_font.c_str(), fontPath, lengthof(fontPath)); } } @@ -649,7 +649,7 @@ void LoadWin32Font(FontSize fs) if (logfont.lfFaceName[0] == 0) { logfont.lfWeight = strcasestr(settings->font, " bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts. - convert_to_fs(settings->font, logfont.lfFaceName, lengthof(logfont.lfFaceName), false); + convert_to_fs(settings->font, logfont.lfFaceName, lengthof(logfont.lfFaceName)); } HFONT font = CreateFontIndirect(&logfont); diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 568876ab1..3f72d1e72 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -578,7 +578,7 @@ std::string FS2OTTD(const std::wstring &name) * @param console_cp convert to the console encoding instead of the normal system encoding. * @return converted string; if failed string is of zero-length */ -std::wstring OTTD2FS(const std::string &name, bool console_cp) +std::wstring OTTD2FS(const std::string &name) { int name_len = (name.length() >= INT_MAX) ? INT_MAX : (int)name.length(); int len = MultiByteToWideChar(CP_UTF8, 0, name.c_str(), name_len, nullptr, 0); @@ -618,7 +618,7 @@ char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen) * @param console_cp convert to the console encoding instead of the normal system encoding. * @return pointer to system_buf. If conversion fails the string is of zero-length */ -wchar_t *convert_to_fs(const char *name, wchar_t *system_buf, size_t buflen, bool console_cp) +wchar_t *convert_to_fs(const char *name, wchar_t *system_buf, size_t buflen) { int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, system_buf, (int)buflen); if (len == 0) system_buf[0] = '\0'; diff --git a/src/os/windows/win32.h b/src/os/windows/win32.h index 60cbed6e9..095181c46 100644 --- a/src/os/windows/win32.h +++ b/src/os/windows/win32.h @@ -17,7 +17,7 @@ typedef void (*Function)(int); bool LoadLibraryList(Function proc[], const char *dll); char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen); -wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen, bool console_cp = false); +wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen); #if defined(__MINGW32__) && !defined(__MINGW64__) #define SHGFP_TYPE_CURRENT 0 diff --git a/src/stdafx.h b/src/stdafx.h index 06860f104..f13104a5b 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -263,7 +263,7 @@ # define unlink(file) _wunlink(OTTD2FS(file).c_str()) std::string FS2OTTD(const std::wstring &name); - std::wstring OTTD2FS(const std::string &name, bool console_cp = false); + std::wstring OTTD2FS(const std::string &name); # elif defined(WITH_ICONV) # define fopen(file, mode) fopen(OTTD2FS(file).c_str(), mode) std::string FS2OTTD(const std::string &name); |