lib: use Curl_str_number() for parsing decimal numbers

Instead of strtoul() and strtol() calls.

Easier API with better integer overflow detection and built-in max check
that now comes automatic everywhere this is used.

Closes #16319
This commit is contained in:
Daniel Stenberg 2025-02-13 08:45:43 +01:00
parent 130b6891c8
commit b696fc129b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
16 changed files with 180 additions and 202 deletions

View file

@ -93,9 +93,9 @@ Curl_str_number
6: ("00000000000000000000000000001234") 0, [1234] line 32
7: ("0123 345") 0, [123] line 4
8: ("0123O345") 0, [123] line 4
9: ("-12") 0, [0] line 0
10: (" 123") 0, [0] line 0
11: ("") 0, [0] line 0
9: ("-12") 8, [0] line 0
10: (" 123") 8, [0] line 0
11: ("") 8, [0] line 0
Curl_str_number / max
0: ("9223372036854775808") 0, [9223372036854775808] line 19
1: ("9223372036854775809") 0, [9223372036854775809] line 19