aboutsummaryrefslogtreecommitdiff
path: root/DebugUtils
diff options
context:
space:
mode:
authorGravatar thomasvl <thomasvl@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-05-09 18:53:09 +0000
committerGravatar thomasvl <thomasvl@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2008-05-09 18:53:09 +0000
commitf90bcf3263b80b96754977ddbd5309704cf817fb (patch)
tree585db4c1126cea3bd0ff9b338628d33febe36e59 /DebugUtils
parente5c365c04b9f2f6d04b2c5bd828f39fab2882e7d (diff)
Flush out suppport for 64bit, GC support.
Added some more xcode configs related to the above. Removed some classes that the unittesting doesn't need (and aren't able to support 64bit). add base64, httpfetcher, and progress monitor stream.
Diffstat (limited to 'DebugUtils')
-rw-r--r--DebugUtils/GTMDebugSelectorValidation.h56
-rw-r--r--DebugUtils/GTMMethodCheck.m10
2 files changed, 37 insertions, 29 deletions
diff --git a/DebugUtils/GTMDebugSelectorValidation.h b/DebugUtils/GTMDebugSelectorValidation.h
index b3f1e73..82d00e8 100644
--- a/DebugUtils/GTMDebugSelectorValidation.h
+++ b/DebugUtils/GTMDebugSelectorValidation.h
@@ -40,39 +40,37 @@ static void GTMAssertSelectorNilOrImplementedWithArguments(id obj, SEL sel, ...)
if (obj && sel) {
// check that the selector is implemented
- if (![obj respondsToSelector:sel]) {
- _GTMDevAssert(NO,
- @"\"%@\" selector \"%@\" is unimplemented or misnamed",
- NSStringFromClass([obj class]),
- NSStringFromSelector(sel));
- } else {
- const char *expectedArgType;
- int argCount = 2; // skip self and _cmd
- NSMethodSignature *sig = [obj methodSignatureForSelector:sel];
-
- // check that each expected argument is present and of the correct type
- while ((expectedArgType = va_arg(argList, const char*)) != 0) {
+ _GTMDevAssert([obj respondsToSelector:sel],
+ @"\"%@\" selector \"%@\" is unimplemented or misnamed",
+ NSStringFromClass([obj class]),
+ NSStringFromSelector(sel));
+
+ const char *expectedArgType;
+ NSUInteger argCount = 2; // skip self and _cmd
+ NSMethodSignature *sig = [obj methodSignatureForSelector:sel];
+
+ // check that each expected argument is present and of the correct type
+ while ((expectedArgType = va_arg(argList, const char*)) != 0) {
- if ([sig numberOfArguments] > argCount) {
- const char *foundArgType = [sig getArgumentTypeAtIndex:argCount];
+ if ([sig numberOfArguments] > argCount) {
+ const char *foundArgType = [sig getArgumentTypeAtIndex:argCount];
- _GTMDevAssert(0 == strncmp(foundArgType, expectedArgType, strlen(expectedArgType)),
- @"\"%@\" selector \"%@\" argument %d should be type %s",
- NSStringFromClass([obj class]),
- NSStringFromSelector(sel),
- (argCount - 2),
- expectedArgType);
- }
- argCount++;
+ _GTMDevAssert(0 == strncmp(foundArgType, expectedArgType, strlen(expectedArgType)),
+ @"\"%@\" selector \"%@\" argument %d should be type %s",
+ NSStringFromClass([obj class]),
+ NSStringFromSelector(sel),
+ (argCount - 2),
+ expectedArgType);
}
-
- // check that the proper number of arguments are present in the selector
- _GTMDevAssert(argCount == [sig numberOfArguments],
- @"\"%@\" selector \"%@\" should have %d arguments",
- NSStringFromClass([obj class]),
- NSStringFromSelector(sel),
- (argCount - 2));
+ argCount++;
}
+
+ // check that the proper number of arguments are present in the selector
+ _GTMDevAssert(argCount == [sig numberOfArguments],
+ @"\"%@\" selector \"%@\" should have %d arguments",
+ NSStringFromClass([obj class]),
+ NSStringFromSelector(sel),
+ (argCount - 2));
}
va_end(argList);
diff --git a/DebugUtils/GTMMethodCheck.m b/DebugUtils/GTMMethodCheck.m
index 379f006..f91b1a9 100644
--- a/DebugUtils/GTMMethodCheck.m
+++ b/DebugUtils/GTMMethodCheck.m
@@ -47,11 +47,21 @@ static BOOL ConformsToNSObjectProtocol(Class cls) {
return YES;
}
+// iPhone SDK does not define the |Object| class, so we instead test for the
+// |NSObject| class.
+#if GTM_IPHONE_SDK
+ // Iterate through all the protocols |cls| supports looking for NSObject.
+ if (cls == [NSObject class]
+ || class_conformsToProtocol(cls, @protocol(NSObject))) {
+ return YES;
+ }
+#else
// Iterate through all the protocols |cls| supports looking for NSObject.
if (cls == [Object class]
|| class_conformsToProtocol(cls, @protocol(NSObject))) {
return YES;
}
+#endif
// Recursively check the superclasses.
return ConformsToNSObjectProtocol(class_getSuperclass(cls));