mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:14:58 +00:00
AK: Make JsonParser::parse_number properly parse >32bit ints
This commit is contained in:
parent
1a12f964d4
commit
b37139e111
1 changed files with 6 additions and 2 deletions
|
@ -229,10 +229,14 @@ Optional<JsonValue> JsonParser::parse_number()
|
|||
if (to_unsigned_result.has_value()) {
|
||||
value = JsonValue(to_unsigned_result.value());
|
||||
} else {
|
||||
auto number = number_string.to_int();
|
||||
auto number = number_string.to_int<i64>();
|
||||
if (!number.has_value())
|
||||
return {};
|
||||
value = JsonValue(number.value());
|
||||
if (number.value() <= AK::NumericLimits<i32>::max()) {
|
||||
value = JsonValue((i32)number.value());
|
||||
} else {
|
||||
value = JsonValue(number.value());
|
||||
}
|
||||
}
|
||||
#ifndef KERNEL
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue