[3662] MacRuby/branches/icu/compiler.cpp
Revision: 3662 http://trac.macosforge.org/projects/ruby/changeset/3662 Author: lsansonetti@apple.com Date: 2010-03-01 22:50:51 -0800 (Mon, 01 Mar 2010) Log Message: ----------- fixed unicode strings compilation Modified Paths: -------------- MacRuby/branches/icu/compiler.cpp Modified: MacRuby/branches/icu/compiler.cpp =================================================================== --- MacRuby/branches/icu/compiler.cpp 2010-02-28 14:53:32 UTC (rev 3661) +++ MacRuby/branches/icu/compiler.cpp 2010-03-02 06:50:51 UTC (rev 3662) @@ -2790,8 +2790,7 @@ // // 10.times { s = 'foo'; s << 'bar' } // - const size_t str_len = RSTRING_LEN(val); - if (str_len == 0) { + if (rb_str_chars_len(val) == 0) { if (newString3Func == NULL) { newString3Func = cast<Function>( module->getOrInsertFunction( @@ -2805,6 +2804,7 @@ bool need_free = false; rb_str_get_uchars(val, &chars, &chars_len, &need_free); + assert(chars_len > 0); GlobalVariable *str_gvar = compile_const_global_ustring(chars, chars_len); @@ -2830,7 +2830,7 @@ std::vector<Value *> params; params.push_back(load); - params.push_back(ConstantInt::get(Int32Ty, str_len)); + params.push_back(ConstantInt::get(Int32Ty, chars_len)); return CallInst::Create(newString2Func, params.begin(), params.end(), "", bb);
participants (1)
-
source_changes@macosforge.org