mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibWeb: Add parse_integer_digits
methods
The rules for parsing integers don't specify an upper bound on the value that can be returned, so the `parse_integer_digits` method can be used to check whether the given arbitrarily-large StringView is valid according to these rules. The `parse_integer` and `parse_non_negative_integer` methods would fail for values larger than 2147483647 when they shouldn't have.
This commit is contained in:
parent
7097152ebc
commit
d02b763cd6
Notes:
github-actions[bot]
2024-12-02 09:26:43 +00:00
Author: https://github.com/tcl3
Commit: d02b763cd6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2685
2 changed files with 38 additions and 13 deletions
|
@ -14,8 +14,10 @@
|
|||
namespace Web::HTML {
|
||||
|
||||
Optional<i32> parse_integer(StringView string);
|
||||
Optional<StringView> parse_integer_digits(StringView string);
|
||||
|
||||
Optional<u32> parse_non_negative_integer(StringView string);
|
||||
Optional<StringView> parse_non_negative_integer_digits(StringView string);
|
||||
|
||||
Optional<double> parse_floating_point_number(StringView string);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue