fix cctype usage

According to the documentation, we should cast to unsigned char.
Anything negative is undefined behavior.
This commit is contained in:
Megamouse committed 2026-09-15 17:38:26 +02:00
1 parent b6bdf0d92d
commit ca522cf84c
36 files changed
+524 -115

No files matched your search

+2 -1
View File
@@ -10,6 +10,7 @@
#include "util/types.hpp"
#include "util/asm.hpp"
#include "util/cctype.hpp"
#include <charconv>
#include <regex>
@@ -329,7 +330,7 @@ bool patch_engine::load(patch_map& patches_map, const std::string& path, std::st
is_valid = false;
continue;
}
else if (serial.size() != 9 || !std::all_of(serial.begin(), serial.end(), [](char c) { return std::isalnum(static_cast<unsigned char>(c)); }))
else if (serial.size() != 9 || !std::all_of(serial.begin(), serial.end(), [](char c) { return utils::isalnum(c); }))
{
append_log_message(log_messages, fmt::format("Error: Serial '%s' invalid (patch: %s, key: %s, location: %s, file: %s)", serial, description, main_key, get_yaml_node_location(serial_node), path), &patch_log.error);
is_valid = false;