ruby-changes:15521
From: mame <ko1@a...>
Date: Wed, 21 Apr 2010 00:23:47 +0900 (JST)
Subject: [ruby-changes:15521] Ruby:r27423 (trunk): * ext/zlib/zlib.c (rb_deflate_params): update buf_filled count because
mame 2010-04-21 00:23:23 +0900 (Wed, 21 Apr 2010) New Revision: 27423 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27423 Log: * 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] Modified files: trunk/ChangeLog trunk/ext/zlib/zlib.c Index: ChangeLog =================================================================== --- ChangeLog (revision 27422) +++ ChangeLog (revision 27423) @@ -1,3 +1,9 @@ +Wed Apr 21 00:16:44 2010 Yusuke Endoh <mame@t...> + + * 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@t...> * vm_method.c (rb_add_method_def): decrement alias count of Index: ext/zlib/zlib.c =================================================================== --- ext/zlib/zlib.c (revision 27422) +++ ext/zlib/zlib.c (revision 27423) @@ -1371,16 +1371,20 @@ 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/