diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-21 22:10:49 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-21 22:10:49 +0000 |
| commit | 72cb863cf1350af4bac5a9b5950280dca9745f43 (patch) | |
| tree | 1dae2e33418150469470a784a251fd160dc69fa3 /ext/zlib | |
| parent | f6a5d1e62259c8c2fd3b3d9d6e8a212739cf412a (diff) | |
| download | ruby-72cb863cf1350af4bac5a9b5950280dca9745f43.tar.gz ruby-72cb863cf1350af4bac5a9b5950280dca9745f43.tar.xz ruby-72cb863cf1350af4bac5a9b5950280dca9745f43.zip | |
* ext/zlib/zlib.c (rb_gzreader_ungetc): should be able to unget
Fixnum.
* ext/stringio/stringio.c (strio_ungetc): should convert unget
string.
* ext/stringio/stringio.c (strio_ungetbyte): new method.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib')
| -rw-r--r-- | ext/zlib/zlib.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index d2bcf76eb..2cce20718 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -3075,8 +3075,11 @@ rb_gzreader_each_byte(VALUE obj) static VALUE rb_gzreader_ungetc(VALUE obj, VALUE s) { - struct gzfile *gz = get_gzfile(obj); + struct gzfile *gz; + if (FIXNUM_P(s)) + return rb_gzreader_ungetbyte(obj, s); + gz = get_gzfile(obj); StringValue(s); if (gz->enc2 && gz->enc2 != rb_ascii8bit_encoding()) { s = rb_str_conv_enc(s, rb_enc_get(s), gz->enc2); |
