Codechange: Replace atoi and atoll with ParseInteger.

This commit is contained in:
frosch
2025-04-29 16:12:54 +02:00
committed by frosch
parent 3973199879
commit cdafc50c94
17 changed files with 108 additions and 47 deletions

View File

@@ -14,6 +14,7 @@
#include "script_info.hpp"
#include "script_scanner.hpp"
#include "../core/string_consumer.hpp"
#include "../3rdparty/fmt/format.h"
#include "../safeguards.h"
@@ -229,8 +230,9 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm)
sign = -1;
key_string++;
}
int key = atoi(key_string) * sign;
config->labels[key] = StrMakeValid(label);
auto key = ParseInteger<int>(key_string);
if (!key.has_value()) return SQ_ERROR;
config->labels[*key * sign] = StrMakeValid(label);
sq_pop(vm, 2);
}