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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.
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.

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