Revision
591
Author
lsansonetti@apple.com
Date
2008-09-08 22:33:38 -0700 (Mon, 08 Sep 2008)

Log Message

do not sync if the string's length is not the same as it is supposed to be

Modified Paths

Diff

Modified: MacRuby/trunk/string.c (590 => 591)


--- MacRuby/trunk/string.c	2008-09-09 05:33:06 UTC (rev 590)
+++ MacRuby/trunk/string.c	2008-09-09 05:33:38 UTC (rev 591)
@@ -127,9 +127,11 @@
 		kCFAllocatorNull);
 	rb_gc_malloc_increase(datalen);
 	if (bytestr != NULL) {
-	    CFStringReplaceAll((CFMutableStringRef)str, (CFStringRef)bytestr);
+	    if (CFStringGetLength(bytestr) == datalen) {
+		CFStringReplaceAll((CFMutableStringRef)str, (CFStringRef)bytestr);
+		rb_str_cfdata_set(str, NULL);
+	    }
 	    CFRelease(bytestr);
-	    rb_str_cfdata_set(str, NULL);
 	}
     }
 }