Skip to content

Commit

Permalink
Fixed all build warnings on OS X Framework target
Browse files Browse the repository at this point in the history
  • Loading branch information
blakewatters committed Dec 9, 2011
1 parent ec13fb0 commit 4798649
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 49 deletions.
4 changes: 2 additions & 2 deletions Code/CoreData/NSManagedObject+ActiveRecord.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ + (void)setDefaultBatchSize:(NSUInteger)newBatchSize
{
@synchronized(defaultBatchSize)
{
defaultBatchSize = [NSNumber numberWithInt:newBatchSize];
defaultBatchSize = [NSNumber numberWithUnsignedInteger:newBatchSize];
}
}

Expand Down Expand Up @@ -325,7 +325,7 @@ + (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm inContext:
NSUInteger count = [context countForFetchRequest:request error:&error];
[self handleErrors:error];

return [NSNumber numberWithUnsignedInt:count];
return [NSNumber numberWithUnsignedInteger:count];
}

+ (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm;
Expand Down
20 changes: 0 additions & 20 deletions Code/CoreData/RKManagedObjectMappingOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@
#undef RKLogComponent
#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

// TODO: Move this to a better home to take exposure out of the mapper
Expand Down
2 changes: 1 addition & 1 deletion Code/CoreData/RKManagedObjectSeeder.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ - (void)seedObjectsFromFile:(NSString *)fileName withObjectMapping:(RKObjectMapp
}
}

RKLogInfo(@"Seeded %d objects from %@...", [mappedObjects count], [NSString stringWithFormat:@"%@", fileName]);
RKLogInfo(@"Seeded %lu objects from %@...", (unsigned long) [mappedObjects count], [NSString stringWithFormat:@"%@", fileName]);
} else {
RKLogError(@"Unable to read file %@: %@", fileName, [error localizedDescription]);
}
Expand Down
2 changes: 1 addition & 1 deletion Code/CoreData/RKManagedObjectStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ - (NSManagedObject*)findOrCreateInstanceOfEntity:(NSEntityDescription*)entity wi
[fetchRequest setEntity:entity];
[fetchRequest setReturnsObjectsAsFaults:NO];
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];
BOOL coerceToString = [[[objects lastObject] valueForKey:primaryKeyAttribute] respondsToSelector:@selector(stringValue)];
for (id theObject in objects) {
Expand Down
2 changes: 1 addition & 1 deletion Code/CoreData/RKManagedObjectThreadSafeInvocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (void)setManagedObjectKeyPaths:(NSSet*)keyPaths forArgument:(NSInteger)index {
_argumentKeyPaths = [[NSMutableDictionary alloc] init];
}

NSNumber* argumentIndex = [NSNumber numberWithInt:index];
NSNumber* argumentIndex = [NSNumber numberWithInteger:index];
[_argumentKeyPaths setObject:keyPaths forKey:argumentIndex];
}

Expand Down
4 changes: 2 additions & 2 deletions Code/Network/NSData+MD5.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

@implementation NSData (MD5)

- (NSString*)MD5 {
- (NSString *)MD5 {
// Create byte array of unsigned chars
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];

// 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
NSMutableString* output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
Expand Down
2 changes: 1 addition & 1 deletion Code/Network/NSString+MD5.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (NSString*)MD5 {
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];

// 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
NSMutableString* output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
Expand Down
2 changes: 1 addition & 1 deletion Code/Network/RKRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ - (void)didFinishLoad:(RKResponse*)response {
_isLoading = NO;
_isLoaded = YES;

RKLogInfo(@"Status Code: %d", [response statusCode]);
RKLogInfo(@"Status Code: %ld", (long) [response statusCode]);
RKLogInfo(@"Body: %@", [response bodyAsString]);

RKResponse* finalResponse = response;
Expand Down
2 changes: 1 addition & 1 deletion Code/Network/RKRequestCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (void)storeResponse:(RKResponse*)response forRequest:(RKRequest*)request {
[headers setObject:[[RKRequestCache rfc1123DateFormatter] stringFromDate:[NSDate date]]
forKey:cacheDateHeaderKey];
// Cache status code
[headers setObject:[NSNumber numberWithInt:urlResponse.statusCode]
[headers setObject:[NSNumber numberWithInteger:urlResponse.statusCode]
forKey:cacheResponseCodeKey];
// Cache MIME Type
[headers setObject:urlResponse.MIMEType
Expand Down
18 changes: 9 additions & 9 deletions Code/Network/RKRequestQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ - (NSString*)description {

- (void)setLoadingCount:(NSUInteger)count {
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
if ([_delegate respondsToSelector:@selector(requestQueueDidBeginLoading:)]) {
Expand All @@ -199,7 +199,7 @@ - (void)setLoadingCount:(NSUInteger)count {
}
#endif
} 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
if ([_delegate respondsToSelector:@selector(requestQueueDidFinishLoading:)]) {
Expand All @@ -213,7 +213,7 @@ - (void)setLoadingCount:(NSUInteger)count {
#endif
}

RKLogTrace(@"Loading count set to %d for queue %@", count, self);
RKLogTrace(@"Loading count set to %ld for queue %@", (long) count, self);
_loadingCount = count;
}

Expand Down Expand Up @@ -268,8 +268,8 @@ - (void)loadNextInQueue {
}

self.loadingCount = self.loadingCount + 1;
[request sendAsynchronously];
RKLogDebug(@"Sent request %@ from queue %@. Loading count = %d of %d", request, self, self.loadingCount, _concurrentRequestsLimit);
[request sendAsynchronously];
RKLogDebug(@"Sent request %@ from queue %@. Loading count = %ld of %ld", request, self, (long) self.loadingCount, (long) _concurrentRequestsLimit);

if ([_delegate respondsToSelector:@selector(requestQueue:didSendRequest:)]) {
[_delegate requestQueue:self didSendRequest:request];
Expand Down Expand Up @@ -349,7 +349,7 @@ - (BOOL)removeRequest:(RKRequest*)request decrementCounter:(BOOL)decrementCounte
if (decrementCounter) {
NSAssert(self.loadingCount > 0, @"Attempted to decrement loading count below zero");
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;
}
Expand Down Expand Up @@ -440,7 +440,7 @@ - (void)requestFinishedWithNotification:(NSNotification*)notification {

if ([notification.name isEqualToString:RKRequestDidLoadResponseNotification]) {
// 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];
if ([_delegate respondsToSelector:@selector(requestQueue:didLoadResponse:)]) {
Expand All @@ -451,8 +451,8 @@ - (void)requestFinishedWithNotification:(NSNotification*)notification {
NSError* error = nil;
if (userInfo) {
error = [userInfo objectForKey:RKRequestDidFailWithErrorNotificationUserInfoErrorKey];
RKLogDebug(@"Request %@ failed loading in queue %@ with error: %@.(Now loading %d of %d)", request, self,
[error localizedDescription], _loadingCount, _concurrentRequestsLimit);
RKLogDebug(@"Request %@ failed loading in queue %@ with error: %@.(Now loading %ld of %ld)", request, self,
[error localizedDescription], (long) _loadingCount, (long) _concurrentRequestsLimit);
} else {
RKLogWarning(@"Received RKRequestDidFailWithErrorNotification without a userInfo, something is amiss...");
}
Expand Down
4 changes: 2 additions & 2 deletions Code/Network/RKResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallen
[[challenge sender] useCredential:newCredential
forAuthenticationChallenge:challenge];
} else {
RKLogWarning(@"Failed authentication challenge after %d failures", [challenge previousFailureCount]);
RKLogWarning(@"Failed authentication challenge after %ld failures", (long) [challenge previousFailureCount]);
[[challenge sender] cancelAuthenticationChallenge:challenge];
}
}
Expand Down Expand Up @@ -186,7 +186,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
}

- (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]);
_httpURLResponse = [response retain];
}
Expand Down
2 changes: 1 addition & 1 deletion Code/ObjectMapping/RKObjectLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ - (BOOL)isResponseMappable {
return NO;
} else if (NO == [self canParseMIMEType:[self.response MIMEType]]) {
// 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];
if ([_delegate respondsToSelector:@selector(objectLoaderDidLoadUnexpectedResponse:)]) {
[(NSObject<RKObjectLoaderDelegate>*)_delegate objectLoaderDidLoadUnexpectedResponse:self];
Expand Down
8 changes: 6 additions & 2 deletions Code/ObjectMapping/RKObjectMappingOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@

/**
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
Expand Down
8 changes: 6 additions & 2 deletions Code/ObjectMapping/RKObjectMappingOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ @implementation RKObjectMappingOperation
@synthesize delegate = _delegate;
@synthesize queue = _queue;

+ (RKObjectMappingOperation*)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(id<RKObjectMappingDefinition>)objectMapping {
return [[[self alloc] initWithSourceObject:sourceObject destinationObject:destinationObject mapping:objectMapping] autorelease];
+ (id)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(id<RKObjectMappingDefinition>)objectMapping {
// 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 {
Expand Down
2 changes: 1 addition & 1 deletion Code/ObjectMapping/RKObjectMappingResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (id)asObject {
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];
}

Expand Down
2 changes: 1 addition & 1 deletion Code/Support/Parsers/XML/RKXMLParserLibXML.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (NSDictionary*)parseXML:(NSString*)xml {
}
/* Parse the string. */
const char* buffer = [xml cStringUsingEncoding:NSUTF8StringEncoding];
doc = xmlParseMemory(buffer, strlen(buffer));
doc = xmlParseMemory(buffer, (int) strlen(buffer));

/* check if parsing suceeded */
if (doc == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion Vendor/SOCKit/SOCKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ - (void)setArgumentsFromValues:(NSArray *)values forInvocation:(NSInvocation *)i
NSString* value = [values objectAtIndex:ix];

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]);

[self setArgument:value withType:type atIndex:ix forInvocation:invocation];
Expand Down

0 comments on commit 4798649

Please sign in to comment.