mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 17:43:34 +08:00
Fixed all build warnings on OS X Framework target
This commit is contained in:
@@ -120,7 +120,7 @@ static NSNumber *defaultBatchSize = nil;
|
||||
{
|
||||
@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];
|
||||
[self handleErrors:error];
|
||||
|
||||
return [NSNumber numberWithUnsignedInt:count];
|
||||
return [NSNumber numberWithUnsignedInteger:count];
|
||||
}
|
||||
|
||||
+ (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
RKLogError(@"Unable to read file %@: %@", fileName, [error localizedDescription]);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ static NSString* const RKManagedObjectStoreThreadDictionaryEntityCacheKey = @"RK
|
||||
[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) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
_argumentKeyPaths = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
NSNumber* argumentIndex = [NSNumber numberWithInt:index];
|
||||
NSNumber* argumentIndex = [NSNumber numberWithInteger:index];
|
||||
[_argumentKeyPaths setObject:keyPaths forKey:argumentIndex];
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ RK_FIX_CATEGORY_BUG(NSData_MD5)
|
||||
|
||||
@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];
|
||||
|
||||
@@ -34,7 +34,7 @@ RK_FIX_CATEGORY_BUG(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];
|
||||
|
||||
@@ -559,7 +559,7 @@
|
||||
_isLoading = NO;
|
||||
_isLoaded = YES;
|
||||
|
||||
RKLogInfo(@"Status Code: %d", [response statusCode]);
|
||||
RKLogInfo(@"Status Code: %ld", (long) [response statusCode]);
|
||||
RKLogInfo(@"Body: %@", [response bodyAsString]);
|
||||
|
||||
RKResponse* finalResponse = response;
|
||||
|
||||
@@ -189,7 +189,7 @@ static NSDateFormatter* __rfc1123DateFormatter;
|
||||
[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
|
||||
|
||||
@@ -186,7 +186,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
|
||||
- (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:)]) {
|
||||
@@ -199,7 +199,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
}
|
||||
#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:)]) {
|
||||
@@ -213,7 +213,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
#endif
|
||||
}
|
||||
|
||||
RKLogTrace(@"Loading count set to %d for queue %@", count, self);
|
||||
RKLogTrace(@"Loading count set to %ld for queue %@", (long) count, self);
|
||||
_loadingCount = count;
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
}
|
||||
|
||||
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];
|
||||
@@ -349,7 +349,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
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;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
|
||||
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:)]) {
|
||||
@@ -451,8 +451,8 @@ static const NSTimeInterval kFlushDelay = 0.3;
|
||||
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...");
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ extern NSString* cacheURLKey;
|
||||
[[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];
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ extern NSString* cacheURLKey;
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -70,8 +70,12 @@ BOOL RKObjectIsValueEqualToValue(id sourceValue, id destinationValue) {
|
||||
@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 {
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
}
|
||||
/* 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) {
|
||||
|
||||
2
Vendor/SOCKit/SOCKit.m
vendored
2
Vendor/SOCKit/SOCKit.m
vendored
@@ -359,7 +359,7 @@ NSString* kTemporaryBackslashToken = @"/backslash/";
|
||||
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];
|
||||
|
||||
Reference in New Issue
Block a user