summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 22:10:49 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 22:10:49 +0000
commit81525af4c9a8e512db6bd8b73c6fbe5ea39c865a (patch)
tree1dae2e33418150469470a784a251fd160dc69fa3 /ext/zlib/zlib.c
parent34d1e9bb2504d7fa0b98ad99a32c549cd0d92853 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index d2bcf76eb4..2cce207180 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);