Skip to content

Commit 5455f2a

Browse files
committed
Fix L, l, n format specs in Pretty
1 parent 040708b commit 5455f2a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ocamlutil/pretty.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ let gprintf (finish : doc -> 'b)
725725
invalid_arg ("dprintf: unimplemented format "
726726
^ (String.sub format i (j-i+1)));
727727
let j' = succ j in (* eat the d,i,x etc. *)
728-
let format_spec = Bytes.of_string "% " in
729-
Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
728+
let format_spec = Bytes.of_string "%L " in
729+
Bytes.set format_spec 2 (fget j'); (* format_spec = "%Lx", etc. *)
730730
Obj.magic(fun n ->
731731
collect (dctext1 acc
732732
(Printf.sprintf (Scanf.format_from_string (Bytes.to_string format_spec) "%Lx") n))
@@ -735,8 +735,8 @@ let gprintf (finish : doc -> 'b)
735735
if j != i + 1 then invalid_arg ("dprintf: unimplemented format "
736736
^ (String.sub format i (j-i+1)));
737737
let j' = succ j in (* eat the d,i,x etc. *)
738-
let format_spec = Bytes.of_string "% " in
739-
Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
738+
let format_spec = Bytes.of_string "%l " in
739+
Bytes.set format_spec 2 (fget j'); (* format_spec = "%lx", etc. *)
740740
Obj.magic(fun n ->
741741
collect (dctext1 acc
742742
(Printf.sprintf (Scanf.format_from_string (Bytes.to_string format_spec) "%lx") n))
@@ -745,8 +745,8 @@ let gprintf (finish : doc -> 'b)
745745
if j != i + 1 then invalid_arg ("dprintf: unimplemented format "
746746
^ (String.sub format i (j-i+1)));
747747
let j' = succ j in (* eat the d,i,x etc. *)
748-
let format_spec = Bytes.of_string "% " in
749-
Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
748+
let format_spec = Bytes.of_string "%n " in
749+
Bytes.set format_spec 2 (fget j'); (* format_spec = "%nx", etc. *)
750750
Obj.magic(fun n ->
751751
collect (dctext1 acc
752752
(Printf.sprintf (Scanf.format_from_string (Bytes.to_string format_spec) "%nx") n))

0 commit comments

Comments
 (0)