diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-07 06:30:15 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-07 06:30:15 +0000 |
commit | df84c64be98e362068524a2bbe7db6bcefe2ca7c (patch) | |
tree | 3f00ce8d537dd56ea457500043c7352613604788 /ext/zlib/zlib.c | |
parent | 66d03898953b6245eefdfccd41ac6aca6bfe9495 (diff) | |
download | ruby-df84c64be98e362068524a2bbe7db6bcefe2ca7c.tar.gz |
* pack.c (pack_pack): use NUM2INT() instead of num2i32().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r-- | ext/zlib/zlib.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 7aafbbdc77..b5bd429910 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -361,12 +361,14 @@ struct zstream { #define ZSTREAM_FLAG_IN_STREAM 0x2 #define ZSTREAM_FLAG_FINISHED 0x4 #define ZSTREAM_FLAG_FINALIZE 0x8 -#define ZSTREAM_FLAG_UNUSED 0x10 +#define ZSTREAM_FLAG_CLOSED 0x10 +#define ZSTREAM_FLAG_UNUSED 0x20 #define ZSTREAM_READY(z) ((z)->flags |= ZSTREAM_FLAG_READY) #define ZSTREAM_IS_READY(z) ((z)->flags & ZSTREAM_FLAG_READY) #define ZSTREAM_IS_FINISHED(z) ((z)->flags & ZSTREAM_FLAG_FINISHED) #define ZSTREAM_IS_FINALIZE(z) ((z)->flags & ZSTREAM_FLAG_FINALIZE) +#define ZSTREAM_IS_CLOSED(z) ((z)->flags & ZSTREAM_FLAG_CLOSED) /* I think that more better value should be found, but I gave up finding it. B) */ @@ -1097,7 +1099,7 @@ static VALUE rb_deflate_s_allocate(klass) VALUE klass; { - return zstream_deflate_new(klass); + return zstream_deflate_new(klass); } /* @@ -2150,6 +2152,9 @@ gzfile_writer_end(gz) { int aborted; + if (ZSTREAM_IS_CLOSED(&gz->z)) return; + gz->z.flags |= ZSTREAM_FLAG_CLOSED; + if (!(gz->z.flags & GZFILE_FLAG_HEADER_FINISHED)) { gzfile_make_header(gz); } @@ -2160,7 +2165,7 @@ gzfile_writer_end(gz) if (ZSTREAM_IS_FINALIZE(&gz->z)) { if (NIL_P(gz->io)) return; rb_warn("Zlib::GzipWriter object must be closed explicitly."); - if (OBJ_IS_FREED(gz->io)) { + if (!SPECIAL_CONST_P(gz->io) && OBJ_IS_FREED(gz->io)) { aborted = 1; } else { @@ -2180,6 +2185,9 @@ static void gzfile_reader_end(gz) struct gzfile *gz; { + if (ZSTREAM_IS_CLOSED(&gz->z)) return; + gz->z.flags |= ZSTREAM_FLAG_CLOSED; + if (GZFILE_IS_FINISHED(gz) && !ZSTREAM_IS_FINALIZE(&gz->z) && !(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) { |