| 4314 | } |
| 4315 | |
| 4316 | static __attribute__((__noinline__)) bool scanf_get_dec( |
| 4317 | struct scanf_stream_s *in, size_t *width, uint64_t *p, bool *r) |
| 4318 | { |
| 4319 | char c = scanf_get_char_n(in, width); |
| 4320 | if (!isdigit(c)) |
| 4321 | { |
| 4322 | scanf_unget_char_n(c, in, width); |
| 4323 | return false; |
| 4324 | } |
| 4325 | uint64_t i = 0; |
| 4326 | do |
| 4327 | { |
| 4328 | i *= 10; |
| 4329 | uint64_t d = (c - '0'); |
| 4330 | if (UINT64_MAX - i < d) |
| 4331 | *r = true; |
| 4332 | i = (UINT64_MAX - i < d? UINT64_MAX: i + d); |
| 4333 | } |
| 4334 | while (isdigit(c = scanf_get_char_n(in, width))); |
| 4335 | scanf_unget_char_n(c, in, width); |
| 4336 | *p = i; |
| 4337 | return true; |
| 4338 | } |
| 4339 | |
| 4340 | static __attribute__((__noinline__)) bool scanf_get_oct( |
| 4341 | struct scanf_stream_s *in, size_t *width, uint64_t *p, bool *r) |
no test coverage detected