[前][次][番号順一覧][スレッド一覧]

ruby-changes:3332

From: ko1@a...
Date: 1 Jan 2008 14:17:09 +0900
Subject: [ruby-changes:3332] matz - Ruby:r14825 (trunk): * string.c (rb_str_substr): offset movement bug. a patch from

matz	2008-01-01 14:16:49 +0900 (Tue, 01 Jan 2008)

  New Revision: 14825

  Modified files:
    trunk/ChangeLog
    trunk/string.c

  Log:
    * string.c (rb_str_substr): offset movement bug.  a patch from
      Vincent Isambart <vincent.isambart at gmail.com> in
      [ruby-core:14647].  [ruby-core:14644]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14825&r2=14824&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14825&r2=14824&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14824)
+++ ChangeLog	(revision 14825)
@@ -1,3 +1,9 @@
+Tue Jan  1 14:15:04 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* string.c (rb_str_substr): offset movement bug.  a patch from
+	  Vincent Isambart <vincent.isambart at gmail.com> in
+	  [ruby-core:14647].  [ruby-core:14644]
+
 Tue Jan  1 01:29:04 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* encoding.c (rb_to_encoding): raises for non-nil, non-encoding,
Index: string.c
===================================================================
--- string.c	(revision 14824)
+++ string.c	(revision 14825)
@@ -832,10 +832,10 @@
 	if (len > -beg) len = -beg;
 	if (-beg * rb_enc_mbmaxlen(enc) < RSTRING_LEN(str) / 8) {
 	    beg = -beg;
-	    while (len++ < beg && (e = rb_enc_prev_char(s, e, enc)) != 0);
+	    while (beg-- > len && (e = rb_enc_prev_char(s, e, enc)) != 0);
 	    p = e;
 	    if (!p) return Qnil;
-	    while (beg-- > 0 && (p = rb_enc_prev_char(s, p, enc)) != 0);
+	    while (len-- > 0 && (p = rb_enc_prev_char(s, p, enc)) != 0);
 	    if (!p) return Qnil;
 	    len = e - p;
 	    goto sub;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]