[macruby-changes] [4556] MacRuby/trunk/ext/zlib/zlib.c

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 28 17:44:17 PDT 2010


Revision: 4556
          http://trac.macosforge.org/projects/ruby/changeset/4556
Author:   watson1978 at gmail.com
Date:     2010-09-28 17:44:16 -0700 (Tue, 28 Sep 2010)
Log Message:
-----------
Fixed that throws a buffer error exception in Zlib::Deflate#params. Merged from CRuby 1.9.2.

Modified Paths:
--------------
    MacRuby/trunk/ext/zlib/zlib.c

Modified: MacRuby/trunk/ext/zlib/zlib.c
===================================================================
--- MacRuby/trunk/ext/zlib/zlib.c	2010-09-29 00:11:24 UTC (rev 4555)
+++ MacRuby/trunk/ext/zlib/zlib.c	2010-09-29 00:44:16 UTC (rev 4556)
@@ -1236,15 +1236,20 @@
     struct zstream *z = get_zstream(obj);
     int level, strategy;
     int err;
+    uInt n;
 
     level = ARG_LEVEL(v_level);
     strategy = ARG_STRATEGY(v_strategy);
 
+    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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100928/e58447e2/attachment.html>


More information about the macruby-changes mailing list