summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-14 06:17:24 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-14 06:17:24 +0000
commit3770f989922d909ef201aef7d3bba1950982b15e (patch)
tree73ea719974a1e9ea3b91599d67f116de84dba2eb
parentf0ab5bdea254cedc620cd8de6add6e76ac57cabc (diff)
* ext/zlib/zlib.c: supress warning on test/zlib. [ruby-dev:28323]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--ext/zlib/zlib.c37
2 files changed, 33 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 57cc743bf3..ad3aaafcc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Feb 14 15:15:22 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * ext/zlib/zlib.c: supress warning on test/zlib. [ruby-dev:28323]
+
Tue Feb 14 13:47:22 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (rb_w32_utime): drop read-only attribute before
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 958d6943b3..822b2a5bee 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -129,7 +129,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*));
@@ -2274,12 +2276,11 @@ 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);
@@ -2288,22 +2289,42 @@ gzfile_writer_end(gz)
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