All pastes #60089 Raw Edit

Untitled

public text v1 · immutable
#60089 ·published 2006-05-30 22:58 UTC
rendered paste body
Index: testlibrary/NativeMarshalTests.cs
===================================================================
--- testlibrary/NativeMarshalTests.cs   (revision 60746)
+++ testlibrary/NativeMarshalTests.cs   (working copy)
@@ -6,8 +6,8 @@
 
                public NativeMarshalTests () {}
 
-               public bool InvokeCompare (int cmpvalue, object target) {
-                       return (bool)target.GetType ().InvokeMember ("compareInteger", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, target, new object[] {cmpvalue});
+               public int InvokeCompare (int cmpvalue, object target) {
+                       return (int)target.GetType ().InvokeMember ("compareInteger", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, target, new object[] {cmpvalue});
                }
         }
 } 
Index: marshalling.m
===================================================================
--- marshalling.m       (revision 60746)
+++ marshalling.m       (working copy)
@@ -9,9 +9,9 @@
        myint = toset;
 }
 
-- (bool) compareInteger: (int) tocompare
+- (int) compareInteger: (int) tocompare
 {
-       return (tocompare == myint);
+       return (tocompare == myint ? 1 : 0);
 }
 
 @end
@@ -33,8 +33,11 @@
 
                id tester = [NativeMarshalTests init];
 
-               if ([tester InvokeCompareWithInt32:-1 Object:native] == FALSE)
-                       return  2;
+               if (*((int *)[tester InvokeCompareWithInt32:-1 Object:native]) == 0)
+                       return 2;
+
+               if (*((int *)[tester InvokeCompareWithInt32:1 Object:native]) == 1)
+                       return 3;
 
                return 0;
        } @catch (NSException *ex) {