Modified: MacRuby/trunk/string.c (176 => 177)
--- MacRuby/trunk/string.c 2008-04-27 21:22:59 UTC (rev 176)
+++ MacRuby/trunk/string.c 2008-04-28 05:16:37 UTC (rev 177)
@@ -4982,6 +4982,8 @@
b = exclude ? sptr + 1 : sptr;
e = sptr + strlen(sptr) - 1;
subset = CFCharacterSetCreateMutable(NULL);
+ if (p == NULL)
+ p = strchr(b, '-');
while (p != NULL) {
if (p > b && *(p - 1) != '\\' && *(p + 1) != '\0') {
CFCharacterSetAddCharactersInRange(subset,
@@ -4997,9 +4999,13 @@
CFCharacterSetAddCharactersInString(subset, substr);
CFRelease(substr);
}
-
- b = p + 2;
- p = strchr(b, '-');
+ if (p == b) {
+ p = NULL;
+ }
+ else {
+ b = p + 2;
+ p = strchr(b, '-');
+ }
}
if (b <= e) {
CFStringRef substr;
@@ -5134,8 +5140,8 @@
if (sflag == 0) {
long n;
for (n = result_range->location;
- n < result_range->location + result_range->length;
- n++)
+ n < result_range->location + result_range->length;
+ n++)
CFStringReplace(str, CFRangeMake(n, 1), substr);
}
else {