diff options
author | Loïc Hoguin <[email protected]> | 2015-03-03 18:55:22 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-03-03 23:16:44 +0100 |
commit | 7d82a632f4837764ac79dfb4986d102060bd3080 (patch) | |
tree | 050bd036fba730bdf99a0e9e96fb227ae704c283 /erts | |
parent | 5f08be20308db9680c9d7e1f01242cedd84a2b4e (diff) | |
download | otp-7d82a632f4837764ac79dfb4986d102060bd3080.tar.gz otp-7d82a632f4837764ac79dfb4986d102060bd3080.tar.bz2 otp-7d82a632f4837764ac79dfb4986d102060bd3080.zip |
Update zlib:zwindowbits/0 type to accept 8 and -8
Commit 7e8f5a776cbfa376e03369d058a90c8dd9f217fc (importing R11B-3)
updated zlib, which had changed what values it accepts for window
bits from 9-15 to 8-15.
From deflate.c:
- windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
- strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+ windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+ strategy < 0 || strategy > Z_FIXED) {
return Z_STREAM_ERROR;
}
+ if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
In inflate.c 8 was already an accepted value.
This commit updates OTP to also accept the values 8 and -8.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/doc/src/zlib.xml | 6 | ||||
-rw-r--r-- | erts/preloaded/src/zlib.erl | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/erts/doc/src/zlib.xml b/erts/doc/src/zlib.xml index da8ccdecdf..b46baad7b5 100644 --- a/erts/doc/src/zlib.xml +++ b/erts/doc/src/zlib.xml @@ -99,7 +99,7 @@ list_to_binary([Compressed|Last])</pre> <datatype> <name name="zwindowbits"/> <desc> - <p>Normally in the range <c>-15..-9 | 9..15</c>.</p> + <p>Normally in the range <c>-15..-8 | 8..15</c>.</p> </desc> </datatype> </datatypes> @@ -149,7 +149,7 @@ list_to_binary([Compressed|Last])</pre> currently the only supported method is <c>deflated</c>.</p> <p>The <c><anno>WindowBits</anno></c> parameter is the base two logarithm of the window size (the size of the history buffer). It - should be in the range 9 through 15. Larger values + should be in the range 8 through 15. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if <c>deflateInit/2</c>. A negative <c><anno>WindowBits</anno></c> @@ -288,7 +288,7 @@ list_to_binary([B1,B2])</pre> <p>Initialize decompression session on zlib stream.</p> <p>The <c><anno>WindowBits</anno></c> parameter is the base two logarithm of the maximum window size (the size of the history buffer). - It should be in the range 9 through 15. + It should be in the range 8 through 15. The default value is 15 if <c>inflateInit/1</c> is used. If a compressed stream with a larger window size is given as input, inflate() will throw the <c>data_error</c> diff --git a/erts/preloaded/src/zlib.erl b/erts/preloaded/src/zlib.erl index df7b2e6198..988d837e3a 100644 --- a/erts/preloaded/src/zlib.erl +++ b/erts/preloaded/src/zlib.erl @@ -124,7 +124,7 @@ -type zlevel() :: 'none' | 'default' | 'best_compression' | 'best_speed' | 0..9. -type zmethod() :: 'deflated'. --type zwindowbits() :: -15..-9 | 9..47. +-type zwindowbits() :: -15..-8 | 8..47. -type zmemlevel() :: 1..9. -type zstrategy() :: 'default' | 'filtered' | 'huffman_only' | 'rle'. @@ -496,8 +496,8 @@ arg_method(_) -> erlang:error(badarg). -spec arg_bitsz(zwindowbits()) -> zwindowbits(). arg_bitsz(Bits) when is_integer(Bits) andalso - ((8 < Bits andalso Bits < 48) orelse - (-15 =< Bits andalso Bits < -8)) -> + ((8 =< Bits andalso Bits < 48) orelse + (-15 =< Bits andalso Bits =< -8)) -> Bits; arg_bitsz(_) -> erlang:error(badarg). |