mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-16 21:58:24 -05:00
do not convert to stdString expensively when parsing ordered json numbers
This commit is contained in:
@@ -631,7 +631,8 @@ struct JsonParser final {
|
||||
|
||||
if (str[i] != '.' && str[i] != 'e' && str[i] != 'E'
|
||||
&& (i - start_pos) <= static_cast<unsigned>(std::numeric_limits<int>::digits10)) {
|
||||
return std::atoi(str.toStdString().c_str() + start_pos);
|
||||
bool ok;
|
||||
return str.mid(start_pos, i - start_pos).toInt(&ok);
|
||||
}
|
||||
|
||||
// Decimal part
|
||||
@@ -658,7 +659,8 @@ struct JsonParser final {
|
||||
i++;
|
||||
}
|
||||
|
||||
return std::strtod(str.toStdString().c_str() + start_pos, nullptr);
|
||||
bool ok;
|
||||
return str.mid(start_pos, i - start_pos).toDouble(&ok);
|
||||
}
|
||||
|
||||
/* expect(str, res)
|
||||
|
||||
Reference in New Issue
Block a user