Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't treat Z_BUF_ERROR as a fatal error #6

Closed
wants to merge 1 commit into from

Conversation

Laakeri
Copy link

@Laakeri Laakeri commented Jul 27, 2017

Previously Z_BUF_ERROR error code was treated as fatal and it raised an exception in OCaml. However the error is not fatal according to zlib documentation [1].

Handling this is necessary for streaming compression where you never finish the stream with Z_FINISH.

Seems like ignoring the error is sufficient as returned values for used_in and used_out will be 0 in case it happens.

Documentation says:
"this is simply an indication that deflate() could not consume more input or produce more output. deflate() can be called again with more output space or more available input, which it will be in this code."

[1] https://zlib.net/zlib_how.html

Previously Z_BUF_ERROR error code was treated as fatal and it raised an exception in OCaml. However the error is not fatal according to zlib documentation [1].

Handling this is necessary for streaming compression where you never finish the stream with Z_FINISH.

Seems like ignoring the error is sufficient as returned values for used_in and used_out will be 0 in case it happens.

Documentation says:
"this is simply an indication that deflate() could not consume more input or produce more output. deflate() can be called again with more output space or more available input, which it will be in this code."

[1] https://zlib.net/zlib_how.html
Laakeri pushed a commit to Laakeri/camlzip that referenced this pull request Jul 27, 2017
Add {deflate,inflate}_bigstring similar to {delfate,inflate} that
read from / write to bigstrings instead of bytes.

bigstring is defined as:
  type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
See https://github.com/ocaml/ocaml/blob/trunk/bytecomp/lambda.ml#L138

The Z_BUF_ERROR fix (GPR xavierleroy#6) is included in the new C functions camlzip_deflate_bigstring and camlzip_inflate_bigstring.
@xavierleroy
Copy link
Owner

Merged by commit [master 20a0ae2]

xavierleroy pushed a commit that referenced this pull request Oct 4, 2024
Add {deflate,inflate}_bigstring similar to {delfate,inflate} that
read from / write to bigstrings instead of bytes.

bigstring is defined as:
  type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
See https://github.com/ocaml/ocaml/blob/trunk/bytecomp/lambda.ml#L138

The Z_BUF_ERROR fix (GPR #6) is included in the new C functions camlzip_deflate_bigstring and camlzip_inflate_bigstring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants