Revision
3635
Author
lsansonetti@apple.com
Date
2010-02-26 15:44:04 -0800 (Fri, 26 Feb 2010)

Log Message

make sure rb_enc_str_new() cannot be called with binary encoding

Modified Paths

Diff

Modified: MacRuby/branches/icu/string.c (3634 => 3635)


--- MacRuby/branches/icu/string.c	2010-02-26 23:39:57 UTC (rev 3634)
+++ MacRuby/branches/icu/string.c	2010-02-26 23:44:04 UTC (rev 3635)
@@ -3670,6 +3670,10 @@
 	// This function can be called with a NULL encoding. 
 	enc = rb_encodings[ENCODING_UTF8];
     }
+    else {
+	// People must use the bstr_ APIs to deal with binary.
+	assert(enc != rb_encodings[ENCODING_BINARY]);
+    }
     rb_str_t *str = str_alloc(rb_cRubyString);
     str_replace_with_bytes(str, cstr, len, enc);
     return (VALUE)str;