Revision
756
Author
lsansonetti@apple.com
Date
2008-11-24 19:13:55 -0800 (Mon, 24 Nov 2008)

Log Message

fix for #168

Modified Paths

Diff

Modified: MacRuby/trunk/bs.c (755 => 756)


--- MacRuby/trunk/bs.c	2008-11-25 00:06:41 UTC (rev 755)
+++ MacRuby/trunk/bs.c	2008-11-25 03:13:55 UTC (rev 756)
@@ -570,11 +570,11 @@
           enum_name = get_attribute(reader, "name");
           CHECK_ATTRIBUTE(enum_name, "name");
 
-          enum_value = get_attribute(reader, "value");
 #if __LP64__
-          if (enum_value == NULL)
-            enum_value = get_attribute(reader, "value64");
+	  enum_value = get_attribute(reader, "value64");
+	  if (enum_value == NULL)
 #endif
+	    enum_value = get_attribute(reader, "value");
 
 #if BYTE_ORDER == BIG_ENDIAN
 # define BYTE_ORDER_VALUE_ATTR_NAME "be_value"

Modified: MacRuby/trunk/objc.m (755 => 756)


--- MacRuby/trunk/objc.m	2008-11-25 00:06:41 UTC (rev 755)
+++ MacRuby/trunk/objc.m	2008-11-25 03:13:55 UTC (rev 756)
@@ -2780,6 +2780,26 @@
     if (!ok) {
 	rb_raise(rb_eRuntimeError, "%s", error);
     }
+#if defined(__LP64__)
+# if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
+    /* XXX work around for <rdar://problem/6399046> NSNotFound 64-bit value is incorrect
+     * XXX we should introduce the possibility to write prelude scripts per
+     * frameworks where this kind of changes could be located.
+     */
+    static bool nsnotfound_fixed = false;
+    if (!nsnotfound_fixed) {
+	ID nsnotfound = rb_intern("NSNotFound");
+	VALUE val = 
+	    (VALUE)CFDictionaryGetValue(rb_cObject_dict, (void *)nsnotfound);
+	if ((VALUE)val == INT2FIX(-1)) {
+	    CFDictionarySetValue(rb_cObject_dict, 
+		    (const void *)nsnotfound,
+		    (const void *)ULL2NUM(NSNotFound));
+	    nsnotfound_fixed = true;
+	}
+    }
+# endif
+#endif
 }
 
 static VALUE