File tree Expand file tree Collapse file tree
Core/GameEngine/Source/Common/INI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1618,8 +1618,17 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
16181618template <typename Type>
16191619Type scanType (std::string_view token)
16201620{
1621- // TheSuperHackers @info std::from_chars cannot parse "-1" as uint32 so the result needs to be int64 for integers.
1622- std::conditional_t <std::is_integral_v<Type>, Int64, Real> result{};
1621+ DEBUG_ASSERTCRASH (!token.empty (), (" token is not expected to be empty" ));
1622+
1623+ // Unlike sscanf, std::from_chars cannot parse "+".
1624+ // Consume the plus symbol to accommodate custom ini files that have numbers prefixed with a plus.
1625+ if (token[0 ] == ' +' )
1626+ {
1627+ token.remove_prefix (1 );
1628+ }
1629+
1630+ // Unlike sscanf, std::from_chars cannot parse "-" as unsigned integer.
1631+ std::conditional_t <std::is_integral_v<Type>, Int64, Type> result{};
16231632 const auto [ptr, ec] = std::from_chars (token.data (), token.data () + token.size (), result);
16241633
16251634 if (ec != std::errc{})
You can’t perform that action at this time.
0 commit comments