Skip to content

Remove extra whitespaces for whitespaces only lines #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions Source/OCMock/NSInvocation+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -224,78 +224,78 @@ - (id)getArgumentAtIndexAsObject:(NSInteger)argIndex
[self getArgument:&s atIndex:argIndex];
return [NSValue valueWithBytes:&s objCType:":"];
}
case 'i':
case 'i':
{
int value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 's':
{
short value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'l':
{
long value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'q':
{
long long value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'c':
{
char value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'C':
{
unsigned char value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'I':
{
unsigned int value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'S':
{
unsigned short value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'L':
{
unsigned long value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'Q':
{
unsigned long long value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'f':
{
float value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'd':
{
double value;
[self getArgument:&value atIndex:argIndex];
return @(value);
}
}
case 'D':
{
long double value;
Expand Down Expand Up @@ -324,8 +324,8 @@ - (id)getArgumentAtIndexAsObject:(NSInteger)argIndex
NSMutableData *argumentData = [[[NSMutableData alloc] initWithLength:argSize] autorelease];
[self getArgument:[argumentData mutableBytes] atIndex:argIndex];
return [NSValue valueWithBytes:[argumentData bytes] objCType:argType];
}
}

}
[NSException raise:NSInvalidArgumentException format:@"Argument type '%s' not supported", argType];
return nil;
Expand All @@ -335,10 +335,10 @@ - (NSString *)invocationDescription
{
NSMethodSignature *methodSignature = [self methodSignature];
NSUInteger numberOfArgs = [methodSignature numberOfArguments];

if (numberOfArgs == 2)
return NSStringFromSelector([self selector]);

NSArray *selectorParts = [NSStringFromSelector([self selector]) componentsSeparatedByString:@":"];
NSMutableString *description = [[NSMutableString alloc] init];
NSUInteger i;
Expand All @@ -347,7 +347,7 @@ - (NSString *)invocationDescription
[description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), [selectorParts objectAtIndex:(i - 2)]];
[description appendString:[self argumentDescriptionAtIndex:(NSInteger)i]];
}

return [description autorelease];
}

Expand Down Expand Up @@ -378,14 +378,14 @@ - (NSString *)argumentDescriptionAtIndex:(NSInteger)argIndex
case ':': return [self selectorDescriptionAtIndex:argIndex];
default: return [@"<??" stringByAppendingString:@">"]; // avoid confusion with trigraphs...
}

}


- (NSString *)objectDescriptionAtIndex:(NSInteger)anInt
{
id object;

[self getArgument:&object atIndex:anInt];
if (object == nil)
return @"nil";
Expand All @@ -407,9 +407,9 @@ - (NSString *)charDescriptionAtIndex:(NSInteger)anInt
{
unsigned char buffer[128];
memset(buffer, 0x0, 128);

[self getArgument:&buffer atIndex:anInt];

// If there's only one character in the buffer, and it's 0 or 1, then we have a BOOL
if (buffer[1] == '\0' && (buffer[0] == 0 || buffer[0] == 1))
return (buffer[0] == 1 ? @"YES" : @"NO");
Expand All @@ -421,95 +421,95 @@ - (NSString *)unsignedCharDescriptionAtIndex:(NSInteger)anInt
{
unsigned char buffer[128];
memset(buffer, 0x0, 128);

[self getArgument:&buffer atIndex:anInt];
return [NSString stringWithFormat:@"'%c'", *buffer];
}

- (NSString *)intDescriptionAtIndex:(NSInteger)anInt
{
int intValue;

[self getArgument:&intValue atIndex:anInt];
return [NSString stringWithFormat:@"%d", intValue];
}

- (NSString *)unsignedIntDescriptionAtIndex:(NSInteger)anInt
{
unsigned int intValue;

[self getArgument:&intValue atIndex:anInt];
return [NSString stringWithFormat:@"%d", intValue];
}

- (NSString *)shortDescriptionAtIndex:(NSInteger)anInt
{
short shortValue;

[self getArgument:&shortValue atIndex:anInt];
return [NSString stringWithFormat:@"%hi", shortValue];
}

- (NSString *)unsignedShortDescriptionAtIndex:(NSInteger)anInt
{
unsigned short shortValue;

[self getArgument:&shortValue atIndex:anInt];
return [NSString stringWithFormat:@"%hu", shortValue];
}

- (NSString *)longDescriptionAtIndex:(NSInteger)anInt
{
long longValue;

[self getArgument:&longValue atIndex:anInt];
return [NSString stringWithFormat:@"%ld", longValue];
}

- (NSString *)unsignedLongDescriptionAtIndex:(NSInteger)anInt
{
unsigned long longValue;

[self getArgument:&longValue atIndex:anInt];
return [NSString stringWithFormat:@"%lu", longValue];
}

- (NSString *)longLongDescriptionAtIndex:(NSInteger)anInt
{
long long longLongValue;

[self getArgument:&longLongValue atIndex:anInt];
return [NSString stringWithFormat:@"%qi", longLongValue];
}

- (NSString *)unsignedLongLongDescriptionAtIndex:(NSInteger)anInt
{
unsigned long long longLongValue;

[self getArgument:&longLongValue atIndex:anInt];
return [NSString stringWithFormat:@"%qu", longLongValue];
}

- (NSString *)doubleDescriptionAtIndex:(NSInteger)anInt
{
double doubleValue;

[self getArgument:&doubleValue atIndex:anInt];
return [NSString stringWithFormat:@"%f", doubleValue];
}

- (NSString *)floatDescriptionAtIndex:(NSInteger)anInt
{
float floatValue;

[self getArgument:&floatValue atIndex:anInt];
return [NSString stringWithFormat:@"%f", floatValue];
}

- (NSString *)longDoubleDescriptionAtIndex:(NSInteger)anInt
{
long double longDoubleValue;

[self getArgument:&longDoubleValue atIndex:anInt];
return [NSString stringWithFormat:@"%Lf", longDoubleValue];
}
Expand All @@ -522,7 +522,7 @@ - (NSString *)structDescriptionAtIndex:(NSInteger)anInt
- (NSString *)pointerDescriptionAtIndex:(NSInteger)anInt
{
void *buffer;

[self getArgument:&buffer atIndex:anInt];
return [NSString stringWithFormat:@"%p", buffer];
}
Expand All @@ -531,7 +531,7 @@ - (NSString *)cStringDescriptionAtIndex:(NSInteger)anInt
{
char buffer[104];
char *cStringPtr;

[self getArgument:&cStringPtr atIndex:anInt];
strlcpy(buffer, cStringPtr, sizeof(buffer));
strlcpy(buffer + 100, "...", (sizeof(buffer) - 100));
Expand All @@ -541,7 +541,7 @@ - (NSString *)cStringDescriptionAtIndex:(NSInteger)anInt
- (NSString *)selectorDescriptionAtIndex:(NSInteger)anInt
{
SEL selectorValue;

[self getArgument:&selectorValue atIndex:anInt];
return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector(selectorValue)];
}
Expand Down
8 changes: 4 additions & 4 deletions Source/OCMock/NSMethodSignature+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)sele
objc_property_t property = [self propertyMatchingSelector:selector inClass:aClass isGetter:&isGetter];
if(property == NULL)
return nil;

const char *propertyAttributesString = property_getAttributes(property);
NSArray *propertyAttributes = [[NSString stringWithCString:propertyAttributesString
encoding:NSASCIIStringEncoding] componentsSeparatedByString:@","];
Expand All @@ -49,7 +49,7 @@ + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)sele
NSRange r = [typeStr rangeOfString:@"\""]; // incomplete workaround to deal with structs
if(r.location != NSNotFound)
typeStr = [typeStr substringToIndex:r.location];

NSString *sigStringFormat = isGetter ? @"%@@:" : @"v@:%@";
const char *sigCString = [[NSString stringWithFormat:sigStringFormat, typeStr] cStringUsingEncoding:NSASCIIStringEncoding];
return [NSMethodSignature signatureWithObjCTypes:sigCString];
Expand All @@ -59,7 +59,7 @@ + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)sele
+ (objc_property_t)propertyMatchingSelector:(SEL)selector inClass:(Class)aClass isGetter:(BOOL *)isGetterPtr
{
NSString *propertyName = NSStringFromSelector(selector);

// first try selector as is aassuming it's a getter
objc_property_t property = class_getProperty(aClass, [propertyName cStringUsingEncoding:NSASCIIStringEncoding]);
if(property != NULL)
Expand All @@ -83,7 +83,7 @@ + (objc_property_t)propertyMatchingSelector:(SEL)selector inClass:(Class)aClass
return property;
}
}

// search through properties with custom getter/setter that corresponds to selector
unsigned int propertiesCount = 0;
objc_property_t *allProperties = class_copyPropertyList(aClass, &propertiesCount);
Expand Down
4 changes: 2 additions & 2 deletions Source/OCMock/NSObject+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector

#ifndef __arm64__
static NSMutableDictionary *_OCMReturnTypeCache;

if(_OCMReturnTypeCache == nil)
_OCMReturnTypeCache = [[NSMutableDictionary alloc] init];

Expand All @@ -50,7 +50,7 @@ + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector
if(needsStructureReturn)
return class_getMethodImplementation_stret([NSObject class], selectorWithNoImplementation);
#endif

return class_getMethodImplementation([NSObject class], selectorWithNoImplementation);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/OCMock/OCClassMockObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ - (void)prepareClassForClassMethodMocking
/* the runtime and OCMock depend on string and array; we don't intercept methods on them to avoid endless loops */
if([[mockedClass class] isSubclassOfClass:[NSString class]] || [[mockedClass class] isSubclassOfClass:[NSArray class]])
return;

/* trying to replace class methods on NSManagedObject and subclasses of it doesn't work; see #339 */
if([mockedClass isSubclassOfClass:objc_getClass("NSManagedObject")])
return;
Expand Down Expand Up @@ -234,7 +234,7 @@ - (BOOL)conformsToProtocol:(Protocol *)aProtocol
/*
taken from:
`class-dump -f isNS /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/CoreFoundation.framework`

@ interface NSObject (__NSIsKinds)
- (_Bool)isNSValue__;
- (_Bool)isNSTimeZone__;
Expand Down
4 changes: 2 additions & 2 deletions Source/OCMock/OCMArg.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ + (id)invokeBlock

+ (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION
{

NSMutableArray *params = [NSMutableArray array];
va_list args;
if(first)
Expand All @@ -113,7 +113,7 @@ + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION
va_end(args);
}
return [[[OCMBlockArgCaller alloc] initWithBlockArguments:params] autorelease];

}

+ (id)defaultValue
Expand Down
6 changes: 3 additions & 3 deletions Source/OCMock/OCMBlockCaller.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@

@implementation OCMBlockCaller

-(id)initWithCallBlock:(void (^)(NSInvocation *))theBlock
-(id)initWithCallBlock:(void (^)(NSInvocation *))theBlock
{
if ((self = [super init]))
{
block = [theBlock copy];
}

return self;
}

-(void)dealloc
-(void)dealloc
{
[block release];
[super dealloc];
Expand Down
Loading