[macruby-changes] [239] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri May 30 15:45:27 PDT 2008


Revision: 239
          http://trac.macosforge.org/projects/ruby/changeset/239
Author:   lsansonetti at apple.com
Date:     2008-05-30 15:45:25 -0700 (Fri, 30 May 2008)

Log Message:
-----------
fix PPC (#67)

Modified Paths:
--------------
    MacRuby/trunk/array.c
    MacRuby/trunk/io.c
    MacRuby/trunk/math.c
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/array.c
===================================================================
--- MacRuby/trunk/array.c	2008-05-30 08:15:25 UTC (rev 238)
+++ MacRuby/trunk/array.c	2008-05-30 22:45:25 UTC (rev 239)
@@ -4017,6 +4017,15 @@
 }
 
 static void
+imp_rb_array_replaceObjectsInRangeWithObjectsCount(void *rcv, SEL sel,
+    CFRange range, const void **objects, CFIndex count)
+{
+    PREPARE_RCV(rcv);
+    CFArrayReplaceValues((CFMutableArrayRef)rcv, range, objects, count);
+    RESTORE_RCV(rcv);
+}
+
+static void
 imp_rb_array_addObject(void *rcv, SEL sel, void *obj)
 {
     PREPARE_RCV(rcv);
@@ -4054,6 +4063,8 @@
     INSTALL_METHOD("removeObjectAtIndex:", imp_rb_array_removeObjectAtIndex);
     INSTALL_METHOD("replaceObjectAtIndex:withObject:", 
 	imp_rb_array_replaceObjectAtIndexWithObject);
+    INSTALL_METHOD("replaceObjectsInRange:withObjects:count:",
+	imp_rb_array_replaceObjectsInRangeWithObjectsCount);
     INSTALL_METHOD("addObject:", imp_rb_array_addObject);
 
     /* This is to work around a bug where CF will try to call an non-existing 

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2008-05-30 08:15:25 UTC (rev 238)
+++ MacRuby/trunk/io.c	2008-05-30 22:45:25 UTC (rev 239)
@@ -1808,7 +1808,14 @@
 	    rb_str_cat(str, &ch, 1);
 	}
 	else {
+#if WITH_OBJC
+	    char buf[2];
+	    buf[0] = ch;
+	    buf[1] = '\0';
+	    *strp = str = rb_str_new(buf, 1);
+#else
 	    *strp = str = rb_str_new(&ch, 1);
+#endif
 	}
     }
 
@@ -2581,7 +2588,10 @@
     if (FIXNUM_P(c)) {
 	int cc = FIX2INT(c);
 #if WITH_OBJC
-	c = rb_str_new((char *)&cc, 1);
+	char buf[2];
+	buf[0] = cc;
+	buf[1] = '\0';
+	c = rb_str_new(buf, 1);
 #else
 	rb_encoding *enc = io_read_encoding(fptr);
 	char buf[16];

Modified: MacRuby/trunk/math.c
===================================================================
--- MacRuby/trunk/math.c	2008-05-30 08:15:25 UTC (rev 238)
+++ MacRuby/trunk/math.c	2008-05-30 22:45:25 UTC (rev 239)
@@ -577,6 +577,10 @@
  *  but avoid overflow by Math.gamma(x) for large x.
  */
 
+#if WITH_OBJC && HAVE_LGAMMA_R && BYTE_ORDER == LITTLE_ENDIAN
+#  include "missing/lgamma_r.c"
+#endif
+
 static VALUE
 math_lgamma(VALUE obj, VALUE x)
 {

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2008-05-30 08:15:25 UTC (rev 238)
+++ MacRuby/trunk/string.c	2008-05-30 22:45:25 UTC (rev 239)
@@ -2185,10 +2185,13 @@
     if (FIXNUM_P(str2)) {
 #if WITH_OBJC
         int c = FIX2INT(str2);
+	char buf[2];
 
 	rb_str_modify(str1);
-        CFStringAppendCharacters((CFMutableStringRef)str1, (const UniChar *)&c, 
-	    1);
+	buf[0] = (char)c;
+	buf[1] = '\0';
+	CFStringAppendCString((CFMutableStringRef)str1, buf, 
+			      kCFStringEncodingUTF8);
 	rb_gc_malloc_increase(sizeof(UniChar));
 #else
 	rb_encoding *enc = STR_ENC_GET(str1);
@@ -4518,8 +4521,10 @@
 str_cat_char(VALUE str, int c, rb_encoding *enc)
 {
 #if WITH_OBJC
-    CFStringAppendCharacters((CFMutableStringRef)str, 
-	(const UniChar *)&c, 1); 	 
+    char buf[2];
+    buf[0] = (char)c;
+    buf[1] = '\0';
+    CFStringAppendCString((CFMutableStringRef)str, buf, kCFStringEncodingUTF8);
 #else
     char s[16];
     int n = rb_enc_codelen(c, enc);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080530/2fe6ad70/attachment.htm 


More information about the macruby-changes mailing list