diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-06 15:42:53 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-06 15:42:53 +0000 |
commit | 080605efb199588ef7f28733853256f5e362ae72 (patch) | |
tree | 271162cc2be950d67cf27f2d1a94b472a6f19638 /ext/stringio | |
parent | ae11bc70f1f165b4bd6a4045aa3f5810c7928209 (diff) | |
download | ruby-080605efb199588ef7f28733853256f5e362ae72.tar.gz |
* ext/stringio/stringio.c (strio_getc): rb_enc_mbclen() fix.
* ext/stringio/stringio.c (strio_ungetc): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r-- | ext/stringio/depend | 3 | ||||
-rw-r--r-- | ext/stringio/stringio.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/ext/stringio/depend b/ext/stringio/depend index a052c73de7..338ebde529 100644 --- a/ext/stringio/depend +++ b/ext/stringio/depend @@ -1,2 +1,3 @@ stringio.o: stringio.c $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \ - $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/io.h + $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/io.h \ + $(hdrdir)/ruby/encoding.h diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 08a6341b70..c4960f68a4 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -631,7 +631,7 @@ strio_getc(VALUE self) return Qnil; } p = RSTRING_PTR(ptr->string)+ptr->pos; - len = rb_enc_mbclen(p, enc); + len = rb_enc_mbclen(p, RSTRING_END(ptr->string), enc); ptr->pos += len; return rb_enc_str_new(p, len, rb_enc_get(ptr->string)); } @@ -705,7 +705,7 @@ strio_ungetc(VALUE self, VALUE c) /* get logical position */ lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos - 1; for (;;) { - clen = rb_enc_mbclen(p, enc); + clen = rb_enc_mbclen(p, pend, enc); if (p+clen >= pend) break; p += clen; lpos++; |