mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Make JsonParser::parse_number properly parse >32bit ints
This commit is contained in:
parent
1a12f964d4
commit
b37139e111
Notes:
sideshowbarker
2024-07-19 00:42:58 +09:00
Author: https://github.com/ccapitalK Commit: https://github.com/SerenityOS/serenity/commit/b37139e1117 Pull-request: https://github.com/SerenityOS/serenity/pull/4459 Issue: https://github.com/SerenityOS/serenity/issues/4377
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…
Reference in a new issue