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

fix: correct edge values of window_bits #60

Merged
merged 7 commits into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ Create a gzip compression codec.
Arguments
---------
- `level`: compression level (-1..9)
- `windowbits`: size of history buffer (8..15)
- `windowbits`: size of history buffer (9..15)
"""
function GzipCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
if !(-1 ≤ level ≤ 9)
throw(ArgumentError("compression level must be within -1..9"))
elseif !(8 ≤ windowbits ≤ 15)
throw(ArgumentError("windowbits must be within 8..15"))
elseif !(9 ≤ windowbits ≤ 15)
throw(ArgumentError("windowbits must be within 9..15"))
end
return GzipCompressor(ZStream(), level, windowbits+16)
end
Expand Down Expand Up @@ -67,14 +67,14 @@ Create a zlib compression codec.
Arguments
---------
- `level`: compression level (-1..9)
- `windowbits`: size of history buffer (8..15)
- `windowbits`: size of history buffer (9..15)
"""
function ZlibCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
if !(-1 ≤ level ≤ 9)
throw(ArgumentError("compression level must be within -1..9"))
elseif !(8 ≤ windowbits ≤ 15)
throw(ArgumentError("windowbits must be within 8..15"))
elseif !(9 ≤ windowbits ≤ 15)
throw(ArgumentError("windowbits must be within 9..15"))
end
return ZlibCompressor(ZStream(), level, windowbits)
end
Expand Down Expand Up @@ -109,14 +109,14 @@ Create a deflate compression codec.
Arguments
---------
- `level`: compression level (-1..9)
- `windowbits`: size of history buffer (8..15)
- `windowbits`: size of history buffer (9..15)
"""
function DeflateCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
if !(-1 ≤ level ≤ 9)
throw(ArgumentError("compression level must be within -1..9"))
elseif !(8 ≤ windowbits ≤ 15)
throw(ArgumentError("windowbits must be within 8..15"))
elseif !(9 ≤ windowbits ≤ 15)
throw(ArgumentError("windowbits must be within 9..15"))
end
return DeflateCompressor(ZStream(), level, -Int(windowbits))
end
Expand Down
Loading