mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-06 17:32:52 +08:00
Ensure the stars for all pointers belong to the variable rather than the type. Refs #614
This commit is contained in:
@@ -139,11 +139,11 @@
|
||||
}
|
||||
|
||||
// Invoked on the main thread. Inform the delegate.
|
||||
- (void)informDelegateOfObjectLoadWithResultDictionary:(NSDictionary*)resultDictionary
|
||||
- (void)informDelegateOfObjectLoadWithResultDictionary:(NSDictionary *)resultDictionary
|
||||
{
|
||||
NSAssert([NSThread isMainThread], @"RKObjectLoaderDelegate callbacks must occur on the main thread");
|
||||
|
||||
RKObjectMappingResult* result = [RKObjectMappingResult mappingResultWithDictionary:resultDictionary];
|
||||
RKObjectMappingResult *result = [RKObjectMappingResult mappingResultWithDictionary:resultDictionary];
|
||||
|
||||
// Dictionary callback
|
||||
if ([self.delegate respondsToSelector:@selector(objectLoader:didLoadObjectDictionary:)]) {
|
||||
@@ -182,7 +182,7 @@
|
||||
at thread boundaries.
|
||||
@protected
|
||||
*/
|
||||
- (void)processMappingResult:(RKObjectMappingResult*)result
|
||||
- (void)processMappingResult:(RKObjectMappingResult *)result
|
||||
{
|
||||
NSAssert(_sentSynchronously || ![NSThread isMainThread], @"Mapping result processing should occur on a background thread");
|
||||
[self performSelectorOnMainThread:@selector(informDelegateOfObjectLoadWithResultDictionary:) withObject:[result asDictionary] waitUntilDone:YES];
|
||||
@@ -190,7 +190,7 @@
|
||||
|
||||
#pragma mark - Response Object Mapping
|
||||
|
||||
- (RKObjectMappingResult*)mapResponseWithMappingProvider:(RKObjectMappingProvider*)mappingProvider toObject:(id)targetObject inContext:(RKObjectMappingProviderContext)context error:(NSError**)error
|
||||
- (RKObjectMappingResult *)mapResponseWithMappingProvider:(RKObjectMappingProvider *)mappingProvider toObject:(id)targetObject inContext:(RKObjectMappingProviderContext)context error:(NSError **)error
|
||||
{
|
||||
id<RKParser> parser = [[RKParserRegistry sharedRegistry] parserForMIMEType:self.response.MIMEType];
|
||||
NSAssert1(parser, @"Cannot perform object load without a parser for MIME Type '%@'", self.response.MIMEType);
|
||||
@@ -220,11 +220,11 @@
|
||||
[(NSObject<RKObjectLoaderDelegate>*)self.delegate objectLoader:self willMapData:&parsedData];
|
||||
}
|
||||
|
||||
RKObjectMapper* mapper = [RKObjectMapper mapperWithObject:parsedData mappingProvider:mappingProvider];
|
||||
RKObjectMapper *mapper = [RKObjectMapper mapperWithObject:parsedData mappingProvider:mappingProvider];
|
||||
mapper.targetObject = targetObject;
|
||||
mapper.delegate = self;
|
||||
mapper.context = context;
|
||||
RKObjectMappingResult* result = [mapper performMapping];
|
||||
RKObjectMappingResult *result = [mapper performMapping];
|
||||
|
||||
// Log any mapping errors
|
||||
if (mapper.errorCount > 0) {
|
||||
@@ -250,11 +250,11 @@
|
||||
return [self.mappingProvider objectMappingForResourcePath:self.resourcePath];
|
||||
}
|
||||
|
||||
- (RKObjectMappingResult*)performMapping:(NSError**)error
|
||||
- (RKObjectMappingResult *)performMapping:(NSError **)error
|
||||
{
|
||||
NSAssert(_sentSynchronously || ![NSThread isMainThread], @"Mapping should occur on a background thread");
|
||||
|
||||
RKObjectMappingProvider* mappingProvider;
|
||||
RKObjectMappingProvider *mappingProvider;
|
||||
RKObjectMappingDefinition *configuredObjectMapping = [self configuredObjectMapping];
|
||||
if (configuredObjectMapping) {
|
||||
mappingProvider = [RKObjectMappingProvider mappingProvider];
|
||||
@@ -275,7 +275,7 @@
|
||||
{
|
||||
NSAssert(self.mappingQueue, @"mappingQueue cannot be nil");
|
||||
dispatch_async(self.mappingQueue, ^{
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
RKLogDebug(@"Beginning object mapping activities within GCD queue labeled: %s", dispatch_queue_get_label(self.mappingQueue));
|
||||
NSError *error = nil;
|
||||
@@ -291,7 +291,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (BOOL)canParseMIMEType:(NSString*)MIMEType
|
||||
- (BOOL)canParseMIMEType:(NSString *)MIMEType
|
||||
{
|
||||
if ([[RKParserRegistry sharedRegistry] parserForMIMEType:self.response.MIMEType]) {
|
||||
return YES;
|
||||
@@ -327,7 +327,7 @@
|
||||
} 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: %ld (MIME Type: %@ -> URL: %@)", (long) self.response.statusCode, self.response.MIMEType, self.URL);
|
||||
NSError* error = [NSError errorWithDomain:RKErrorDomain code:RKObjectLoaderUnexpectedResponseError userInfo:nil];
|
||||
NSError *error = [NSError errorWithDomain:RKErrorDomain code:RKObjectLoaderUnexpectedResponseError userInfo:nil];
|
||||
if ([_delegate respondsToSelector:@selector(objectLoaderDidLoadUnexpectedResponse:)]) {
|
||||
[(NSObject<RKObjectLoaderDelegate>*)_delegate objectLoaderDidLoadUnexpectedResponse:self];
|
||||
} else {
|
||||
@@ -372,8 +372,8 @@
|
||||
if ((self.sourceObject && self.params == nil) && (self.method == RKRequestMethodPOST || self.method == RKRequestMethodPUT)) {
|
||||
NSAssert(self.serializationMapping, @"You must provide a serialization mapping for objects of type '%@'", NSStringFromClass([self.sourceObject class]));
|
||||
RKLogDebug(@"POST or PUT request for source object %@, serializing to MIME Type %@ for transport...", self.sourceObject, self.serializationMIMEType);
|
||||
RKObjectSerializer* serializer = [RKObjectSerializer serializerWithObject:self.sourceObject mapping:self.serializationMapping];
|
||||
NSError* error = nil;
|
||||
RKObjectSerializer *serializer = [RKObjectSerializer serializerWithObject:self.sourceObject mapping:self.serializationMapping];
|
||||
NSError *error = nil;
|
||||
id params = [serializer serializationForMIMEType:self.serializationMIMEType error:&error];
|
||||
|
||||
if (error) {
|
||||
@@ -402,7 +402,7 @@
|
||||
- (void)didFailLoadWithError:(NSError *)error
|
||||
{
|
||||
NSParameterAssert(error);
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
if (_cachePolicy & RKRequestCachePolicyLoadOnError &&
|
||||
[self.cache hasResponseForRequest:self]) {
|
||||
@@ -419,7 +419,7 @@
|
||||
|
||||
// If we failed due to a transport error or before we have a response, the request itself failed
|
||||
if (!self.response || [self.response isFailure]) {
|
||||
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:error forKey:RKRequestDidFailWithErrorNotificationUserInfoErrorKey];
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:error forKey:RKRequestDidFailWithErrorNotificationUserInfoErrorKey];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RKRequestDidFailWithErrorNotification
|
||||
object:self
|
||||
userInfo:userInfo];
|
||||
@@ -436,7 +436,7 @@
|
||||
}
|
||||
|
||||
// NOTE: We do NOT call super here. We are overloading the default behavior from RKRequest
|
||||
- (void)didFinishLoad:(RKResponse*)response
|
||||
- (void)didFinishLoad:(RKResponse *)response
|
||||
{
|
||||
NSAssert([NSThread isMainThread], @"RKObjectLoaderDelegate callbacks must occur on the main thread");
|
||||
self.response = response;
|
||||
@@ -460,7 +460,7 @@
|
||||
}
|
||||
|
||||
// Post the notification
|
||||
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:self.response
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:self.response
|
||||
forKey:RKRequestDidLoadResponseNotificationUserInfoResponseKey];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RKRequestDidLoadResponseNotification
|
||||
object:self
|
||||
@@ -469,7 +469,7 @@
|
||||
if ([self isResponseMappable]) {
|
||||
// Determine if we are synchronous here or not.
|
||||
if (_sentSynchronously) {
|
||||
NSError* error = nil;
|
||||
NSError *error = nil;
|
||||
_result = [[self performMapping:&error] retain];
|
||||
if (self.result) {
|
||||
[self processMappingResult:self.result];
|
||||
@@ -511,12 +511,12 @@
|
||||
|
||||
@implementation RKObjectLoader (Deprecations)
|
||||
|
||||
+ (id)loaderWithResourcePath:(NSString*)resourcePath objectManager:(RKObjectManager*)objectManager delegate:(id<RKObjectLoaderDelegate>)delegate
|
||||
+ (id)loaderWithResourcePath:(NSString *)resourcePath objectManager:(RKObjectManager *)objectManager delegate:(id<RKObjectLoaderDelegate>)delegate
|
||||
{
|
||||
return [[[self alloc] initWithResourcePath:resourcePath objectManager:objectManager delegate:delegate] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithResourcePath:(NSString*)resourcePath objectManager:(RKObjectManager*)objectManager delegate:(id<RKObjectLoaderDelegate>)theDelegate
|
||||
- (id)initWithResourcePath:(NSString *)resourcePath objectManager:(RKObjectManager *)objectManager delegate:(id<RKObjectLoaderDelegate>)theDelegate
|
||||
{
|
||||
if ((self = [self initWithURL:[objectManager.baseURL URLByAppendingResourcePath:resourcePath] mappingProvider:objectManager.mappingProvider])) {
|
||||
[objectManager.client configureRequest:self];
|
||||
|
||||
Reference in New Issue
Block a user