From 061c13b84c7571a55b2ff62c78ea07037a3bd7df Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Fri, 13 Jan 2017 23:54:21 -0500 Subject: [PATCH] fix XP runtime error with MinGW --- ui/drivers/ui_win32.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/drivers/ui_win32.c b/ui/drivers/ui_win32.c index 42777b92ea..7514a0a5a5 100644 --- a/ui/drivers/ui_win32.c +++ b/ui/drivers/ui_win32.c @@ -613,7 +613,12 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) * This is needed for proper multi-byte string display until Unicode is fully supported. */ MultiByteToWideChar(CP_UTF8, 0, title, -1, title_wide, sizeof(title_wide) / sizeof(title_wide[0])); +#if !defined(_MSC_VER) && (_WIN32_WINNT > _WIN32_WINNT_WINXP) + /* MinGW does not define wcstombs_s for XP, but MSVC does */ wcstombs_s(&converted, title_cp, sizeof(title_cp), title_wide, sizeof(title_cp) - 1); +#else + wcstombs(title_cp, title_wide, sizeof(title_cp) - 1); +#endif if (!win32_browser(owner, win32_file, extensions, title_cp, initial_dir))