From a6a66aea2af72100b78929d5ae701a3367dda7a4 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Wed, 21 Jul 2021 10:24:44 -0400 Subject: [PATCH] Fix bool to int logic --- Source/Core/Common/StringUtil.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index c2851932886f..8ee8e6045a4e 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -14,8 +14,13 @@ #include #include +#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#ifndef _WIN32 +#include +#endif + #ifdef _MSC_VER #include #define HAS_STD_FILESYSTEM @@ -60,10 +65,16 @@ bool TryParse(const std::string& str, T* output, int base = 0) { char* end_ptr = nullptr; - if (str == "true") - return 1; - else if (str == "false") - return 0; + if (!strcasecmp("true", str.c_str())) + { + *output = static_cast(1); + return true; + } + else if (!strcasecmp("false", str.c_str())) + { + *output = static_cast(0); + return true; + } // Set errno to a clean slate. errno = 0;