summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-20 15:23:23 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-20 15:23:23 +0000
commit7c7a7c1205677e7b6e4814c7f314cb53816ab07c (patch)
tree1047952d4d051ce1cbfbcaa7c8058850a503478d /ext
parentb61645517b82a509cac0937d94a906f019006bb6 (diff)
* ext/zlib/zlib.c (rb_deflate_params): update buf_filled count because
deflateParams writes to out buffer. And, revert r18029 because the flush was not needed now and emits garbage. [ruby-dev:40802] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 435a1a6a9f..8c3af3dfe7 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1371,16 +1371,20 @@ rb_deflate_params(VALUE obj, VALUE v_level, VALUE v_strategy)
struct zstream *z = get_zstream(obj);
int level, strategy;
int err;
+ uInt n;
level = ARG_LEVEL(v_level);
strategy = ARG_STRATEGY(v_strategy);
- zstream_run(z, (Bytef*)"", 0, Z_SYNC_FLUSH);
+ n = z->stream.avail_out;
err = deflateParams(&z->stream, level, strategy);
+ z->buf_filled += n - z->stream.avail_out;
while (err == Z_BUF_ERROR) {
rb_warning("deflateParams() returned Z_BUF_ERROR");
zstream_expand_buffer(z);
+ n = z->stream.avail_out;
err = deflateParams(&z->stream, level, strategy);
+ z->buf_filled += n - z->stream.avail_out;
}
if (err != Z_OK) {
raise_zlib_error(err, z->stream.msg);