Skip to content

Commit 3f91138

Browse files
f3foranhz2
andauthored
fix: correct edge values of window_bits (#60)
* fix: correct edge values of window_bits see https://docs.python.org/3/library/zlib.html * Update src/compression.jl * Update src/compression.jl * Update src/decompression.jl * Update src/decompression.jl * Make docstring match error. --------- Co-authored-by: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com>
1 parent 3192d0f commit 3f91138

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/compression.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Create a gzip compression codec.
2525
Arguments
2626
---------
2727
- `level`: compression level (-1..9)
28-
- `windowbits`: size of history buffer (8..15)
28+
- `windowbits`: size of history buffer (9..15)
2929
"""
3030
function GzipCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
3131
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
3232
if !(-1 level 9)
3333
throw(ArgumentError("compression level must be within -1..9"))
34-
elseif !(8 windowbits 15)
35-
throw(ArgumentError("windowbits must be within 8..15"))
34+
elseif !(9 windowbits 15)
35+
throw(ArgumentError("windowbits must be within 9..15"))
3636
end
3737
return GzipCompressor(ZStream(), level, windowbits+16)
3838
end
@@ -67,14 +67,14 @@ Create a zlib compression codec.
6767
Arguments
6868
---------
6969
- `level`: compression level (-1..9)
70-
- `windowbits`: size of history buffer (8..15)
70+
- `windowbits`: size of history buffer (9..15)
7171
"""
7272
function ZlibCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
7373
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
7474
if !(-1 level 9)
7575
throw(ArgumentError("compression level must be within -1..9"))
76-
elseif !(8 windowbits 15)
77-
throw(ArgumentError("windowbits must be within 8..15"))
76+
elseif !(9 windowbits 15)
77+
throw(ArgumentError("windowbits must be within 9..15"))
7878
end
7979
return ZlibCompressor(ZStream(), level, windowbits)
8080
end
@@ -109,14 +109,14 @@ Create a deflate compression codec.
109109
Arguments
110110
---------
111111
- `level`: compression level (-1..9)
112-
- `windowbits`: size of history buffer (8..15)
112+
- `windowbits`: size of history buffer (9..15)
113113
"""
114114
function DeflateCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
115115
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
116116
if !(-1 level 9)
117117
throw(ArgumentError("compression level must be within -1..9"))
118-
elseif !(8 windowbits 15)
119-
throw(ArgumentError("windowbits must be within 8..15"))
118+
elseif !(9 windowbits 15)
119+
throw(ArgumentError("windowbits must be within 9..15"))
120120
end
121121
return DeflateCompressor(ZStream(), level, -Int(windowbits))
122122
end

0 commit comments

Comments
 (0)