[macruby-changes] [179] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Apr 28 22:37:50 PDT 2008
Revision: 179
http://trac.macosforge.org/projects/ruby/changeset/179
Author: lsansonetti at apple.com
Date: 2008-04-28 22:37:49 -0700 (Mon, 28 Apr 2008)
Log Message:
-----------
fixing more regressions
Modified Paths:
--------------
MacRuby/trunk/re.c
MacRuby/trunk/sample/test.rb
MacRuby/trunk/string.c
Modified: MacRuby/trunk/re.c
===================================================================
--- MacRuby/trunk/re.c 2008-04-29 01:53:23 UTC (rev 178)
+++ MacRuby/trunk/re.c 2008-04-29 05:37:49 UTC (rev 179)
@@ -2656,6 +2656,8 @@
int ascii_only = rb_enc_str_asciionly_p(str);
s = RSTRING_CPTR(str);
+ if (s == NULL)
+ return str;
send = s + RSTRING_CLEN(str);
while (s < send) {
c = rb_enc_ascget(s, send, &clen, enc);
Modified: MacRuby/trunk/sample/test.rb
===================================================================
--- MacRuby/trunk/sample/test.rb 2008-04-29 01:53:23 UTC (rev 178)
+++ MacRuby/trunk/sample/test.rb 2008-04-29 05:37:49 UTC (rev 179)
@@ -1872,7 +1872,7 @@
def valid_syntax?(code, fname)
p fname
- code.force_encoding("ascii-8bit")
+ #code.force_encoding("ascii-8bit")
code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) {
"#$&#{"\n" if $1 && !$2}BEGIN{return true}\n"
}
Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c 2008-04-29 01:53:23 UTC (rev 178)
+++ MacRuby/trunk/string.c 2008-04-29 05:37:49 UTC (rev 179)
@@ -1794,7 +1794,7 @@
p[len] = '\0';
ptr = p;
}
- CFStringAppendCString((CFMutableStringRef)str, ptr, kCFStringEncodingUTF8);
+ CFStringAppendCString((CFMutableStringRef)str, ptr, kCFStringEncodingASCII);
/* FIXME ptr might be a bytestring */
#else
long capa, total;
@@ -2401,6 +2401,8 @@
str1 = str2;
str2 = tmp;
}
+ if (RSTRING_CLEN(str1) == 0)
+ return RSTRING_CLEN(str2) == 0 ? Qtrue : Qfalse;
if (CFEqual((CFTypeRef)str1, (CFTypeRef)str2))
return Qtrue;
#else
@@ -4345,11 +4347,8 @@
{
rb_encoding *enc = STR_ENC_GET(str);
const char *p, *pend;
- VALUE result = rb_str_buf_new2("");
+ VALUE result;
- if (!rb_enc_asciicompat(enc)) enc = rb_usascii_encoding();
- rb_enc_associate(result, enc);
- str_cat_char(result, '"', enc);
#if WITH_OBJC
if (rb_objc_str_is_bytestring(str)) {
p = (const char *)RSTRING_PTR(str);
@@ -4359,9 +4358,15 @@
p = RSTRING_CPTR(str);
pend = p + RSTRING_CLEN(str);
}
+ if (p == NULL)
+ return rb_str_new2("\"\"");
#else
p = RSTRING_PTR(str); pend = RSTRING_END(str);
#endif
+ result = rb_str_buf_new2("");
+ if (!rb_enc_asciicompat(enc)) enc = rb_usascii_encoding();
+ rb_enc_associate(result, enc);
+ str_cat_char(result, '"', enc);
while (p < pend) {
int c;
int n;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080428/a0e99700/attachment.html
More information about the macruby-changes
mailing list