From 7d82a632f4837764ac79dfb4986d102060bd3080 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?=
Date: Tue, 3 Mar 2015 18:55:22 +0100
Subject: 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.
---
erts/doc/src/zlib.xml | 6 +++---
erts/preloaded/src/zlib.erl | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'erts')
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])
- Normally in the range -15..-9 | 9..15.
+ Normally in the range -15..-8 | 8..15.
@@ -149,7 +149,7 @@ list_to_binary([Compressed|Last])
currently the only supported method is deflated.
The WindowBits 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
deflateInit/2. A negative WindowBits
@@ -288,7 +288,7 @@ list_to_binary([B1,B2])
Initialize decompression session on zlib stream.
The WindowBits 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 inflateInit/1 is used.
If a compressed stream with a larger window size is
given as input, inflate() will throw the data_error
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).
--
cgit v1.2.3