Skip to content

Commit

Permalink
Merge pull request #50 from dinosaure/decompress.1.3.0
Browse files Browse the repository at this point in the history
Upgrade the code base to decompress.1.3.0
  • Loading branch information
cfcs authored Apr 2, 2021
2 parents bdaf31e + 88e0ecd commit 4bfb1a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion imagelib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ depends: [
"ocaml" { >= "4.07.0" }
"base-unix"
"dune" { >= "2.3.0" }
"decompress" { >= "1.2.0" }
"decompress" { >= "1.3.0" }
"stdlib-shims"
"alcotest" { with-test }
]
Expand Down
6 changes: 3 additions & 3 deletions src/imagePNG.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ end = struct
let flush src len =
for i = 0 to len - 1 do Buffer.add_char b (unsafe_get src i) done in

match Zl.Higher.uncompress ~allocate:(fun bits -> De.make_window ~bits) ~i ~o ~refill ~flush with
match Zl.Higher.uncompress ~allocate:(fun bits -> De.make_window ~bits) ~refill ~flush i o with
| Ok _metadata -> Buffer.contents b
| Error (`Msg err) -> raise (Corrupted_image ("PNG.Zlib:" ^ err))

let compress_string (inputstr:string) : string =
let open Bigarray.Array1 in
let i = create Bigarray.char Bigarray.c_layout Zl.io_buffer_size in
let o = create Bigarray.char Bigarray.c_layout Zl.io_buffer_size in
let w = De.make_window ~bits:15 in
let w = De.Lz77.make_window ~bits:15 in
let q = De.Queue.create 0x1000 in
let b = Buffer.create 0x1000 in
let p = ref 0 in
Expand All @@ -96,7 +96,7 @@ end = struct
let flush src len =
for i = 0 to len - 1 do Buffer.add_char b (unsafe_get src i) done in

Zl.Higher.compress ~level:2 ~w ~q ~i ~o ~refill ~flush ;
Zl.Higher.compress ~level:2 ~w ~q ~refill ~flush i o ;
Buffer.contents b
end

Expand Down

0 comments on commit 4bfb1a1

Please sign in to comment.