diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 16:03:44 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 16:03:44 +0000 |
commit | 5849bc7c3056c81153d5831e6834de15f2567132 (patch) | |
tree | a5addd401c705a5bb7b4f1e7d240996d6ac356d8 /third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m | |
parent | 14e5bca82b5ac6f0a2b59d087d3f38e19017c127 (diff) | |
download | chromium_src-5849bc7c3056c81153d5831e6834de15f2567132.zip chromium_src-5849bc7c3056c81153d5831e6834de15f2567132.tar.gz chromium_src-5849bc7c3056c81153d5831e6834de15f2567132.tar.bz2 |
Roll OCMock r54:55 to pull in some memory and warning fixes.
BUG=32564
TEST=Trybots
Review URL: http://codereview.chromium.org/554030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m')
-rw-r--r-- | third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m b/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m index fa0e483..7d0b68c 100644 --- a/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m +++ b/third_party/ocmock/OCMock/NSInvocation+OCMAdditions.m @@ -1,5 +1,5 @@ //--------------------------------------------------------------------------------------- -// $Id: NSInvocation+OCMAdditions.m 50 2009-07-16 06:48:19Z erik $ +// $Id: NSInvocation+OCMAdditions.m 55 2009-10-16 06:42:18Z erik $ // Copyright (c) 2006-2009 by Mulle Kybernetik. See License file for details. //--------------------------------------------------------------------------------------- @@ -8,11 +8,11 @@ @implementation NSInvocation(OCMAdditions) -- (id)getArgumentAtIndexAsObject:(int)index +- (id)getArgumentAtIndexAsObject:(int)argIndex { const char* argType; - argType = [[self methodSignature] getArgumentTypeAtIndex:index]; + argType = [[self methodSignature] getArgumentTypeAtIndex:argIndex]; while(strchr("rnNoORV", argType[0]) != NULL) argType += 1; @@ -25,105 +25,105 @@ case '@': { id value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return value; } case ':': { SEL s = (SEL)0; - [self getArgument:&s atIndex:index]; + [self getArgument:&s atIndex:argIndex]; id value = NSStringFromSelector(s); return value; } case 'i': { int value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithInt:value]; } case 's': { short value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithShort:value]; } case 'l': { long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithLong:value]; } case 'q': { long long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithLongLong:value]; } case 'c': { char value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithChar:value]; } case 'C': { unsigned char value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedChar:value]; } case 'I': { unsigned int value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedInt:value]; } case 'S': { unsigned short value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedShort:value]; } case 'L': { unsigned long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedLong:value]; } case 'Q': { unsigned long long value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithUnsignedLongLong:value]; } case 'f': { float value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithFloat:value]; } case 'd': { double value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithDouble:value]; } case 'B': { bool value; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSNumber numberWithBool:value]; } case '^': { void *value = NULL; - [self getArgument:&value atIndex:index]; + [self getArgument:&value atIndex:argIndex]; return [NSValue valueWithPointer:value]; } case '{': // structure { - unsigned maxSize = [[self methodSignature] frameLength]; - NSMutableData *argumentData = [[[NSMutableData alloc] initWithLength:maxSize] autorelease]; - [self getArgument:[argumentData mutableBytes] atIndex:index]; + unsigned maxArgSize = [[self methodSignature] frameLength]; + NSMutableData *argumentData = [[[NSMutableData alloc] initWithLength:maxArgSize] autorelease]; + [self getArgument:[argumentData mutableBytes] atIndex:argIndex]; return [NSValue valueWithBytes:[argumentData bytes] objCType:argType]; } @@ -152,32 +152,32 @@ return [description autorelease]; } -- (NSString *)argumentDescriptionAtIndex:(int)index +- (NSString *)argumentDescriptionAtIndex:(int)argIndex { - const char *argType = [[self methodSignature] getArgumentTypeAtIndex:index]; + const char *argType = [[self methodSignature] getArgumentTypeAtIndex:argIndex]; if(strchr("rnNoORV", argType[0]) != NULL) argType += 1; switch(*argType) { - case '@': return [self objectDescriptionAtIndex:index]; - case 'c': return [self charDescriptionAtIndex:index]; - case 'C': return [self unsignedCharDescriptionAtIndex:index]; - case 'i': return [self intDescriptionAtIndex:index]; - case 'I': return [self unsignedIntDescriptionAtIndex:index]; - case 's': return [self shortDescriptionAtIndex:index]; - case 'S': return [self unsignedShortDescriptionAtIndex:index]; - case 'l': return [self longDescriptionAtIndex:index]; - case 'L': return [self unsignedLongDescriptionAtIndex:index]; - case 'q': return [self longLongDescriptionAtIndex:index]; - case 'Q': return [self unsignedLongLongDescriptionAtIndex:index]; - case 'd': return [self doubleDescriptionAtIndex:index]; - case 'f': return [self floatDescriptionAtIndex:index]; + case '@': return [self objectDescriptionAtIndex:argIndex]; + case 'c': return [self charDescriptionAtIndex:argIndex]; + case 'C': return [self unsignedCharDescriptionAtIndex:argIndex]; + case 'i': return [self intDescriptionAtIndex:argIndex]; + case 'I': return [self unsignedIntDescriptionAtIndex:argIndex]; + case 's': return [self shortDescriptionAtIndex:argIndex]; + case 'S': return [self unsignedShortDescriptionAtIndex:argIndex]; + case 'l': return [self longDescriptionAtIndex:argIndex]; + case 'L': return [self unsignedLongDescriptionAtIndex:argIndex]; + case 'q': return [self longLongDescriptionAtIndex:argIndex]; + case 'Q': return [self unsignedLongLongDescriptionAtIndex:argIndex]; + case 'd': return [self doubleDescriptionAtIndex:argIndex]; + case 'f': return [self floatDescriptionAtIndex:argIndex]; // Why does this throw EXC_BAD_ACCESS when appending the string? // case NSObjCStructType: return [self structDescriptionAtIndex:index]; - case '^': return [self pointerDescriptionAtIndex:index]; - case '*': return [self cStringDescriptionAtIndex:index]; - case ':': return [self selectorDescriptionAtIndex:index]; + case '^': return [self pointerDescriptionAtIndex:argIndex]; + case '*': return [self cStringDescriptionAtIndex:argIndex]; + case ':': return [self selectorDescriptionAtIndex:argIndex]; default: return [@"<??" stringByAppendingString:@">"]; // avoid confusion with trigraphs... } @@ -191,7 +191,7 @@ [self getArgument:&object atIndex:anInt]; if (object == nil) return @"nil"; - else if([object isKindOfClass:[NSString class]]) + else if(![object isProxy] && [object isKindOfClass:[NSString class]]) return [NSString stringWithFormat:@"@\"%@\"", [object description]]; else return [object description]; |