* 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
This commit is contained in:
parent
ae11bc70f1
commit
080605efb1
@ -2,6 +2,10 @@ Fri Sep 7 00:28:25 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||||||
|
|
||||||
* io.c (rb_io_getc): forgot to commit rb_enc_mbclen() fix.
|
* io.c (rb_io_getc): forgot to commit rb_enc_mbclen() fix.
|
||||||
|
|
||||||
|
* ext/stringio/stringio.c (strio_getc): rb_enc_mbclen() fix.
|
||||||
|
|
||||||
|
* ext/stringio/stringio.c (strio_ungetc): ditto.
|
||||||
|
|
||||||
Thu Sep 6 22:57:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Sep 6 22:57:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* lib/fileutils.rb (FileUtils::Entry_::copy): prevent self copy of
|
* lib/fileutils.rb (FileUtils::Entry_::copy): prevent self copy of
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
stringio.o: stringio.c $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \
|
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
|
||||||
|
@ -631,7 +631,7 @@ strio_getc(VALUE self)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
p = RSTRING_PTR(ptr->string)+ptr->pos;
|
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;
|
ptr->pos += len;
|
||||||
return rb_enc_str_new(p, len, rb_enc_get(ptr->string));
|
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 */
|
/* get logical position */
|
||||||
lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos - 1;
|
lpos = 0; p = RSTRING_PTR(ptr->string); pend = p + ptr->pos - 1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
clen = rb_enc_mbclen(p, enc);
|
clen = rb_enc_mbclen(p, pend, enc);
|
||||||
if (p+clen >= pend) break;
|
if (p+clen >= pend) break;
|
||||||
p += clen;
|
p += clen;
|
||||||
lpos++;
|
lpos++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user