diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-14 06:17:24 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-14 06:17:24 +0000 |
commit | 06598ba9444d6d7be790bc24bc14ccae228431fa (patch) | |
tree | 736a745ba623d895de6a013d85fd6cee87d27993 /ext/zlib | |
parent | 4b7ecb15d15864ffba2366e125be437960e83145 (diff) |
* ext/zlib/zlib.c: supress warning on test/zlib. [ruby-dev:28323]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/zlib.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 0cd479c74a..425a30e5fb 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -127,7 +127,9 @@ static void gzfile_calc_crc _((struct gzfile*, VALUE)); static VALUE gzfile_read _((struct gzfile*, int)); static VALUE gzfile_read_all _((struct gzfile*)); static void gzfile_ungetc _((struct gzfile*, int)); +static VALUE gzfile_writer_end_run _((VALUE)); static void gzfile_writer_end _((struct gzfile*)); +static VALUE gzfile_reader_end_run _((VALUE)); static void gzfile_reader_end _((struct gzfile*)); static void gzfile_reader_rewind _((struct gzfile*)); static VALUE gzfile_reader_get_unused _((struct gzfile*)); @@ -2200,36 +2202,55 @@ gzfile_ungetc(gz, c) gz->ungetc++; } -static void -gzfile_writer_end(gz) - struct gzfile *gz; +static VALUE +gzfile_writer_end_run(arg) + VALUE arg; { - if (ZSTREAM_IS_CLOSING(&gz->z)) return; - gz->z.flags |= ZSTREAM_FLAG_CLOSING; + struct gzfile *gz = (struct gzfile *)arg; if (!(gz->z.flags & GZFILE_FLAG_HEADER_FINISHED)) { gzfile_make_header(gz); } - zstream_run(&gz->z, "", 0, Z_FINISH); + zstream_run(&gz->z, (Bytef*)"", 0, Z_FINISH); gzfile_make_footer(gz); gzfile_write_raw(gz); - zstream_end(&gz->z); + + return Qnil; } static void -gzfile_reader_end(gz) +gzfile_writer_end(gz) struct gzfile *gz; { if (ZSTREAM_IS_CLOSING(&gz->z)) return; gz->z.flags |= ZSTREAM_FLAG_CLOSING; + rb_ensure(gzfile_writer_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z); +} + +static VALUE +gzfile_reader_end_run(arg) + VALUE arg; +{ + struct gzfile *gz = (struct gzfile *)arg; + if (GZFILE_IS_FINISHED(gz) && !(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) { gzfile_check_footer(gz); } - zstream_end(&gz->z); + return Qnil; +} + +static void +gzfile_reader_end(gz) + struct gzfile *gz; +{ + if (ZSTREAM_IS_CLOSING(&gz->z)) return; + gz->z.flags |= ZSTREAM_FLAG_CLOSING; + + rb_ensure(gzfile_reader_end_run, (VALUE)gz, zstream_end, (VALUE)&gz->z); } static void |