Revision: 167 http://trac.macosforge.org/projects/ruby/changeset/167 Author: lsansonetti@apple.com Date: 2008-04-23 18:21:55 -0700 (Wed, 23 Apr 2008) Log Message: ----------- misc fixed Modified Paths: -------------- MacRuby/trunk/encoding.c MacRuby/trunk/string.c Modified: MacRuby/trunk/encoding.c =================================================================== --- MacRuby/trunk/encoding.c 2008-04-23 22:54:02 UTC (rev 166) +++ MacRuby/trunk/encoding.c 2008-04-24 01:21:55 UTC (rev 167) @@ -758,7 +758,11 @@ int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc) { +#if WITH_OBJC + int n = 1; +#else int n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e); +#endif if (MBCLEN_CHARFOUND_P(n) && MBCLEN_CHARFOUND_LEN(n) <= e-p) return MBCLEN_CHARFOUND_LEN(n); else { Modified: MacRuby/trunk/string.c =================================================================== --- MacRuby/trunk/string.c 2008-04-23 22:54:02 UTC (rev 166) +++ MacRuby/trunk/string.c 2008-04-24 01:21:55 UTC (rev 167) @@ -6206,10 +6206,14 @@ #define YIELD_SUBSTR(range) \ do { \ + VALUE mcopy; \ substr = CFStringCreateWithSubstring(NULL, (CFStringRef)str, \ range); \ - CFMakeCollectable((CFTypeRef)substr); \ - rb_yield((VALUE)substr); \ + mcopy = (VALUE)CFStringCreateMutableCopy(NULL, 0, \ + (CFStringRef)substr); \ + CFMakeCollectable((CFTypeRef)mcopy); \ + rb_yield(mcopy); \ + CFRelease(substr); \ } \ while (0)