[macruby-changes] [4983] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 6 03:40:50 PST 2010


Revision: 4983
          http://trac.macosforge.org/projects/ruby/changeset/4983
Author:   vincent.isambart at gmail.com
Date:     2010-12-06 03:40:46 -0800 (Mon, 06 Dec 2010)
Log Message:
-----------
fixed a bug in his morning's commit that was making ['a'.encode('UTF-16LE')].join.valid_encoding? crash

Modified Paths:
--------------
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2010-12-06 01:34:59 UTC (rev 4982)
+++ MacRuby/trunk/string.c	2010-12-06 11:40:46 UTC (rev 4983)
@@ -876,7 +876,12 @@
 
     str_concat_bytes(self, str->data.bytes, str->length_in_bytes);
 
-    self->encoding = enc;
+    if (enc != self->encoding) {
+	self->encoding = enc;
+	if (NATIVE_UTF16_ENC(enc)) {
+	    str_set_stored_in_uchars(self, true);
+	}
+    }
 }
 
 static int
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101206/8578b5df/attachment.html>


More information about the macruby-changes mailing list