Browse Source

Util: Fix stringToNumber in Format::Parser

master
Riyyi 2 years ago
parent
commit
f08225136f
  1. 6
      src/util/format/parser.cpp

6
src/util/format/parser.cpp

@ -147,10 +147,8 @@ size_t Parser::stringToNumber(std::string_view value)
{ {
size_t result = 0; size_t result = 0;
for (size_t i = 1; i < value.length(); ++i) { for (size_t i = 0; i < value.length(); ++i) {
if (value[i] < '0' || value[i] > '9') { VERIFY(value[i] >= '0' && value[i] <= '9', "unexpected '%c'", value[i]);
VERIFY_NOT_REACHED();
}
result *= 10; result *= 10;
result += value[i] - '0'; // Subtract ASCII 48 to get the number result += value[i] - '0'; // Subtract ASCII 48 to get the number
} }

Loading…
Cancel
Save