1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
mame 2010-04-20 15:23:23 +00:00
parent b61645517b
commit 7c7a7c1205
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Wed Apr 21 00:16:44 2010 Yusuke Endoh <mame@tsg.ne.jp>
* 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]
Wed Apr 21 00:01:05 2010 Yusuke Endoh <mame@tsg.ne.jp>
* vm_method.c (rb_add_method_def): decrement alias count of

View file

@ -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);