From 0402048629c76c4dbdb573a55db87ec34db8cf3f Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 24 Dec 2021 14:16:10 +0600 Subject: [PATCH] Use platform string comparison functions --- src/qt/qt.c | 1 + src/qt/qt_platform.cpp | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qt/qt.c b/src/qt/qt.c index f167660cd..7bbc91036 100644 --- a/src/qt/qt.c +++ b/src/qt/qt.c @@ -5,6 +5,7 @@ #if !defined(_WIN32) || !defined(__clang__) #include #endif +#include #include #include diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 9665c3a1b..a41509b9c 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -54,6 +54,8 @@ extern "C" { #ifdef Q_OS_WINDOWS #define NOMINMAX #include +#else +#include #endif #include <86box/86box.h> #include <86box/device.h> @@ -79,14 +81,20 @@ uint32_t lang_id = 0x0409, lang_sys = 0x0409; // Multilangual UI variables, for int stricmp(const char* s1, const char* s2) { - return QByteArray(s1).compare(s2, Qt::CaseInsensitive); +#ifdef Q_OS_WINDOWS + return _stricmp(s1, s2); +#else + return strcasecmp(s1, s2); +#endif } int strnicmp(const char *s1, const char *s2, size_t n) { - QByteArray b1(s1, std::min(strlen(s1), n)); - QByteArray b2(s2, std::min(strlen(s2), n)); - return b1.compare(b2, Qt::CaseInsensitive); +#ifdef Q_OS_WINDOWS + return _strnicmp(s1, s2, n); +#else + return strncasecmp(s1, s2, n); +#endif } void