diff --git a/src/common/filesystem/source/fs_findfile.cpp b/src/common/filesystem/source/fs_findfile.cpp index 689a5d644a..06d9b69f18 100644 --- a/src/common/filesystem/source/fs_findfile.cpp +++ b/src/common/filesystem/source/fs_findfile.cpp @@ -202,20 +202,26 @@ static size_t FS_GetFileSize(findstate_t* handle, const char* pathname) std::wstring toWide(const char* str) { int len = (int)strlen(str); - int size_needed = MultiByteToWideChar(CP_UTF8, 0, str, len, nullptr, 0); std::wstring wide; - wide.resize(size_needed); - MultiByteToWideChar(CP_UTF8, 0, str, len, &wide.front(), size_needed); + if (len > 0) + { + int size_needed = MultiByteToWideChar(CP_UTF8, 0, str, len, nullptr, 0); + wide.resize(size_needed); + MultiByteToWideChar(CP_UTF8, 0, str, len, &wide.front(), size_needed); + } return wide; } static std::string toUtf8(const wchar_t* str) { auto len = wcslen(str); - int size_needed = WideCharToMultiByte(CP_UTF8, 0, str, (int)len, nullptr, 0, nullptr, nullptr); std::string utf8; - utf8.resize(size_needed); - WideCharToMultiByte(CP_UTF8, 0, str, (int)len, &utf8.front(), size_needed, nullptr, nullptr); + if (len > 0) + { + int size_needed = WideCharToMultiByte(CP_UTF8, 0, str, (int)len, nullptr, 0, nullptr, nullptr); + utf8.resize(size_needed); + WideCharToMultiByte(CP_UTF8, 0, str, (int)len, &utf8.front(), size_needed, nullptr, nullptr); + } return utf8; } diff --git a/src/common/rendering/gl/gl_hwtexture.cpp b/src/common/rendering/gl/gl_hwtexture.cpp index 8fe1b074b4..37b066155b 100644 --- a/src/common/rendering/gl/gl_hwtexture.cpp +++ b/src/common/rendering/gl/gl_hwtexture.cpp @@ -45,7 +45,6 @@ #include "gl_renderstate.h" #include "gl_samplers.h" #include "gl_hwtexture.h" -#include "printf.h" namespace OpenGLRenderer { diff --git a/src/common/utility/utf8.cpp b/src/common/utility/utf8.cpp index 1ac6ea62ba..cad98375e9 100644 --- a/src/common/utility/utf8.cpp +++ b/src/common/utility/utf8.cpp @@ -413,7 +413,7 @@ int getAlternative(int code) case 0x41e: return 'O'; case 0x420: return 'P'; case 0x421: return 'C'; - case 0x423: return 'T'; + case 0x422: return 'T'; case 0x425: return 'X'; case 0x430: return 'a'; case 0x435: return 'e';