From 4394399bc709604ab2e562fe0b8ef2769c371638 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 12 Mar 2023 16:29:32 +0000 Subject: [PATCH] sum and fsum --- cpdfaddtext.ml | 2 +- cpdfpng.ml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpdfaddtext.ml b/cpdfaddtext.ml index 5812b9d..67dab6f 100644 --- a/cpdfaddtext.ml +++ b/cpdfaddtext.ml @@ -41,7 +41,7 @@ let width_of_text font text = match font with | Pdftext.SimpleFont {Pdftext.fontmetrics = Some fontmetrics} -> begin try - fold_left ( +. ) 0. (map (fun c -> fontmetrics.(int_of_char c)) (explode text)) + fsum (map (fun c -> fontmetrics.(int_of_char c)) (explode text)) with _ -> 0. end diff --git a/cpdfpng.ml b/cpdfpng.ml index edc3ade..b9f3702 100644 --- a/cpdfpng.ml +++ b/cpdfpng.ml @@ -35,7 +35,7 @@ let read_chunk i = (string_of_tag chunktype, chunkdata) let concat_bytes ss = - let total_length = fold_left ( + ) 0 (map bytes_size ss) in + let total_length = sum (map bytes_size ss) in let s' = mkbytes total_length in let p = ref 0 in iter