Revision: 170 http://trac.macosforge.org/projects/ruby/changeset/170 Author: lsansonetti@apple.com Date: 2008-04-25 14:50:50 -0700 (Fri, 25 Apr 2008) Log Message: ----------- fixing some regressions Modified Paths: -------------- MacRuby/trunk/file.c MacRuby/trunk/string.c Modified: MacRuby/trunk/file.c =================================================================== --- MacRuby/trunk/file.c 2008-04-24 02:54:51 UTC (rev 169) +++ MacRuby/trunk/file.c 2008-04-25 21:50:50 UTC (rev 170) @@ -2563,6 +2563,7 @@ FilePathValue(fname); s = StringValuePtr(fname); + BUFINIT(); tainted = OBJ_TAINTED(fname); @@ -2650,8 +2651,11 @@ #endif else if (!is_absolute_path(s)) { if (!NIL_P(dname)) { + long n; file_expand_path(dname, Qnil, result); BUFINIT(); + n = RSTRING_CLEN(result); + BUFCHECK(n + 2 > buflen); } else { char *dir = my_getcwd(); @@ -2751,6 +2755,7 @@ if (tainted) OBJ_TAINT(result); rb_str_set_len(result, p - buf); RSTRING_SYNC(result); + return result; } Modified: MacRuby/trunk/string.c =================================================================== --- MacRuby/trunk/string.c 2008-04-24 02:54:51 UTC (rev 169) +++ MacRuby/trunk/string.c 2008-04-25 21:50:50 UTC (rev 170) @@ -1547,7 +1547,7 @@ { #if WITH_OBJC long n = CFStringGetLength((CFStringRef)str); - CFStringRef substr; + CFStringRef substr, msubstr; if (beg < 0) beg += n; if (beg > n || beg < 0) @@ -1562,8 +1562,10 @@ substr = CFStringCreateWithSubstring(NULL, (CFStringRef)str, CFRangeMake(beg, len)); } - CFMakeCollectable((CFTypeRef)substr); - return (VALUE)substr; + msubstr = (CFStringRef)CFStringCreateMutableCopy(NULL, 0, substr); + CFRelease(substr); + CFMakeCollectable(msubstr); + return (VALUE)msubstr; #else VALUE str2 = rb_str_new5(str, RSTRING_PTR(str)+beg, len); @@ -1732,13 +1734,7 @@ if (slen != len) { struct rb_objc_str_struct *s; - if (len > slen) { - CFStringPad((CFMutableStringRef)str, CFSTR(" "), len, 0); - } - else { - CFStringDelete((CFMutableStringRef)str, - CFRangeMake(len, slen - len)); - } + CFStringPad((CFMutableStringRef)str, CFSTR(" "), len, 0); s = rb_objc_str_get_struct(str); if (s != NULL && s->cfdata != NULL) @@ -3865,6 +3861,8 @@ rb_backref_set(match); #if WITH_OBJC if (bang) { + RSTRING_SYNC(str); + RSTRING_SYNC(dest); CFStringReplaceAll((CFMutableStringRef)str, (CFStringRef)dest); } else { @@ -5248,6 +5246,8 @@ if (RSTRING_CLEN(str) == 0) return Qnil; + rb_str_modify(str); + _ctx.orepl = repl; _ctx.src = RSTRING_CPTR(src); _ctx.repl = RSTRING_CPTR(repl);
participants (1)
-
source_changes@macosforge.org