diff options
| author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-15 22:20:21 +0000 |
|---|---|---|
| committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-15 22:20:21 +0000 |
| commit | be546199dc8f04eee5eac40ddc01b5c6cbd36f51 (patch) | |
| tree | 2c8c166111e360a77308ebc69b34654b2306d55d /ext | |
| parent | 1a3abb627a47615fc6526dfbcc52f3f7fde5194d (diff) | |
* 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@26326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/zlib/zlib.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 1f6245909d..2e72470b20 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"); |
