From b962a2ca36c7efbb9ae89330041a3edcd12e7704 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Wed, 20 Jun 2012 21:00:18 +0000 Subject: [Author: oster] fix some type errors. Tested: Compiled and ran a text program R=thomasvl APPROVED=thomasvl DELTA=2 (0 added, 0 deleted, 2 changed) --- DebugUtils/GTMMethodCheck.m | 48 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'DebugUtils') diff --git a/DebugUtils/GTMMethodCheck.m b/DebugUtils/GTMMethodCheck.m index cb3c240..801278c 100644 --- a/DebugUtils/GTMMethodCheck.m +++ b/DebugUtils/GTMMethodCheck.m @@ -1,14 +1,14 @@ // // GTMMethodCheck.m -// +// // Copyright 2006-2008 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -33,16 +33,16 @@ static BOOL ConformsToNSObjectProtocol(Class cls) { if (!cls) return NO; const char *className = class_getName(cls); if (!className) return NO; - - // We're going to assume that all Apple classes will work + + // We're going to assume that all Apple classes will work // (and aren't being checked) - // Note to apple: why doesn't obj-c have real namespaces instead of two - // letter hacks? If you name your own classes starting with NS this won't + // Note to apple: why doesn't obj-c have real namespaces instead of two + // letter hacks? If you name your own classes starting with NS this won't // work for you. // Some classes (like _NSZombie) start with _NS. // On Leopard we have to look for CFObject as well. // On iPhone we check Object as well - if ((strncmp(className, "NS", 2) == 0) + if ((strncmp(className, "NS", 2) == 0) || (strncmp(className, "_NS", 3) == 0) || (strncmp(className, "__NS", 4) == 0) || (strcmp(className, "CFObject") == 0) @@ -53,23 +53,23 @@ 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] + if (cls == [NSObject class] || class_conformsToProtocol(cls, @protocol(NSObject))) { return YES; } -#else +#else // Iterate through all the protocols |cls| supports looking for NSObject. - if (cls == [Object class] + if (cls == [Object class] || class_conformsToProtocol(cls, @protocol(NSObject))) { return YES; } #endif - + // Recursively check the superclasses. return ConformsToNSObjectProtocol(class_getSuperclass(cls)); } @@ -91,20 +91,20 @@ void GTMMethodCheckMethodChecker(void) { } for (i = 0; i < numClasses && classes; ++i) { Class cls = classes[i]; - - // Since we are directly calling objc_msgSend, we need to conform to + + // Since we are directly calling objc_msgSend, we need to conform to // @protocol(NSObject), or else we will tumble into a _objc_msgForward // recursive loop when we try and call a function by name. if (!ConformsToNSObjectProtocol(cls)) { // COV_NF_START _GTMDevLog(@"GTMMethodCheckMethodChecker: Class %s does not conform to " - "@protocol(NSObject), so won't be checked", + "@protocol(NSObject), so won't be checked", class_getName(cls)); continue; // COV_NF_END } // Since we are looking for a class method (+xxGMMethodCheckMethod...) - // we need to query the isa pointer to see what methods it support, but + // we need to query the isa pointer to see what methods it support, but // send the method (if it's supported) to the class itself. unsigned int count; Class metaClass = objc_getMetaClass(class_getName(cls)); @@ -115,7 +115,7 @@ void GTMMethodCheckMethodChecker(void) { const char *name = sel_getName(selector); if (strstr(name, "xxGTMMethodCheckMethod") == name) { // Check to make sure that the method we are checking comes - // from the same image that we are in. Since GTMMethodCheckMethodChecker + // from the same image that we are in. Since GTMMethodCheckMethodChecker // is not exported, we should always find the copy in our local // image. We compare the address of it's image with the address of // the image which implements the method we want to check. If @@ -124,25 +124,25 @@ void GTMMethodCheckMethodChecker(void) { // methods. They should only be called once. // b) prevents initializers for various classes being called too early Dl_info methodCheckerInfo; - if (!dladdr(GTMMethodCheckMethodChecker, + if (!dladdr(GTMMethodCheckMethodChecker, &methodCheckerInfo)) { - // COV_NF_START - // Don't know how to force this case in a unittest. + // COV_NF_START + // Don't know how to force this case in a unittest. // Certainly hope we never see it. _GTMDevLog(@"GTMMethodCheckMethodChecker: Unable to get dladdr info " - "for GTMMethodCheckMethodChecker while introspecting +[%@ %@]]", + "for GTMMethodCheckMethodChecker while introspecting +[%s %s]]", class_getName(cls), name); continue; // COV_NF_END } Dl_info methodInfo; - if (!dladdr(method_getImplementation(methods[j]), + if (!dladdr(method_getImplementation(methods[j]), &methodInfo)) { // COV_NF_START // Don't know how to force this case in a unittest // Certainly hope we never see it. _GTMDevLog(@"GTMMethodCheckMethodChecker: Unable to get dladdr info " - "for %@ while introspecting +[%@ %@]]", name, + "for %s while introspecting +[%s %s]]", name, class_getName(cls), name); continue; // COV_NF_END -- cgit v1.2.3