From 262b1f3f38627bc29ec5310ebda10f9bc0dd7729 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 11 Apr 2026 11:57:31 +0200 Subject: [PATCH 1/3] fix(ini): Support plus sign character prefix in INI integer parse --- Core/GameEngine/Source/Common/INI/INI.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Core/GameEngine/Source/Common/INI/INI.cpp b/Core/GameEngine/Source/Common/INI/INI.cpp index a59d2b0b6fc..b8c76a2d3c9 100644 --- a/Core/GameEngine/Source/Common/INI/INI.cpp +++ b/Core/GameEngine/Source/Common/INI/INI.cpp @@ -1618,8 +1618,16 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList template Type scanType(std::string_view token) { - // TheSuperHackers @info std::from_chars cannot parse "-1" as uint32 so the result needs to be int64 for integers. - std::conditional_t, Int64, Real> result{}; + DEBUG_ASSERTCRASH(!token.empty(), "token is not expected empty"); + + // Unlike sscanf, std::from_chars cannot parse "+" + if (token[0] == '+') + { + token.remove_prefix(1); + } + + // Unlike sscanf, std::from_chars cannot parse "-" as unsigned integer + std::conditional_t, Int64, Type> result{}; const auto [ptr, ec] = std::from_chars(token.data(), token.data() + token.size(), result); if (ec != std::errc{}) From 8f190fb469587b44bd90f8bd417fa1dd784326d3 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sat, 11 Apr 2026 12:05:41 +0200 Subject: [PATCH 2/3] Fix assert --- Core/GameEngine/Source/Common/INI/INI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/GameEngine/Source/Common/INI/INI.cpp b/Core/GameEngine/Source/Common/INI/INI.cpp index b8c76a2d3c9..e27c38ae3d5 100644 --- a/Core/GameEngine/Source/Common/INI/INI.cpp +++ b/Core/GameEngine/Source/Common/INI/INI.cpp @@ -1618,7 +1618,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList template Type scanType(std::string_view token) { - DEBUG_ASSERTCRASH(!token.empty(), "token is not expected empty"); + DEBUG_ASSERTCRASH(!token.empty(), ("token is not expected empty")); // Unlike sscanf, std::from_chars cannot parse "+" if (token[0] == '+') From a1fc7c80e85d533f0802fb5c0fb1335c9706f7c4 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 12 Apr 2026 09:58:57 +0200 Subject: [PATCH 3/3] tweak assert message --- Core/GameEngine/Source/Common/INI/INI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/GameEngine/Source/Common/INI/INI.cpp b/Core/GameEngine/Source/Common/INI/INI.cpp index e27c38ae3d5..dfcfdb6e8c7 100644 --- a/Core/GameEngine/Source/Common/INI/INI.cpp +++ b/Core/GameEngine/Source/Common/INI/INI.cpp @@ -1618,7 +1618,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList template Type scanType(std::string_view token) { - DEBUG_ASSERTCRASH(!token.empty(), ("token is not expected empty")); + DEBUG_ASSERTCRASH(!token.empty(), ("token is not expected to be empty")); // Unlike sscanf, std::from_chars cannot parse "+" if (token[0] == '+')