Skip to content

Commit

Permalink
Merge pull request #62 from felixhorger/master
Browse files Browse the repository at this point in the history
New feature: compressor can take streams larger than typemax(UInt32) bytes
  • Loading branch information
mkitti authored Jan 24, 2023
2 parents a777d8f + 9cfdb39 commit 369815a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,14 @@ end
function TranscodingStreams.process(codec::CompressorCodec, input::Memory, output::Memory, error::Error)
zstream = codec.zstream
zstream.next_in = input.ptr
zstream.avail_in = input.size
avail_in = min(input.size, typemax(UInt32))
zstream.avail_in = avail_in
zstream.next_out = output.ptr
zstream.avail_out = output.size
code = deflate!(zstream, input.size > 0 ? Z_NO_FLUSH : Z_FINISH)
Δin = Int(input.size - zstream.avail_in)
Δout = Int(output.size - zstream.avail_out)
avail_out = min(output.size, typemax(UInt32))
zstream.avail_out = avail_out
code = deflate!(zstream, zstream.avail_in > 0 ? Z_NO_FLUSH : Z_FINISH)
Δin = Int(avail_in - zstream.avail_in)
Δout = Int(avail_out - zstream.avail_out)
if code == Z_OK
return Δin, Δout, :ok
elseif code == Z_STREAM_END
Expand Down

2 comments on commit 369815a

@mkitti
Copy link
Member Author

@mkitti mkitti commented on 369815a Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.7.0 already exists and points to a different commit"

Please sign in to comment.