Fixed all build warnings on OS X Framework target

This commit is contained in:
Blake Watters
2011-12-08 23:23:20 -05:00
parent ec13fb03bd
commit 479864902b
17 changed files with 37 additions and 49 deletions

View File

@@ -120,7 +120,7 @@ static NSNumber *defaultBatchSize = nil;
{ {
@synchronized(defaultBatchSize) @synchronized(defaultBatchSize)
{ {
defaultBatchSize = [NSNumber numberWithInt:newBatchSize]; defaultBatchSize = [NSNumber numberWithUnsignedInteger:newBatchSize];
} }
} }
@@ -325,7 +325,7 @@ static NSNumber *defaultBatchSize = nil;
NSUInteger count = [context countForFetchRequest:request error:&error]; NSUInteger count = [context countForFetchRequest:request error:&error];
[self handleErrors:error]; [self handleErrors:error];
return [NSNumber numberWithUnsignedInt:count]; return [NSNumber numberWithUnsignedInteger:count];
} }
+ (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm; + (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm;

View File

@@ -27,26 +27,6 @@
#undef RKLogComponent #undef RKLogComponent
#define RKLogComponent lcl_cRestKitCoreData #define RKLogComponent lcl_cRestKitCoreData
/**
Progressively enhance the RKObjectMappingOperation base class to inject Core Data
specifics without leaking into the object mapper abstractions
*/
@implementation RKObjectMappingOperation (CoreData)
/*
Trampoline the initialization through RKManagedObjectMapping so the mapper uses RKManagedObjectMappingOperation
at the right moments
*/
+ (RKObjectMappingOperation*)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(RKObjectMapping*)objectMapping {
if ([objectMapping isKindOfClass:[RKManagedObjectMapping class]]) {
return [[[RKManagedObjectMappingOperation alloc] initWithSourceObject:sourceObject destinationObject:destinationObject mapping:objectMapping] autorelease];
}
return [[[RKObjectMappingOperation alloc] initWithSourceObject:sourceObject destinationObject:destinationObject mapping:objectMapping] autorelease];
}
@end
@implementation RKManagedObjectMappingOperation @implementation RKManagedObjectMappingOperation
// TODO: Move this to a better home to take exposure out of the mapper // TODO: Move this to a better home to take exposure out of the mapper

View File

@@ -156,7 +156,7 @@ NSString* const RKDefaultSeedDatabaseFileName = @"RKSeedDatabase.sqlite";
} }
} }
RKLogInfo(@"Seeded %d objects from %@...", [mappedObjects count], [NSString stringWithFormat:@"%@", fileName]); RKLogInfo(@"Seeded %lu objects from %@...", (unsigned long) [mappedObjects count], [NSString stringWithFormat:@"%@", fileName]);
} else { } else {
RKLogError(@"Unable to read file %@: %@", fileName, [error localizedDescription]); RKLogError(@"Unable to read file %@: %@", fileName, [error localizedDescription]);
} }

View File

@@ -421,7 +421,7 @@ static NSString* const RKManagedObjectStoreThreadDictionaryEntityCacheKey = @"RK
[fetchRequest setEntity:entity]; [fetchRequest setEntity:entity];
[fetchRequest setReturnsObjectsAsFaults:NO]; [fetchRequest setReturnsObjectsAsFaults:NO];
objects = [NSManagedObject executeFetchRequest:fetchRequest]; objects = [NSManagedObject executeFetchRequest:fetchRequest];
RKLogInfo(@"Caching all %d %@ objects to thread local storage", [objects count], entity.name); RKLogInfo(@"Caching all %lu %@ objects to thread local storage", (unsigned long) [objects count], entity.name);
NSMutableDictionary* dictionary = [NSMutableDictionary dictionary]; NSMutableDictionary* dictionary = [NSMutableDictionary dictionary];
BOOL coerceToString = [[[objects lastObject] valueForKey:primaryKeyAttribute] respondsToSelector:@selector(stringValue)]; BOOL coerceToString = [[[objects lastObject] valueForKey:primaryKeyAttribute] respondsToSelector:@selector(stringValue)];
for (id theObject in objects) { for (id theObject in objects) {

View File

@@ -33,7 +33,7 @@
_argumentKeyPaths = [[NSMutableDictionary alloc] init]; _argumentKeyPaths = [[NSMutableDictionary alloc] init];
} }
NSNumber* argumentIndex = [NSNumber numberWithInt:index]; NSNumber* argumentIndex = [NSNumber numberWithInteger:index];
[_argumentKeyPaths setObject:keyPaths forKey:argumentIndex]; [_argumentKeyPaths setObject:keyPaths forKey:argumentIndex];
} }

View File

@@ -26,12 +26,12 @@ RK_FIX_CATEGORY_BUG(NSData_MD5)
@implementation NSData (MD5) @implementation NSData (MD5)
- (NSString*)MD5 { - (NSString *)MD5 {
// Create byte array of unsigned chars // Create byte array of unsigned chars
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH]; unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
// Create 16 byte MD5 hash value, store in buffer // Create 16 byte MD5 hash value, store in buffer
CC_MD5(self.bytes, self.length, md5Buffer); CC_MD5(self.bytes, (CC_LONG) self.length, md5Buffer);
// Convert unsigned char buffer to NSString of hex values // Convert unsigned char buffer to NSString of hex values
NSMutableString* output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; NSMutableString* output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];

View File

@@ -34,7 +34,7 @@ RK_FIX_CATEGORY_BUG(NSString_MD5)
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH]; unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
// Create 16 byte MD5 hash value, store in buffer // Create 16 byte MD5 hash value, store in buffer
CC_MD5(ptr, strlen(ptr), md5Buffer); CC_MD5(ptr, (CC_LONG) strlen(ptr), md5Buffer);
// Convert MD5 value in the buffer to NSString of hex values // Convert MD5 value in the buffer to NSString of hex values
NSMutableString* output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; NSMutableString* output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];

View File

@@ -559,7 +559,7 @@
_isLoading = NO; _isLoading = NO;
_isLoaded = YES; _isLoaded = YES;
RKLogInfo(@"Status Code: %d", [response statusCode]); RKLogInfo(@"Status Code: %ld", (long) [response statusCode]);
RKLogInfo(@"Body: %@", [response bodyAsString]); RKLogInfo(@"Body: %@", [response bodyAsString]);
RKResponse* finalResponse = response; RKResponse* finalResponse = response;

View File

@@ -189,7 +189,7 @@ static NSDateFormatter* __rfc1123DateFormatter;
[headers setObject:[[RKRequestCache rfc1123DateFormatter] stringFromDate:[NSDate date]] [headers setObject:[[RKRequestCache rfc1123DateFormatter] stringFromDate:[NSDate date]]
forKey:cacheDateHeaderKey]; forKey:cacheDateHeaderKey];
// Cache status code // Cache status code
[headers setObject:[NSNumber numberWithInt:urlResponse.statusCode] [headers setObject:[NSNumber numberWithInteger:urlResponse.statusCode]
forKey:cacheResponseCodeKey]; forKey:cacheResponseCodeKey];
// Cache MIME Type // Cache MIME Type
[headers setObject:urlResponse.MIMEType [headers setObject:urlResponse.MIMEType

View File

@@ -186,7 +186,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
- (void)setLoadingCount:(NSUInteger)count { - (void)setLoadingCount:(NSUInteger)count {
if (_loadingCount == 0 && count > 0) { if (_loadingCount == 0 && count > 0) {
RKLogTrace(@"Loading count increasing from 0 to %d. Firing requestQueueDidBeginLoading", count); RKLogTrace(@"Loading count increasing from 0 to %ld. Firing requestQueueDidBeginLoading", (long) count);
// Transitioning from empty to processing // Transitioning from empty to processing
if ([_delegate respondsToSelector:@selector(requestQueueDidBeginLoading:)]) { if ([_delegate respondsToSelector:@selector(requestQueueDidBeginLoading:)]) {
@@ -199,7 +199,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
} }
#endif #endif
} else if (_loadingCount > 0 && count == 0) { } else if (_loadingCount > 0 && count == 0) {
RKLogTrace(@"Loading count decreasing from %d to 0. Firing requestQueueDidFinishLoading", _loadingCount); RKLogTrace(@"Loading count decreasing from %ld to 0. Firing requestQueueDidFinishLoading", (long) _loadingCount);
// Transition from processing to empty // Transition from processing to empty
if ([_delegate respondsToSelector:@selector(requestQueueDidFinishLoading:)]) { if ([_delegate respondsToSelector:@selector(requestQueueDidFinishLoading:)]) {
@@ -213,7 +213,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
#endif #endif
} }
RKLogTrace(@"Loading count set to %d for queue %@", count, self); RKLogTrace(@"Loading count set to %ld for queue %@", (long) count, self);
_loadingCount = count; _loadingCount = count;
} }
@@ -268,8 +268,8 @@ static const NSTimeInterval kFlushDelay = 0.3;
} }
self.loadingCount = self.loadingCount + 1; self.loadingCount = self.loadingCount + 1;
[request sendAsynchronously]; [request sendAsynchronously];
RKLogDebug(@"Sent request %@ from queue %@. Loading count = %d of %d", request, self, self.loadingCount, _concurrentRequestsLimit); RKLogDebug(@"Sent request %@ from queue %@. Loading count = %ld of %ld", request, self, (long) self.loadingCount, (long) _concurrentRequestsLimit);
if ([_delegate respondsToSelector:@selector(requestQueue:didSendRequest:)]) { if ([_delegate respondsToSelector:@selector(requestQueue:didSendRequest:)]) {
[_delegate requestQueue:self didSendRequest:request]; [_delegate requestQueue:self didSendRequest:request];
@@ -349,7 +349,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
if (decrementCounter) { if (decrementCounter) {
NSAssert(self.loadingCount > 0, @"Attempted to decrement loading count below zero"); NSAssert(self.loadingCount > 0, @"Attempted to decrement loading count below zero");
self.loadingCount = self.loadingCount - 1; self.loadingCount = self.loadingCount - 1;
RKLogTrace(@"Decremented the loading count to %d", self.loadingCount); RKLogTrace(@"Decremented the loading count to %ld", (long) self.loadingCount);
} }
return YES; return YES;
} }
@@ -440,7 +440,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
if ([notification.name isEqualToString:RKRequestDidLoadResponseNotification]) { if ([notification.name isEqualToString:RKRequestDidLoadResponseNotification]) {
// We successfully loaded a response // We successfully loaded a response
RKLogDebug(@"Received response for request %@, removing from queue. (Now loading %d of %d)", request, _loadingCount, _concurrentRequestsLimit); RKLogDebug(@"Received response for request %@, removing from queue. (Now loading %lu of %lu)", request, (unsigned long) _loadingCount, (unsigned long) _concurrentRequestsLimit);
RKResponse* response = [userInfo objectForKey:RKRequestDidLoadResponseNotificationUserInfoResponseKey]; RKResponse* response = [userInfo objectForKey:RKRequestDidLoadResponseNotificationUserInfoResponseKey];
if ([_delegate respondsToSelector:@selector(requestQueue:didLoadResponse:)]) { if ([_delegate respondsToSelector:@selector(requestQueue:didLoadResponse:)]) {
@@ -451,8 +451,8 @@ static const NSTimeInterval kFlushDelay = 0.3;
NSError* error = nil; NSError* error = nil;
if (userInfo) { if (userInfo) {
error = [userInfo objectForKey:RKRequestDidFailWithErrorNotificationUserInfoErrorKey]; error = [userInfo objectForKey:RKRequestDidFailWithErrorNotificationUserInfoErrorKey];
RKLogDebug(@"Request %@ failed loading in queue %@ with error: %@.(Now loading %d of %d)", request, self, RKLogDebug(@"Request %@ failed loading in queue %@ with error: %@.(Now loading %ld of %ld)", request, self,
[error localizedDescription], _loadingCount, _concurrentRequestsLimit); [error localizedDescription], (long) _loadingCount, (long) _concurrentRequestsLimit);
} else { } else {
RKLogWarning(@"Received RKRequestDidFailWithErrorNotification without a userInfo, something is amiss..."); RKLogWarning(@"Received RKRequestDidFailWithErrorNotification without a userInfo, something is amiss...");
} }

View File

@@ -151,7 +151,7 @@ extern NSString* cacheURLKey;
[[challenge sender] useCredential:newCredential [[challenge sender] useCredential:newCredential
forAuthenticationChallenge:challenge]; forAuthenticationChallenge:challenge];
} else { } else {
RKLogWarning(@"Failed authentication challenge after %d failures", [challenge previousFailureCount]); RKLogWarning(@"Failed authentication challenge after %ld failures", (long) [challenge previousFailureCount]);
[[challenge sender] cancelAuthenticationChallenge:challenge]; [[challenge sender] cancelAuthenticationChallenge:challenge];
} }
} }
@@ -186,7 +186,7 @@ extern NSString* cacheURLKey;
} }
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response { - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response {
RKLogDebug(@"NSHTTPURLResponse Status Code: %d", [response statusCode]); RKLogDebug(@"NSHTTPURLResponse Status Code: %ld", (long) [response statusCode]);
RKLogDebug(@"Headers: %@", [response allHeaderFields]); RKLogDebug(@"Headers: %@", [response allHeaderFields]);
_httpURLResponse = [response retain]; _httpURLResponse = [response retain];
} }

View File

@@ -260,7 +260,7 @@
return NO; return NO;
} else if (NO == [self canParseMIMEType:[self.response MIMEType]]) { } else if (NO == [self canParseMIMEType:[self.response MIMEType]]) {
// We can't parse the response, it's unmappable regardless of the status code // We can't parse the response, it's unmappable regardless of the status code
RKLogWarning(@"Encountered unexpected response with status code: %d (MIME Type: %@)", self.response.statusCode, self.response.MIMEType); RKLogWarning(@"Encountered unexpected response with status code: %ld (MIME Type: %@)", (long) self.response.statusCode, self.response.MIMEType);
NSError* error = [NSError errorWithDomain:RKRestKitErrorDomain code:RKObjectLoaderUnexpectedResponseError userInfo:nil]; NSError* error = [NSError errorWithDomain:RKRestKitErrorDomain code:RKObjectLoaderUnexpectedResponseError userInfo:nil];
if ([_delegate respondsToSelector:@selector(objectLoaderDidLoadUnexpectedResponse:)]) { if ([_delegate respondsToSelector:@selector(objectLoaderDidLoadUnexpectedResponse:)]) {
[(NSObject<RKObjectLoaderDelegate>*)_delegate objectLoaderDidLoadUnexpectedResponse:self]; [(NSObject<RKObjectLoaderDelegate>*)_delegate objectLoaderDidLoadUnexpectedResponse:self];

View File

@@ -81,9 +81,13 @@
/** /**
Create a new mapping operation configured to transform the object representation Create a new mapping operation configured to transform the object representation
in a source object to a new destination object according to an object mapping definition in a source object to a new destination object according to an object mapping definition.
Note that if Core Data support is available, an instance of RKManagedObjectMappingOperation may be returned
@return An instance of RKObjectMappingOperation or RKManagedObjectMappingOperation for performing the mapping
*/ */
+ (RKObjectMappingOperation*)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(id<RKObjectMappingDefinition>)mapping; + (id)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(id<RKObjectMappingDefinition>)mapping;
/** /**
Initialize a mapping operation for an object and set of data at a particular key path with an object mapping definition Initialize a mapping operation for an object and set of data at a particular key path with an object mapping definition

View File

@@ -70,8 +70,12 @@ BOOL RKObjectIsValueEqualToValue(id sourceValue, id destinationValue) {
@synthesize delegate = _delegate; @synthesize delegate = _delegate;
@synthesize queue = _queue; @synthesize queue = _queue;
+ (RKObjectMappingOperation*)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(id<RKObjectMappingDefinition>)objectMapping { + (id)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(id<RKObjectMappingDefinition>)objectMapping {
return [[[self alloc] initWithSourceObject:sourceObject destinationObject:destinationObject mapping:objectMapping] autorelease]; // Check for availability of ManagedObjectMappingOperation. Better approach for handling?
Class targetClass = NSClassFromString(@"RKManagedObjectMappingOperation");
if (targetClass == nil) targetClass = [RKObjectMappingOperation class];
return [[[targetClass alloc] initWithSourceObject:sourceObject destinationObject:destinationObject mapping:objectMapping] autorelease];
} }
- (id)initWithSourceObject:(id)sourceObject destinationObject:(id)destinationObject mapping:(id<RKObjectMappingDefinition>)objectMapping { - (id)initWithSourceObject:(id)sourceObject destinationObject:(id)destinationObject mapping:(id<RKObjectMappingDefinition>)objectMapping {

View File

@@ -69,7 +69,7 @@
return nil; return nil;
} }
if (count > 1) RKLogWarning(@"Coerced object mapping result containing %d objects into singular result.", count); if (count > 1) RKLogWarning(@"Coerced object mapping result containing %lu objects into singular result.", (unsigned long) count);
return [collection objectAtIndex:0]; return [collection objectAtIndex:0];
} }

View File

@@ -123,7 +123,7 @@
} }
/* Parse the string. */ /* Parse the string. */
const char* buffer = [xml cStringUsingEncoding:NSUTF8StringEncoding]; const char* buffer = [xml cStringUsingEncoding:NSUTF8StringEncoding];
doc = xmlParseMemory(buffer, strlen(buffer)); doc = xmlParseMemory(buffer, (int) strlen(buffer));
/* check if parsing suceeded */ /* check if parsing suceeded */
if (doc == NULL) { if (doc == NULL) {

View File

@@ -359,7 +359,7 @@ NSString* kTemporaryBackslashToken = @"/backslash/";
NSString* value = [values objectAtIndex:ix]; NSString* value = [values objectAtIndex:ix];
char argType[4]; char argType[4];
method_getArgumentType(method, ix + 2, argType, sizeof(argType) / sizeof(argType[0])); method_getArgumentType(method, (unsigned int) ix + 2, argType, sizeof(argType) / sizeof(argType[0]));
SOCArgumentType type = SOCArgumentTypeForTypeAsChar(argType[0]); SOCArgumentType type = SOCArgumentTypeForTypeAsChar(argType[0]);
[self setArgument:value withType:type atIndex:ix forInvocation:invocation]; [self setArgument:value withType:type atIndex:ix forInvocation:invocation];