[macruby-changes] [3619] MacRuby/branches/icu/string.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 25 02:34:04 PST 2010


Revision: 3619
          http://trac.macosforge.org/projects/ruby/changeset/3619
Author:   vincent.isambart at gmail.com
Date:     2010-02-25 02:34:01 -0800 (Thu, 25 Feb 2010)
Log Message:
-----------
fixed a bug in str_index_for_string

Modified Paths:
--------------
    MacRuby/branches/icu/string.c

Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c	2010-02-25 09:06:00 UTC (rev 3618)
+++ MacRuby/branches/icu/string.c	2010-02-25 10:34:01 UTC (rev 3619)
@@ -877,6 +877,7 @@
 	}
 	else {
 	    long length = BYTES_TO_UCHARS(self->length_in_bytes);
+	    long offset_in_uchars = BYTES_TO_UCHARS(offset_in_bytes);
 	    long index = 0, i = 0;
 	    for (;;) {
 		if (U16_IS_LEAD(self->data.uchars[i]) && (i+1 < length)
@@ -886,11 +887,11 @@
 		else {
 		    ++i;
 		}
-		if (offset_in_bytes < i) {
+		if (offset_in_uchars < i) {
 		    return index;
 		}
 		++index;
-		if (offset_in_bytes == i) {
+		if (offset_in_uchars == i) {
 		    return index;
 		}
 	    }
@@ -1576,7 +1577,7 @@
 	    // fall through
 	case T_STRING:
 	    pos = str_index_for_string(RSTR(self), str_need_string(sub),
-		    pos, false);
+		    pos, true);
 	    break;
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100225/b4ffc632/attachment.html>


More information about the macruby-changes mailing list