File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -784,9 +784,8 @@ let last_modified = (* server startup time *)
784784 (tm.tm_year + 1900 )
785785 tm.tm_hour tm.tm_min tm.tm_sec
786786
787- (* Taken from the source of "decompress.1.5.3", from bin/decompress.ml *)
787+ (* Adapted from the source of "decompress.1.5.3", from bin/decompress.ml *)
788788let compress ?(level = 4 ) data =
789-
790789 let bigstring_output o off len buf =
791790 let res = Bytes. create len in
792791 for i = 0 to len - 1 do
@@ -795,11 +794,13 @@ let compress ?(level = 4) data =
795794 ; Buffer. add_bytes buf res in
796795 let src_len = String. length data in
797796 let dst_bound = De.Def.Ns. compress_bound src_len in
798- let o = De. bigstring_create De. io_buffer_size in
797+ let o = De. bigstring_create dst_bound in
798+ (* buffer.mli: nothing bad will happen if the buffer grows beyond that limit: *)
799799 let buf = Buffer. create dst_bound in
800- let q = De.Queue. create De. io_buffer_size in
800+ (* de.mli: we recommend a queue as large as output buffer: *)
801+ let q = De.Queue. create dst_bound in
802+ (* LZ77 with a 32.kB sliding-window compression: *)
801803 let w = De.Lz77. make_window ~bits: 15 in
802-
803804 let open Zl in
804805 let encoder = Def. encoder (`String data) `Manual ~q ~w ~level in
805806 let rec go encoder =
You can’t perform that action at this time.
0 commit comments