From 027c17558fde26c51688e44707f6eb3a13c67be4 Mon Sep 17 00:00:00 2001 From: Lioncash <mathew1800@gmail.com> Date: Sun, 16 Jun 2019 23:24:26 -0400 Subject: [PATCH] Common/MsgHandler: Use fmt::print on non-Windows OSes Provides the same behavior. --- Source/Core/Common/MsgHandler.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Core/Common/MsgHandler.cpp b/Source/Core/Common/MsgHandler.cpp index 43f24c9865..01a51a7e3f 100644 --- a/Source/Core/Common/MsgHandler.cpp +++ b/Source/Core/Common/MsgHandler.cpp @@ -2,20 +2,23 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Common/MsgHandler.h" + #include <cstdarg> -#include <cstdio> #include <string> +#ifdef _WIN32 +#include <windows.h> +#else +#include <cstdio> +#include <fmt/format.h> +#endif + #include "Common/Common.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" -#include "Common/MsgHandler.h" #include "Common/StringUtil.h" -#ifdef _WIN32 -#include <windows.h> -#endif - bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, MsgType style); static MsgAlertHandler msg_handler = DefaultMsgHandler; static bool AlertEnabled = true; @@ -111,7 +114,7 @@ bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, MsgTy return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(), window_style | (yes_no ? MB_YESNO : MB_OK)); #else - fprintf(stderr, "%s\n", text); + fmt::print(stderr, "{}\n", text); // Return no to any question (which will in general crash the emulator) return false;