ruby-changes:1861
From: ko1@a...
Date: 7 Sep 2007 00:43:08 +0900
Subject: [ruby-changes:1861] matz - Ruby:r13352 (trunk): * ext/stringio/stringio.c (strio_getc): rb_enc_mbclen() fix.
matz 2007-09-07 00:42:53 +0900 (Fri, 07 Sep 2007)
New Revision: 13352
Modified files:
trunk/ChangeLog
trunk/ext/stringio/depend
trunk/ext/stringio/stringio.c
Log:
* ext/stringio/stringio.c (strio_getc): rb_enc_mbclen() fix.
* ext/stringio/stringio.c (strio_ungetc): ditto.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13352&r2=13351
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/stringio/stringio.c?r1=13352&r2=13351
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/stringio/depend?r1=13352&r2=13351
Index: ChangeLog
===================================================================
--- ChangeLog (revision 13351)
+++ ChangeLog (revision 13352)
@@ -2,6 +2,10 @@
* 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@r...>
* lib/fileutils.rb (FileUtils::Entry_::copy): prevent self copy of
Index: ext/stringio/depend
===================================================================
--- ext/stringio/depend (revision 13351)
+++ ext/stringio/depend (revision 13352)
@@ -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
Index: ext/stringio/stringio.c
===================================================================
--- ext/stringio/stringio.c (revision 13351)
+++ ext/stringio/stringio.c (revision 13352)
@@ -631,7 +631,7 @@
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 @@
/* 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++;
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml