diff options
| author | Xavier Leroy <xavier.leroy@inria.fr> | 2015-07-24 09:36:03 +0000 |
|---|---|---|
| committer | Xavier Leroy <xavier.leroy@inria.fr> | 2015-07-24 09:36:03 +0000 |
| commit | a1bafbbb6723ae937e2553af43df5a04e281c8d8 (patch) | |
| tree | 33beacc493031c45516694e706df01dda730d738 /stdlib/scanf.ml | |
| parent | 844b1af40cd8f8b5db6f8c02d9441ba6f2c44552 (diff) | |
| download | ocaml-a1bafbbb6723ae937e2553af43df5a04e281c8d8.tar.gz | |
PR#6316: Scanf.scanf failure on %u formats when reading big integers.
The approach implemented is the second one suggested by BenoƮt Vaugon in the PR:
- The int_of_string functions accept a "0u" prefix meaning "decimal unsigned".
- The '%u' format of the scanf functions adds this "0u" prefix before conversion.
This is consistent with the current handling of unsigned hexa, octal, and binary numbers.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16241 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/scanf.ml')
| -rw-r--r-- | stdlib/scanf.ml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/stdlib/scanf.ml b/stdlib/scanf.ml index 08fc9aba50..948808830c 100644 --- a/stdlib/scanf.ml +++ b/stdlib/scanf.ml @@ -500,7 +500,8 @@ let token_bool ib = let token_int_literal conv ib = let tok = match conv with - | 'd' | 'i' | 'u' -> Scanning.token ib + | 'd' | 'i' -> Scanning.token ib + | 'u' -> "0u" ^ Scanning.token ib | 'o' -> "0o" ^ Scanning.token ib | 'x' | 'X' -> "0x" ^ Scanning.token ib | 'b' -> "0b" ^ Scanning.token ib |
