diff --git a/plotkicadsch.opam b/plotkicadsch.opam index 41920ea..1f0c25a 100644 --- a/plotkicadsch.opam +++ b/plotkicadsch.opam @@ -26,7 +26,7 @@ depends: [ "sha" "git" {>= "2.0.0"} "git-unix" - "base64" {= "2.3.0"} + "base64" {>= "3.0.0"} "patience_diff" { < "v0.12.0" } "core_kernel" "cmdliner" diff --git a/plotkicadsch/src/kicadDiff.ml b/plotkicadsch/src/kicadDiff.ml index d8653eb..2b0b3ab 100644 --- a/plotkicadsch/src/kicadDiff.ml +++ b/plotkicadsch/src/kicadDiff.ml @@ -81,7 +81,7 @@ let intersect_lists l1l l2l = ~f:(fun (name2, sha2) -> List.exists ~f:(fun (name1, sha1) -> - List.equal ~equal:String.equal name1 name2 && not (String.equal sha2 sha1) ) + List.equal String.equal name1 name2 && not (String.equal sha2 sha1) ) l1 ) l2 |> List.map ~f:fst diff --git a/plotkicadsch/src/svgPainter.ml b/plotkicadsch/src/svgPainter.ml index 87ffcd7..8c5fdb0 100644 --- a/plotkicadsch/src/svgPainter.ml +++ b/plotkicadsch/src/svgPainter.ml @@ -175,7 +175,8 @@ exception Base64Exception of string let paint_image (Coord (x, y)) scale b ({c; _} as ctxt) = let s = scale /. 0.3 in let w, h = get_png_dims b in - let outstring = B64.encode (Buffer.contents b) in + match Base64.encode (Buffer.contents b) with + | Ok outstring -> { ctxt with c= image @@ -187,6 +188,8 @@ let paint_image (Coord (x, y)) scale b ({c; _} as ctxt) = ; a_xlink_href @@ "data:image/png;base64," ^ outstring ] [] :: c } + | Error (`Msg err) -> + raise (Base64Exception err) let get_context () = {d= (0, 0); c= []; colors= None}