Fix bug with incorrect use of std::tolower.

This commit is contained in:
Zaid Ismail 2025-01-30 12:46:49 +02:00
parent ce1b208fc5
commit c858ad6e8f

View File

@ -3,12 +3,14 @@
#pragma once
#include <algorithm> // std::transform
#include <cctype> // std::tolower
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QPainter>
#include <QScrollBar>
#include <cctype> // std::tolower
#include "background_music_player.h"
#include "compatibility_info.h"
@ -66,8 +68,12 @@ public:
static bool CompareStringsAscending(GameInfo a, GameInfo b, int columnIndex) {
switch (columnIndex) {
case 1:
return std::tolower(a.name) < std::tolower(b.name);
case 1: {
std::string name_a = a.name, name_b = b.name;
std::transform(name_a.begin(), name_a.end(), name_a.begin(), ::tolower);
std::transform(name_b.begin(), name_b.end(), name_b.begin(), ::tolower);
return name_a < name_b;
}
case 2:
return a.compatibility.status < b.compatibility.status;
case 3:
@ -91,8 +97,12 @@ public:
static bool CompareStringsDescending(GameInfo a, GameInfo b, int columnIndex) {
switch (columnIndex) {
case 1:
return std::tolower(a.name) > std::tolower(b.name);
case 1: {
std::string name_a = a.name, name_b = b.name;
std::transform(name_a.begin(), name_a.end(), name_a.begin(), ::tolower);
std::transform(name_b.begin(), name_b.end(), name_b.begin(), ::tolower);
return name_a > name_b;
}
case 2:
return a.compatibility.status > b.compatibility.status;
case 3: