[macruby-changes] [5185] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jan 20 18:20:08 PST 2011


Revision: 5185
          http://trac.macosforge.org/projects/ruby/changeset/5185
Author:   lsansonetti at apple.com
Date:     2011-01-20 18:20:08 -0800 (Thu, 20 Jan 2011)
Log Message:
-----------
fix a bug in -[NSArray ==:] and -[NSDictionary ==:] where a crash would occur if passed a Ruby immediate type

Modified Paths:
--------------
    MacRuby/trunk/NSArray.m
    MacRuby/trunk/NSDictionary.m

Modified: MacRuby/trunk/NSArray.m
===================================================================
--- MacRuby/trunk/NSArray.m	2011-01-20 11:38:55 UTC (rev 5184)
+++ MacRuby/trunk/NSArray.m	2011-01-21 02:20:08 UTC (rev 5185)
@@ -90,12 +90,12 @@
 }
 
 static VALUE
-nsary_equal(id rcv, SEL sel, id other)
+nsary_equal(id rcv, SEL sel, VALUE other)
 {
-    if (![other isKindOfClass:(id)rb_cNSArray]) {
+    if (TYPE(other) != T_ARRAY) {
 	return Qfalse;
     }
-    return [rcv isEqualToArray:other] ? Qtrue : Qfalse;
+    return [rcv isEqualToArray:(id)other] ? Qtrue : Qfalse;
 }
 
 static VALUE

Modified: MacRuby/trunk/NSDictionary.m
===================================================================
--- MacRuby/trunk/NSDictionary.m	2011-01-20 11:38:55 UTC (rev 5184)
+++ MacRuby/trunk/NSDictionary.m	2011-01-21 02:20:08 UTC (rev 5185)
@@ -116,12 +116,12 @@
 }
 
 static VALUE
-nshash_equal(id rcv, SEL sel, id other)
+nshash_equal(id rcv, SEL sel, VALUE other)
 {
-    if (![other isKindOfClass:(id)rb_cNSHash]) {
+    if (TYPE(other) != T_HASH) {
 	return Qfalse;
     }
-    return [rcv isEqualToDictionary:other] ? Qtrue : Qfalse;
+    return [rcv isEqualToDictionary:(id)other] ? Qtrue : Qfalse;
 }
 
 static inline VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110120/dd519f01/attachment.html>


More information about the macruby-changes mailing list