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

Add ZlibError type and move initialize into startproc #93

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Conversation

nhz2
Copy link
Member

@nhz2 nhz2 commented Jan 13, 2025

This PR applies parts of JuliaIO/CodecBzip2.jl#41 and JuliaIO/CodecZstd.jl#74 to this package.

This PR turns the initialize function into a noop. The startproc function now automatically handles the initialization if the stream state is null.

Fixes #89 fixes #59 and partially fixes #48 (a future PR is required to prevent memory leaks)

For example, decompressing a truncated stream:

julia> using CodecZlib

julia> transcode(ZlibDecompressor,UInt8[])

master:

ERROR: zlib error: <no message> (code: -5)

This PR:

ERROR: ZlibError: the compressed stream may be truncated

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 57.37705% with 26 lines in your changes missing coverage. Please review.

Project coverage is 82.97%. Comparing base (98ccccd) to head (84de9cd).

Files with missing lines Patch % Lines
src/compression.jl 47.82% 12 Missing ⚠️
src/decompression.jl 60.00% 12 Missing ⚠️
src/libz.jl 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
- Coverage   91.66%   82.97%   -8.69%     
==========================================
  Files           4        4              
  Lines         156      188      +32     
==========================================
+ Hits          143      156      +13     
- Misses         13       32      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nhz2 nhz2 marked this pull request as ready for review January 13, 2025 05:53
nhz2 added a commit to nhz2/ZipStreams.jl that referenced this pull request Jan 13, 2025
JuliaIO/CodecZlib.jl#93 adds a new error type for decompression errors. This PR updates some tests to be compatible with this change.
@nhz2
Copy link
Member Author

nhz2 commented Jan 28, 2025

@reallyasi9 Could you please take a look at this PR? It breaks one of the tests in ZipStreams.jl, but I think the new error message is clearer.

reallyasi9 added a commit to reallyasi9/ZipStreams.jl that referenced this pull request Jan 28, 2025
Attempts to address downstream breakage introduced in JuliaIO/CodecZlib.jl#93
@reallyasi9
Copy link

Seems like the right thing to do. I just pulled into main.

@nhz2 nhz2 merged commit 5c61dc6 into master Jan 29, 2025
24 checks passed
@nhz2 nhz2 deleted the nz/better-errors branch January 29, 2025 20:59
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.

transcode failing if codec is not initialized Better error messages zlib error: <no message> (code: -5)
2 participants