summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-20 07:21:52 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-20 07:21:52 +0000
commit8ed4d5a465e0445057e6d6e5ee0e09e6448356f8 (patch)
tree7a62e9cab080a5522e8b9633ac50c1c489fec9df /ext
parentb1ca15e4ee49fb8a583add67757a44bd39769fc3 (diff)
merge revision(s) 26326:
* ext/zlib/zlib.c: backport r18029 and r21861 from trunk. * r18029 ext/zlib/zlib.c (rb_deflate_params): flush before deflateParams. [ruby-core:17675] (by mame) * r21861 ext/zlib/zlib.c (zstream_run): desperately guard the variable. [ruby-core:20576] (by usa) * test/zlib/test_zlib.rb: backport deflate tests from trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@27917 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 306e267856..c8207886f3 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -302,7 +302,7 @@ do_checksum(argc, argv, func)
/*
* call-seq: Zlib.adler32(string, adler)
*
- * Calculates Alder-32 checksum for +string+, and returns updated value of
+ * Calculates Adler-32 checksum for +string+, and returns updated value of
* +adler+. If +string+ is omitted, it returns the Adler-32 initial value. If
* +adler+ is omitted, it assumes that the initial value is given to +adler+.
*
@@ -733,6 +733,9 @@ zstream_run(z, src, len, flush)
}
for (;;) {
+ /* VC allocates err and guard to same address. accessing err and guard
+ in same scope prevents it. */
+ RB_GC_GUARD(guard);
n = z->stream.avail_out;
err = z->func->run(&z->stream, flush);
z->buf_filled += n - z->stream.avail_out;
@@ -1374,6 +1377,7 @@ rb_deflate_params(obj, v_level, v_strategy)
level = ARG_LEVEL(v_level);
strategy = ARG_STRATEGY(v_strategy);
+ zstream_run(z, (Bytef*)"", 0, Z_SYNC_FLUSH);
err = deflateParams(&z->stream, level, strategy);
while (err == Z_BUF_ERROR) {
rb_warning("deflateParams() returned Z_BUF_ERROR");