Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m

Issue 9240023: Roll OCMock r77:7f521db0628086185123666b0979e48d6ecaeac1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 //------------------------------------------------------------------------------ --------- 1 //------------------------------------------------------------------------------ ---------
2 // $Id: NSInvocation+OCMAdditions.m 67 2010-08-02 03:25:16Z erik $ 2 // $Id$
3 // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details. 3 // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details.
4 //------------------------------------------------------------------------------ --------- 4 //------------------------------------------------------------------------------ ---------
5 5
6 #import "NSInvocation+OCMAdditions.h" 6 #import "NSInvocation+OCMAdditions.h"
7 7
8 8
9 @implementation NSInvocation(OCMAdditions) 9 @implementation NSInvocation(OCMAdditions)
10 10
11 - (id)getArgumentAtIndexAsObject:(int)argIndex 11 - (id)getArgumentAtIndexAsObject:(int)argIndex
12 { 12 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return [NSNumber numberWithBool:value]; 114 return [NSNumber numberWithBool:value];
115 } 115 }
116 case '^': 116 case '^':
117 { 117 {
118 void *value = NULL; 118 void *value = NULL;
119 [self getArgument:&value atIndex:argIndex]; 119 [self getArgument:&value atIndex:argIndex];
120 return [NSValue valueWithPointer:value]; 120 return [NSValue valueWithPointer:value];
121 } 121 }
122 case '{': // structure 122 case '{': // structure
123 { 123 {
124 » » » unsigned maxArgSize = [[self methodSignature] frameLengt h]; 124 » » » NSUInteger maxArgSize = [[self methodSignature] frameLen gth];
125 NSMutableData *argumentData = [[[NSMutableData alloc] in itWithLength:maxArgSize] autorelease]; 125 NSMutableData *argumentData = [[[NSMutableData alloc] in itWithLength:maxArgSize] autorelease];
126 [self getArgument:[argumentData mutableBytes] atIndex:ar gIndex]; 126 [self getArgument:[argumentData mutableBytes] atIndex:ar gIndex];
127 return [NSValue valueWithBytes:[argumentData bytes] objC Type:argType]; 127 return [NSValue valueWithBytes:[argumentData bytes] objC Type:argType];
128 } 128 }
129 129
130 } 130 }
131 [NSException raise:NSInvalidArgumentException format:@"Argument type '%s ' not supported", argType]; 131 [NSException raise:NSInvalidArgumentException format:@"Argument type '%s ' not supported", argType];
132 return nil; 132 return nil;
133 } 133 }
134 134
135 - (NSString *)invocationDescription 135 - (NSString *)invocationDescription
136 { 136 {
137 NSMethodSignature *methodSignature = [self methodSignature]; 137 NSMethodSignature *methodSignature = [self methodSignature];
138 » unsigned int numberOfArgs = [methodSignature numberOfArguments]; 138 » NSUInteger numberOfArgs = [methodSignature numberOfArguments];
139 139
140 if (numberOfArgs == 2) 140 if (numberOfArgs == 2)
141 return NSStringFromSelector([self selector]); 141 return NSStringFromSelector([self selector]);
142 142
143 NSArray *selectorParts = [NSStringFromSelector([self selector]) componen tsSeparatedByString:@":"]; 143 NSArray *selectorParts = [NSStringFromSelector([self selector]) componen tsSeparatedByString:@":"];
144 NSMutableString *description = [[NSMutableString alloc] init]; 144 NSMutableString *description = [[NSMutableString alloc] init];
145 » int i; 145 » unsigned int i;
146 for(i = 2; i < numberOfArgs; i++) 146 for(i = 2; i < numberOfArgs; i++)
147 { 147 {
148 [description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), [selec torParts objectAtIndex:(i - 2)]]; 148 [description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), [selec torParts objectAtIndex:(i - 2)]];
149 [description appendString:[self argumentDescriptionAtIndex:i]]; 149 [description appendString:[self argumentDescriptionAtIndex:i]];
150 } 150 }
151 151
152 return [description autorelease]; 152 return [description autorelease];
153 } 153 }
154 154
155 - (NSString *)argumentDescriptionAtIndex:(int)argIndex 155 - (NSString *)argumentDescriptionAtIndex:(int)argIndex
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 - (NSString *)selectorDescriptionAtIndex:(int)anInt 329 - (NSString *)selectorDescriptionAtIndex:(int)anInt
330 { 330 {
331 SEL selectorValue; 331 SEL selectorValue;
332 332
333 [self getArgument:&selectorValue atIndex:anInt]; 333 [self getArgument:&selectorValue atIndex:anInt];
334 return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector (selectorValue)]; 334 return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector (selectorValue)];
335 } 335 }
336 336
337 @end 337 @end
OLDNEW
« no previous file with comments | « third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h ('k') | third_party/ocmock/OCMock/NSInvocationOCMAdditionsTests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698