aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AddressBook/GTMABAddressBook.m17
-rw-r--r--AddressBook/GTMABAddressBookTest.m2
-rw-r--r--AppKit/GTMCarbonEvent.m6
-rw-r--r--AppKit/GTMCarbonEventTest.m16
-rw-r--r--AppKit/GTMNSColor+Luminance.m2
-rw-r--r--Foundation/GTMFourCharCode.m4
-rw-r--r--Foundation/GTMLoggerTest.m4
-rw-r--r--Foundation/GTMNSAppleScript+Handler.m6
-rw-r--r--Foundation/GTMNSString+XMLTest.m4
-rw-r--r--Foundation/GTMStackTrace.m8
-rw-r--r--GTM.xcodeproj/project.pbxproj52
-rw-r--r--GTMDefines.h8
-rw-r--r--UnitTesting/GTMAppKit+UnitTesting.m8
-rw-r--r--UnitTesting/GTMAppKitUnitTestingUtilities.m5
-rw-r--r--UnitTesting/GTMNSObject+UnitTesting.m9
-rw-r--r--UnitTesting/GTMSenTestCase.h16
-rw-r--r--UnitTesting/GTMSenTestCase.m2
-rw-r--r--iPhone/GTMUIView+SubtreeDescriptionTest.m69
18 files changed, 160 insertions, 78 deletions
diff --git a/AddressBook/GTMABAddressBook.m b/AddressBook/GTMABAddressBook.m
index 6aa55e4..77d194d 100644
--- a/AddressBook/GTMABAddressBook.m
+++ b/AddressBook/GTMABAddressBook.m
@@ -595,11 +595,19 @@ typedef struct {
}
- (NSString *)description {
- return [NSString stringWithFormat:@"%@ %@ %@ %d",
+#if GTM_IPHONE_SDK
+ return [NSString stringWithFormat:@"%@ %@ %@ %d",
+ [self class],
+ [self valueForProperty:kGTMABPersonFirstNameProperty],
+ [self valueForProperty:kGTMABPersonLastNameProperty],
+ [self recordID]];
+#else // GTM_IPHONE_SDK
+ return [NSString stringWithFormat:@"%@ %@ %@ %@",
[self class],
[self valueForProperty:kGTMABPersonFirstNameProperty],
[self valueForProperty:kGTMABPersonLastNameProperty],
[self recordID]];
+#endif // GTM_IPHONE_SDK
}
+ (NSString *)localizedPropertyName:(GTMABPropertyID)property {
@@ -746,10 +754,17 @@ typedef struct {
}
- (NSString *)description {
+#if GTM_IPHONE_SDK
return [NSString stringWithFormat:@"%@ %@ %d",
[self class],
[self valueForProperty:kABGroupNameProperty],
[self recordID]];
+#else // GTM_IPHONE_SDK
+ return [NSString stringWithFormat:@"%@ %@ %@",
+ [self class],
+ [self valueForProperty:kABGroupNameProperty],
+ [self recordID]];
+#endif // GTM_IPHONE_SDK
}
@end
diff --git a/AddressBook/GTMABAddressBookTest.m b/AddressBook/GTMABAddressBookTest.m
index 4a7b0ce..0d1a3cd 100644
--- a/AddressBook/GTMABAddressBookTest.m
+++ b/AddressBook/GTMABAddressBookTest.m
@@ -611,7 +611,7 @@ static NSString *const kGTMABTestGroupName = @"GTMABAddressBookTestGroupName";
if (type == kGTMABDictionaryPropertyType) {
val = [[NSDictionary alloc] initWithObjectsAndKeys:@"1", @"1", nil];
} else if (type == kGTMABStringPropertyType) {
- val = [[NSString alloc] initWithFormat:@"value %d"];
+ val = [[NSString alloc] initWithFormat:@"value %zu", j];
} else if (type == kGTMABIntegerPropertyType
|| type == kGTMABRealPropertyType ) {
val = [[NSNumber alloc] initWithInt:143];
diff --git a/AppKit/GTMCarbonEvent.m b/AppKit/GTMCarbonEvent.m
index 37e7e2f..9ff1fbf 100644
--- a/AppKit/GTMCarbonEvent.m
+++ b/AppKit/GTMCarbonEvent.m
@@ -166,7 +166,8 @@
*((UInt32 *)cls) = CFSwapInt32HostToBig([self eventClass]);
kind = [self eventKind];
cls[4] = 0;
- return [NSString stringWithFormat:@"GTMCarbonEvent '%s' %lu", cls, kind];
+ return [NSString stringWithFormat:@"GTMCarbonEvent '%s' %lu",
+ cls, (unsigned long)kind];
}
@@ -749,7 +750,8 @@ CantCreateKey:
- (NSString *)description {
return [NSString stringWithFormat:@"<%@ %p> - ref %p signature %lu id %lu",
- [self class], self, hotKeyRef_, id_.signature, id_.id];
+ [self class], self, hotKeyRef_,
+ (unsigned long)id_.signature, (unsigned long)id_.id];
}
@end
diff --git a/AppKit/GTMCarbonEventTest.m b/AppKit/GTMCarbonEventTest.m
index 6a3d007..0c7286b 100644
--- a/AppKit/GTMCarbonEventTest.m
+++ b/AppKit/GTMCarbonEventTest.m
@@ -155,10 +155,10 @@ static const UInt32 kTestParameterValue = 'bam ';
autorelease];
[handler registerForEvents:&types count:1];
OSStatus status = [event_ sendToTarget:handler options:0];
- STAssertErr(status, eventNotHandledErr, @"status: %ld", status);
+ STAssertErr(status, eventNotHandledErr, @"status: %ld", (long)status);
[handler setDelegate:self];
status = [event_ sendToTarget:handler options:0];
- STAssertNoErr(status, @"status: %ld", status);
+ STAssertNoErr(status, @"status: %ld", (long)status);
[handler unregisterForEvents:&types count:1];
}
@@ -167,15 +167,15 @@ static const UInt32 kTestParameterValue = 'bam ';
[event_ postToMainQueue];
OSStatus status = [event_ postToQueue:eventQueue
priority:kEventPriorityStandard];
- STAssertErr(status, eventAlreadyPostedErr, @"status: %ld", status);
+ STAssertErr(status, eventAlreadyPostedErr, @"status: %ld", (long)status);
EventTypeSpec types = { kTestClass, kTestKind };
status = FlushEventsMatchingListFromQueue(eventQueue, 1, &types);
- STAssertNoErr(status, @"status: %ld", status);
+ STAssertNoErr(status, @"status: %ld", (long)status);
eventQueue = GetCurrentEventQueue();
[event_ postToCurrentQueue];
status = [event_ postToQueue:eventQueue priority:kEventPriorityStandard];
- STAssertErr(status, eventAlreadyPostedErr, @"status: %ld", status);
+ STAssertErr(status, eventAlreadyPostedErr, @"status: %ld", (long)status);
status = FlushEventsMatchingListFromQueue(eventQueue, 1, &types);
STAssertNoErr(status, @"status: %ld", status);
}
@@ -191,7 +191,8 @@ static const UInt32 kTestParameterValue = 'bam ';
- (void)testDescription {
NSString *descString
- = [NSString stringWithFormat:@"GTMCarbonEvent 'foo ' %d", kTestKind];
+ = [NSString stringWithFormat:@"GTMCarbonEvent 'foo ' %lu",
+ (unsigned long)kTestKind];
STAssertEqualObjects([event_ description], descString, nil);
}
@end
@@ -213,7 +214,8 @@ static const UInt32 kTestParameterValue = 'bam ';
- (void)testEventHandler {
[GTMUnitTestDevLogDebug expectPattern:
@"DebugAssert: GoogleToolboxForMac: event CantUseParams .*"];
- STAssertErr([handler_ handleEvent:nil handler:nil], eventNotHandledErr, nil);
+ STAssertErr([handler_ handleEvent:nil handler:nil],
+ (long)eventNotHandledErr, nil);
}
- (void)testDelegate {
diff --git a/AppKit/GTMNSColor+Luminance.m b/AppKit/GTMNSColor+Luminance.m
index df79068..36cfd51 100644
--- a/AppKit/GTMNSColor+Luminance.m
+++ b/AppKit/GTMNSColor+Luminance.m
@@ -124,7 +124,7 @@ static const CGFloat kGTMLuminanceDarkCutoff = 0.6;
color = [self gtm_colorByAdjustingLuminance:-0.25];
break;
default:
- _GTMDevLog(@"Invalid Coloration Use %d", use);
+ _GTMDevLog(@"Invalid Coloration Use %lu", (unsigned long)use);
color = self;
break;
}
diff --git a/Foundation/GTMFourCharCode.m b/Foundation/GTMFourCharCode.m
index f5a08bf..44ab688 100644
--- a/Foundation/GTMFourCharCode.m
+++ b/Foundation/GTMFourCharCode.m
@@ -77,10 +77,10 @@
}
- (NSString *)description {
- return [NSString stringWithFormat:@"%@ - %@ (0x%X)",
+ return [NSString stringWithFormat:@"%@ - %@ (0x%lX)",
[self class],
[self stringValue],
- code_];
+ (unsigned long)code_];
}
- (FourCharCode)fourCharCode {
diff --git a/Foundation/GTMLoggerTest.m b/Foundation/GTMLoggerTest.m
index 3c915c8..c48bf65 100644
--- a/Foundation/GTMLoggerTest.m
+++ b/Foundation/GTMLoggerTest.m
@@ -86,6 +86,10 @@
@private
NSString *path_;
}
+
+- (NSString *)stringFromFormatter:(id<GTMLogFormatter>)formatter
+ level:(GTMLoggerLevel)level
+ format:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3,4);
@end
@implementation GTMLoggerTest
diff --git a/Foundation/GTMNSAppleScript+Handler.m b/Foundation/GTMNSAppleScript+Handler.m
index 3917015..34b21c6 100644
--- a/Foundation/GTMNSAppleScript+Handler.m
+++ b/Foundation/GTMNSAppleScript+Handler.m
@@ -250,7 +250,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:);
desc = [[[NSAppleEventDescriptor alloc] initWithAEDescNoCopy:&result]
autorelease];
} else {
- _GTMDevLog(@"Unable to coerce script %d", (int)error);
+ _GTMDevLog(@"Unable to coerce script %ld", (long)error);
}
return desc;
}
@@ -264,7 +264,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:);
kASHasOpenHandler,
&value);
if (error) {
- _GTMDevLog(@"Unable to get script info about open handler %d", (int)error);
+ _GTMDevLog(@"Unable to get script info about open handler %ld", (long)error);
value = 0;
}
return value != 0;
@@ -462,7 +462,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:);
}
}
if (err != noErr) {
- _GTMDevLog(@"Unable to create desc for id:%d (%d)", osaID, (int)err); // COV_NF_LINE
+ _GTMDevLog(@"Unable to create desc for id:%lu (%ld)", (unsigned long)osaID, (long)err); // COV_NF_LINE
}
return desc;
}
diff --git a/Foundation/GTMNSString+XMLTest.m b/Foundation/GTMNSString+XMLTest.m
index 4788690..7e37e31 100644
--- a/Foundation/GTMNSString+XMLTest.m
+++ b/Foundation/GTMNSString+XMLTest.m
@@ -37,7 +37,7 @@
length:sizeof(chars) / sizeof(UniChar)];
NSString *string2 =
[NSString stringWithFormat:@"zzzzz&quot;z&amp;z&apos;z&lt;z&gt;z zzz%Czzz\nz\rz\tz",
- 0xE000];
+ (unsigned short)0xE000];
STAssertEqualObjects([string1 gtm_stringBySanitizingAndEscapingForXML],
string2,
@@ -69,7 +69,7 @@
length:sizeof(chars) / sizeof(UniChar)];
NSString *string2 =
[NSString stringWithFormat:@"zzzzz\"z&z'z<z>z zzz%Czzz\nz\rz\tz",
- 0xE000];
+ (unsigned short)0xE000];
STAssertEqualObjects([string1 gtm_stringBySanitizingToXMLSpec],
string2,
diff --git a/Foundation/GTMStackTrace.m b/Foundation/GTMStackTrace.m
index 8b482e6..db844b1 100644
--- a/Foundation/GTMStackTrace.m
+++ b/Foundation/GTMStackTrace.m
@@ -172,8 +172,8 @@ static NSString *GTMStackTraceFromAddressDescriptors(struct GTMAddressDescriptor
fileName = @"??";
}
if (descs[i].class_name) {
- [trace appendFormat:@"#%-2u %-35s %0*lX %s[%s %s]",
- i,
+ [trace appendFormat:@"#%-2lu %-35s %0*lX %s[%s %s]",
+ (unsigned long)i,
[fileName UTF8String],
// sizeof(void*) * 2 is the length of the hex address (32 vs 64) and + 2
// for the 0x prefix
@@ -183,8 +183,8 @@ static NSString *GTMStackTraceFromAddressDescriptors(struct GTMAddressDescriptor
descs[i].class_name,
(descs[i].symbol ? descs[i].symbol : "??")];
} else {
- [trace appendFormat:@"#%-2u %-35s %0*lX %s()",
- i,
+ [trace appendFormat:@"#%-2lu %-35s %0*lX %s()",
+ (unsigned long)i,
[fileName UTF8String],
// sizeof(void*) * 2 is the length of the hex address (32 vs 64) and + 2
// for the 0x prefix
diff --git a/GTM.xcodeproj/project.pbxproj b/GTM.xcodeproj/project.pbxproj
index d8dd18e..6009663 100644
--- a/GTM.xcodeproj/project.pbxproj
+++ b/GTM.xcodeproj/project.pbxproj
@@ -697,6 +697,27 @@
8B55479A0DB3B7A50014CC1C /* GTMAppKit+UnitTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMAppKit+UnitTesting.h"; sourceTree = "<group>"; };
8B55479B0DB3B7A50014CC1C /* GTMAppKit+UnitTesting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMAppKit+UnitTesting.m"; sourceTree = "<group>"; };
8B58E9940E547EB000A0E02E /* GTMGetURLHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMGetURLHandler.m; sourceTree = "<group>"; };
+ 8B5B4ABC15BF31050081A96C /* CodeCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CodeCoverage.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ABD15BF31050081A96C /* CodeCoverageStatic.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CodeCoverageStatic.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ABE15BF31050081A96C /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ABF15BF31050081A96C /* GCSupported.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GCSupported.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC015BF31050081A96C /* General.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC115BF31050081A96C /* GTMMerge.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GTMMerge.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC215BF31050081A96C /* iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC315BF31050081A96C /* iPhone30.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone30.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC415BF31050081A96C /* iPhone31.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone31.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC515BF31050081A96C /* iPhone312.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone312.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC615BF31050081A96C /* iPhone313.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone313.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC715BF31050081A96C /* iPhone32.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone32.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC815BF31050081A96C /* iPhone40.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone40.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AC915BF31050081A96C /* iPhone41.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = iPhone41.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ACA15BF31050081A96C /* LeopardOrLater.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = LeopardOrLater.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ACB15BF31050081A96C /* MacOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = MacOS.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ACC15BF31050081A96C /* MacOSX.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = MacOSX.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ACD15BF31050081A96C /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ACE15BF31050081A96C /* SnowLeopardOrLater.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SnowLeopardOrLater.xcconfig; sourceTree = "<group>"; };
+ 8B5B4ACF15BF31050081A96C /* TigerOrLater.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TigerOrLater.xcconfig; sourceTree = "<group>"; };
+ 8B5B4AD015BF31050081A96C /* Unittest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Unittest.xcconfig; sourceTree = "<group>"; };
8B61FDBF0E4CDB8000FF9C21 /* GTMStackTrace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTMStackTrace.m; sourceTree = "<group>"; };
8B6C15910F356E6400E51E5D /* GTMNSObject+KeyValueObserving.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSObject+KeyValueObserving.h"; sourceTree = "<group>"; };
8B6C15920F356E6400E51E5D /* GTMNSObject+KeyValueObserving.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSObject+KeyValueObserving.m"; sourceTree = "<group>"; };
@@ -1175,6 +1196,34 @@
path = GTMUIUnitTestingHarness;
sourceTree = "<group>";
};
+ 8B5B4ABB15BF31050081A96C /* subconfig */ = {
+ isa = PBXGroup;
+ children = (
+ 8B5B4ABC15BF31050081A96C /* CodeCoverage.xcconfig */,
+ 8B5B4ABD15BF31050081A96C /* CodeCoverageStatic.xcconfig */,
+ 8B5B4ABE15BF31050081A96C /* Debug.xcconfig */,
+ 8B5B4ABF15BF31050081A96C /* GCSupported.xcconfig */,
+ 8B5B4AC015BF31050081A96C /* General.xcconfig */,
+ 8B5B4AC115BF31050081A96C /* GTMMerge.xcconfig */,
+ 8B5B4AC215BF31050081A96C /* iOS.xcconfig */,
+ 8B5B4AC315BF31050081A96C /* iPhone30.xcconfig */,
+ 8B5B4AC415BF31050081A96C /* iPhone31.xcconfig */,
+ 8B5B4AC515BF31050081A96C /* iPhone312.xcconfig */,
+ 8B5B4AC615BF31050081A96C /* iPhone313.xcconfig */,
+ 8B5B4AC715BF31050081A96C /* iPhone32.xcconfig */,
+ 8B5B4AC815BF31050081A96C /* iPhone40.xcconfig */,
+ 8B5B4AC915BF31050081A96C /* iPhone41.xcconfig */,
+ 8B5B4ACA15BF31050081A96C /* LeopardOrLater.xcconfig */,
+ 8B5B4ACB15BF31050081A96C /* MacOS.xcconfig */,
+ 8B5B4ACC15BF31050081A96C /* MacOSX.xcconfig */,
+ 8B5B4ACD15BF31050081A96C /* Release.xcconfig */,
+ 8B5B4ACE15BF31050081A96C /* SnowLeopardOrLater.xcconfig */,
+ 8B5B4ACF15BF31050081A96C /* TigerOrLater.xcconfig */,
+ 8B5B4AD015BF31050081A96C /* Unittest.xcconfig */,
+ );
+ path = subconfig;
+ sourceTree = "<group>";
+ };
8BFE13AF0FB0F2B9001BE894 /* AddressBook */ = {
isa = PBXGroup;
children = (
@@ -1352,6 +1401,7 @@
children = (
F4CA854E0DAFAAB600B4AB10 /* xcconfigs-readme.txt */,
F4CA852B0DAFA92A00B4AB10 /* Project */,
+ 8B5B4ABB15BF31050081A96C /* subconfig */,
F4CA852E0DAFA92F00B4AB10 /* Target */,
);
path = XcodeConfig;
@@ -2764,7 +2814,6 @@
GCC_WARN_SHADOW = YES;
GTM_EXTRA_WARNING_OVERRIDE_CFLAGS = "-Wno-unused-parameter";
GTM_HOST_GCC_PREPROCESSOR_DEFINITIONS = "COMPONENT_SIGNATURE=\"\\'GTM \\'\" kComponentSignatureString=\"\\\"GoogleToolboxForMac\\\"\"";
- GTM_PLATFORM_WARNING_CFLAGS = "-Wno-missing-format-attribute";
};
name = Debug;
};
@@ -2867,7 +2916,6 @@
GCC_WARN_SHADOW = YES;
GTM_EXTRA_WARNING_OVERRIDE_CFLAGS = "-Wno-unused-parameter";
GTM_HOST_GCC_PREPROCESSOR_DEFINITIONS = "COMPONENT_SIGNATURE=\"\\'GTM \\'\" kComponentSignatureString=\"\\\"GoogleToolboxForMac\\\"\"";
- GTM_PLATFORM_WARNING_CFLAGS = "-Wno-missing-format-attribute";
};
name = Release;
};
diff --git a/GTMDefines.h b/GTMDefines.h
index 59a1723..eac1131 100644
--- a/GTMDefines.h
+++ b/GTMDefines.h
@@ -21,9 +21,13 @@
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
+#ifdef __OBJC__
+#include <Foundation/NSObjCRuntime.h>
+#endif // __OBJC__
+
#if TARGET_OS_IPHONE
#include <Availability.h>
-#endif // TARGET_OS_IPHONE
+#endif // TARGET_OS_IPHONE
// Not all MAC_OS_X_VERSION_10_X macros defined in past SDKs
#ifndef MAC_OS_X_VERSION_10_5
@@ -436,4 +440,4 @@ GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,
#endif // DEBUG
#endif // GTM_SEL_STRING
-#endif // __OBJC__
+#endif // __OBJC__
diff --git a/UnitTesting/GTMAppKit+UnitTesting.m b/UnitTesting/GTMAppKit+UnitTesting.m
index 8bca7ca..02e0e30 100644
--- a/UnitTesting/GTMAppKit+UnitTesting.m
+++ b/UnitTesting/GTMAppKit+UnitTesting.m
@@ -321,7 +321,8 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:);
NSToolbarItem *item = nil;
NSUInteger i = 0;
GTM_FOREACH_OBJECT(item, [self items]) {
- NSString *key = [NSString stringWithFormat:@"ToolbarItem %d", i];
+ NSString *key
+ = [NSString stringWithFormat:@"ToolbarItem %lu", (unsigned long)i];
[inCoder encodeObject:item forKey:key];
i = i + 1;
}
@@ -417,7 +418,7 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:);
ENCODE_NSINTEGER(inCoder, segmentCount, @"SegmentCount");
for (NSInteger i = 0; i < segmentCount; ++i) {
- NSString *key = [NSString stringWithFormat:@"Segment %d", i];
+ NSString *key = [NSString stringWithFormat:@"Segment %ld", (long)i];
[inCoder encodeObject:[self labelForSegment:i] forKey:key];
}
}
@@ -449,7 +450,8 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:);
for (NSUInteger i = 0; i < [objectValues count]; ++i) {
id value = [objectValues objectAtIndex:i];
if ([value isKindOfClass:[NSString class]]) {
- NSString *key = [NSString stringWithFormat:@"ComboBoxObjectValue %u", i];
+ NSString *key = [NSString stringWithFormat:@"ComboBoxObjectValue %lu",
+ (unsigned long)i];
[inCoder encodeObject:value forKey:key];
}
}
diff --git a/UnitTesting/GTMAppKitUnitTestingUtilities.m b/UnitTesting/GTMAppKitUnitTestingUtilities.m
index ff9442e..6f51410 100644
--- a/UnitTesting/GTMAppKitUnitTestingUtilities.m
+++ b/UnitTesting/GTMAppKitUnitTestingUtilities.m
@@ -175,8 +175,9 @@ void GTMRestoreColorProfile(void) {
// COV_NF_START
// No way to force this case in a unittest.
_GTMDevLog(@"Failed to restore previous color profile! "
- "You may need to open System Preferences : Displays : Color "
- "and manually restore your color settings. (Error: %i)", error);
+ @"You may need to open System Preferences : Displays : Color "
+ @"and manually restore your color settings. (Error: %ld)",
+ (long)error);
// COV_NF_END
} else {
_GTMDevLog(@"Color profile restored");
diff --git a/UnitTesting/GTMNSObject+UnitTesting.m b/UnitTesting/GTMNSObject+UnitTesting.m
index f72ba88..5de6d05 100644
--- a/UnitTesting/GTMNSObject+UnitTesting.m
+++ b/UnitTesting/GTMNSObject+UnitTesting.m
@@ -539,9 +539,10 @@ static NSString *gGTMUnitTestSaveToDirectory = nil;
[GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugFix];
NSString *systemVersions[4];
systemVersions[0] = [NSString stringWithFormat:@".%d.%d.%d",
- major, minor, bugFix];
- systemVersions[1] = [NSString stringWithFormat:@".%d.%d", major, minor];
- systemVersions[2] = [NSString stringWithFormat:@".%d", major];
+ (int)major, (int)minor, (int)bugFix];
+ systemVersions[1]
+ = [NSString stringWithFormat:@".%d.%d", (int)major, (int)minor];
+ systemVersions[2] = [NSString stringWithFormat:@".%d", (int)major];
systemVersions[3] = @"";
// Architecture
NSString *architecture[2];
@@ -620,7 +621,7 @@ static NSString *gGTMUnitTestSaveToDirectory = nil;
// We don't include the CompilerSDK in here because it is not something that
// that is commonly needed.
NSString *fullName = [NSString stringWithFormat:@"%@.%d.%d.%d.%@",
- name, major, minor, bugFix, systemArchitecture];
+ name, (int)major, (int)minor, (int)bugFix, systemArchitecture];
NSString *basePath = [[self class] gtm_getUnitTestSaveToDirectory];
return [[basePath stringByAppendingPathComponent:fullName]
diff --git a/UnitTesting/GTMSenTestCase.h b/UnitTesting/GTMSenTestCase.h
index 9884543..3dac15b 100644
--- a/UnitTesting/GTMSenTestCase.h
+++ b/UnitTesting/GTMSenTestCase.h
@@ -78,7 +78,7 @@ do { \
@try { \
OSStatus a1value = (a1); \
if (a1value != noErr) { \
- NSString *_expression = [NSString stringWithFormat:@"Expected noErr, got %ld for (%s)", a1value, #a1]; \
+ NSString *_expression = [NSString stringWithFormat:@"Expected noErr, got %ld for (%s)", (long)a1value, #a1]; \
[self failWithException:([NSException failureInCondition:_expression \
isTrue:NO \
inFile:[NSString stringWithUTF8String:__FILE__] \
@@ -108,7 +108,7 @@ do { \
OSStatus a1value = (a1); \
OSStatus a2value = (a2); \
if (a1value != a2value) { \
- NSString *_expression = [NSString stringWithFormat:@"Expected %s(%ld) but got %ld for (%s)", #a2, a2value, a1value, #a1]; \
+ NSString *_expression = [NSString stringWithFormat:@"Expected %s(%ld) but got %ld for (%s)", #a2, (long)a2value, (long)a1value, #a1]; \
[self failWithException:([NSException failureInCondition:_expression \
isTrue:NO \
inFile:[NSString stringWithUTF8String:__FILE__] \
@@ -1015,32 +1015,32 @@ do { \
@interface NSException (GTMSenTestAdditions)
+ (NSException *)failureInFile:(NSString *)filename
atLine:(int)lineNumber
- withDescription:(NSString *)formatString, ...;
+ withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(3, 4);
+ (NSException *)failureInCondition:(NSString *)condition
isTrue:(BOOL)isTrue
inFile:(NSString *)filename
atLine:(int)lineNumber
- withDescription:(NSString *)formatString, ...;
+ withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(5, 6);
+ (NSException *)failureInEqualityBetweenObject:(id)left
andObject:(id)right
inFile:(NSString *)filename
atLine:(int)lineNumber
- withDescription:(NSString *)formatString, ...;
+ withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(5, 6);
+ (NSException *)failureInEqualityBetweenValue:(NSValue *)left
andValue:(NSValue *)right
withAccuracy:(NSValue *)accuracy
inFile:(NSString *)filename
atLine:(int) ineNumber
- withDescription:(NSString *)formatString, ...;
+ withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(6, 7);
+ (NSException *)failureInRaise:(NSString *)expression
inFile:(NSString *)filename
atLine:(int)lineNumber
- withDescription:(NSString *)formatString, ...;
+ withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(4, 5);
+ (NSException *)failureInRaise:(NSString *)expression
exception:(NSException *)exception
inFile:(NSString *)filename
atLine:(int)lineNumber
- withDescription:(NSString *)formatString, ...;
+ withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(5, 6);
@end
// SENTE_END
diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m
index 5607c31..4906c19 100644
--- a/UnitTesting/GTMSenTestCase.m
+++ b/UnitTesting/GTMSenTestCase.m
@@ -198,6 +198,8 @@
@end
+NSString *STComposeString(NSString *formatString, ...) NS_FORMAT_FUNCTION(1, 2);
+
NSString *STComposeString(NSString *formatString, ...) {
NSString *reason = @"";
if (formatString) {
diff --git a/iPhone/GTMUIView+SubtreeDescriptionTest.m b/iPhone/GTMUIView+SubtreeDescriptionTest.m
index db4b2fc..34911bd 100644
--- a/iPhone/GTMUIView+SubtreeDescriptionTest.m
+++ b/iPhone/GTMUIView+SubtreeDescriptionTest.m
@@ -32,8 +32,8 @@
CGRect frame1 = CGRectMake(0, 0, 100, 200);
UIView *view1 = [[[UIView alloc] initWithFrame:frame1] autorelease];
NSString *actual = [view1 subtreeDescription];
- NSString *format1 = @"UIView %p {x:0 y:0 w:100 h:200}\n";
- NSString *expected = [NSString stringWithFormat:format1, view1];
+ NSString *expected = [NSString stringWithFormat:
+ @"UIView %p {x:0 y:0 w:100 h:200}\n", view1];
STAssertEqualObjects(actual, expected, @"a single, simple view failed");
// Test a view with one child.
@@ -41,9 +41,9 @@
UIView *view2 = [[[UIView alloc] initWithFrame:frame2] autorelease];
[view1 addSubview:view2];
NSString *actual2 = [view1 subtreeDescription];
- NSString *format2 = @"UIView %p {x:0 y:0 w:100 h:200}\n"
- " UIView %p {x:2 y:2 w:102 h:202}\n";
- NSString *expected2 = [NSString stringWithFormat:format2, view1, view2];
+ NSString *expected2 = [NSString stringWithFormat:
+ @"UIView %p {x:0 y:0 w:100 h:200}\n"
+ @" UIView %p {x:2 y:2 w:102 h:202}\n", view1, view2];
STAssertEqualObjects(actual2, expected2, @"a view with one child");
// Test a view with two children.
@@ -51,21 +51,21 @@
UIView *view3 = [[[UIView alloc] initWithFrame:frame3] autorelease];
[view1 addSubview:view3];
NSString *actual3 = [view1 subtreeDescription];
- NSString *format3 = @"UIView %p {x:0 y:0 w:100 h:200}\n"
- " UIView %p {x:2 y:2 w:102 h:202}\n"
- " UIView %p {x:3 y:3 w:103 h:203}\n";
- NSString *expected3 = [NSString stringWithFormat:format3,
- view1, view2, view3];
+ NSString *expected3 = [NSString stringWithFormat:
+ @"UIView %p {x:0 y:0 w:100 h:200}\n"
+ @" UIView %p {x:2 y:2 w:102 h:202}\n"
+ @" UIView %p {x:3 y:3 w:103 h:203}\n",
+ view1, view2, view3];
STAssertEqualObjects(actual3, expected3, @"a view with two children");
// Test a view with two children, one hidden.
[view3 setHidden:YES];
- NSString *format4 = @"UIView %p {x:0 y:0 w:100 h:200}\n"
- " UIView %p {x:2 y:2 w:102 h:202}\n"
- " UIView %p {x:3 y:3 w:103 h:203} hid\n";
NSString *actual4 = [view1 subtreeDescription];
- NSString *expected4 = [NSString stringWithFormat:format4,
- view1, view2, view3];
+ NSString *expected4 = [NSString stringWithFormat:
+ @"UIView %p {x:0 y:0 w:100 h:200}\n"
+ @" UIView %p {x:2 y:2 w:102 h:202}\n"
+ @" UIView %p {x:3 y:3 w:103 h:203} hid\n",
+ view1, view2, view3];
STAssertEqualObjects(actual4, expected4, @"with two children, one hidden");
}
@@ -74,8 +74,8 @@
CGRect frame1 = CGRectMake(0, 0, 100, 200);
UIView *view1 = [[[UIView alloc] initWithFrame:frame1] autorelease];
NSString *actual = [view1 sublayersDescription];
- NSString *format1 = @"CALayer %p {x:0 y:0 w:100 h:200}\n";
- NSString *expected = [NSString stringWithFormat:format1, [view1 layer]];
+ NSString *expected = [NSString stringWithFormat:
+ @"CALayer %p {x:0 y:0 w:100 h:200}\n", [view1 layer]];
STAssertEqualObjects(actual, expected, @"a single, simple layer failed");
// Test a layer with one child.
@@ -83,10 +83,10 @@
UIView *view2 = [[[UIView alloc] initWithFrame:frame2] autorelease];
[view1 addSubview:view2];
NSString *actual2 = [view1 sublayersDescription];
- NSString *format2 = @"CALayer %p {x:0 y:0 w:100 h:200}\n"
- " CALayer %p {x:2 y:2 w:102 h:202}\n";
- NSString *expected2 = [NSString stringWithFormat:format2,
- [view1 layer], [view2 layer]];
+ NSString *expected2 = [NSString stringWithFormat:
+ @"CALayer %p {x:0 y:0 w:100 h:200}\n"
+ @" CALayer %p {x:2 y:2 w:102 h:202}\n",
+ [view1 layer], [view2 layer]];
STAssertEqualObjects(actual2, expected2, @"a layer with one child");
// Test a layer with two children.
@@ -94,21 +94,21 @@
UIView *view3 = [[[UIView alloc] initWithFrame:frame3] autorelease];
[view1 addSubview:view3];
NSString *actual3 = [view1 sublayersDescription];
- NSString *format3 = @"CALayer %p {x:0 y:0 w:100 h:200}\n"
- " CALayer %p {x:2 y:2 w:102 h:202}\n"
- " CALayer %p {x:3 y:3 w:103 h:203}\n";
- NSString *expected3 = [NSString stringWithFormat:format3,
- [view1 layer], [view2 layer], [view3 layer]];
+ NSString *expected3 = [NSString stringWithFormat:
+ @"CALayer %p {x:0 y:0 w:100 h:200}\n"
+ @" CALayer %p {x:2 y:2 w:102 h:202}\n"
+ @" CALayer %p {x:3 y:3 w:103 h:203}\n",
+ [view1 layer], [view2 layer], [view3 layer]];
STAssertEqualObjects(actual3, expected3, @"a layer with two children");
// Test a layer with two children, one hidden.
[view3 setHidden:YES];
- NSString *format4 = @"CALayer %p {x:0 y:0 w:100 h:200}\n"
- " CALayer %p {x:2 y:2 w:102 h:202}\n"
- " CALayer %p {x:3 y:3 w:103 h:203} hid\n";
NSString *actual4 = [view1 sublayersDescription];
- NSString *expected4 = [NSString stringWithFormat:format4,
- [view1 layer], [view2 layer], [view3 layer]];
+ NSString *expected4 = [NSString stringWithFormat:
+ @"CALayer %p {x:0 y:0 w:100 h:200}\n"
+ @" CALayer %p {x:2 y:2 w:102 h:202}\n"
+ @" CALayer %p {x:3 y:3 w:103 h:203} hid\n",
+ [view1 layer], [view2 layer], [view3 layer]];
STAssertEqualObjects(actual4, expected4, @"with two children, one hidden");
}
@@ -138,9 +138,10 @@
UIView *view2 = [[[UIMyTestView alloc] initWithFrame:frame2] autorelease];
[view1 addSubview:view2];
NSString *actual2 = [view1 subtreeDescription];
- NSString *format2 = @"UIView %p {x:0 y:0 w:100 h:200}\n"
- " UIMyTestView %p {x:2 y:2 w:102 h:202} alpha: 1.0\n";
- NSString *expected2 = [NSString stringWithFormat:format2, view1, view2];
+ NSString *expected2 = [NSString stringWithFormat:
+ @"UIView %p {x:0 y:0 w:100 h:200}\n"
+ @" UIMyTestView %p {x:2 y:2 w:102 h:202} alpha:1.0\n",
+ view1, view2];
STAssertEqualObjects(actual2, expected2, @"a view with one subclassed child");
}
@end