Permalink
Browse files

Made indent style universal

  • Loading branch information...
1 parent 0ba7d3d commit cfe1f37507fb81d63255ed9433dfbbf177dc3840 @schwa schwa committed Feb 11, 2011
View
Oops, something went wrong.
@@ -14,57 +14,57 @@ @implementation CFilteringJSONSerializer
@synthesize convertersByName;
- (void)dealloc
-{
-[tests release];
-tests = NULL;
-//
-[convertersByName release];
-convertersByName = NULL;
-//
-[super dealloc];
-}
+ {
+ [tests release];
+ tests = NULL;
+ //
+ [convertersByName release];
+ convertersByName = NULL;
+ //
+ [super dealloc];
+ }
- (NSData *)serializeObject:(id)inObject error:(NSError **)outError
-{
-NSData *theData = NULL;
-for (JSONConversionTest theTest in self.tests)
- {
- NSString *theName = theTest(inObject);
- if (theName != NULL)
- {
- id theObject = NULL;
- JSONConversionConverter theConverter = [self.convertersByName objectForKey:theName];
- if (theConverter)
+ {
+ NSData *theData = NULL;
+ for (JSONConversionTest theTest in self.tests)
+ {
+ NSString *theName = theTest(inObject);
+ if (theName != NULL)
{
- theObject = theConverter(inObject);
- }
-
- if (theObject)
- {
- if ([theObject isKindOfClass:[NSData class]])
+ id theObject = NULL;
+ JSONConversionConverter theConverter = [self.convertersByName objectForKey:theName];
+ if (theConverter)
{
- theData = theObject;
- break;
+ theObject = theConverter(inObject);
}
- else
+
+ if (theObject)
{
- NSError *theError = NULL;
- theData = [super serializeObject:theObject error:&theError];
- if (theData != NULL)
+ if ([theObject isKindOfClass:[NSData class]])
{
+ theData = theObject;
break;
}
+ else
+ {
+ NSError *theError = NULL;
+ theData = [super serializeObject:theObject error:&theError];
+ if (theData != NULL)
+ {
+ break;
+ }
+ }
}
- }
+ }
+ }
+
+ if (theData == NULL)
+ {
+ theData = [super serializeObject:inObject error:outError];
}
- }
-
-if (theData == NULL)
- {
- theData = [super serializeObject:inObject error:outError];
- }
-
-return(theData);
-}
+
+ return(theData);
+ }
@end
@@ -64,72 +64,72 @@ - (BOOL)scanCStyleComment:(NSString **)outComment
}
- (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment
-{
-if ([self scanString:@"//" intoString:NULL] == YES)
- {
- unichar theCharacters[] = { LF, FF, CR, NEL, LS, PS, };
- NSCharacterSet *theLineBreaksCharacterSet = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithCharacters:theCharacters length:sizeof(theCharacters) / sizeof(*theCharacters)]];
+ {
+ if ([self scanString:@"//" intoString:NULL] == YES)
+ {
+ unichar theCharacters[] = { LF, FF, CR, NEL, LS, PS, };
+ NSCharacterSet *theLineBreaksCharacterSet = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithCharacters:theCharacters length:sizeof(theCharacters) / sizeof(*theCharacters)]];
- NSString *theComment = NULL;
- [self scanUpToCharactersFromSet:theLineBreaksCharacterSet intoString:&theComment];
- [self scanCharactersFromSet:theLineBreaksCharacterSet intoString:NULL];
+ NSString *theComment = NULL;
+ [self scanUpToCharactersFromSet:theLineBreaksCharacterSet intoString:&theComment];
+ [self scanCharactersFromSet:theLineBreaksCharacterSet intoString:NULL];
- if (outComment != NULL)
- *outComment = theComment;
+ if (outComment != NULL)
+ *outComment = theComment;
- return(YES);
- }
-else
- {
- return(NO);
- }
-}
+ return(YES);
+ }
+ else
+ {
+ return(NO);
+ }
+ }
- (NSUInteger)lineOfScanLocation
-{
-NSUInteger theLine = 0;
-for (const u_int8_t *C = start; C < current; ++C)
{
- // TODO: JIW What about MS-DOS line endings you bastard! (Also other unicode line endings)
- if (*C == '\n' || *C == '\r')
+ NSUInteger theLine = 0;
+ for (const u_int8_t *C = start; C < current; ++C)
{
- ++theLine;
+ // TODO: JIW What about MS-DOS line endings you bastard! (Also other unicode line endings)
+ if (*C == '\n' || *C == '\r')
+ {
+ ++theLine;
+ }
}
+ return(theLine);
}
-return(theLine);
-}
- (NSDictionary *)userInfoForScanLocation
-{
-NSUInteger theLine = 0;
-const u_int8_t *theLineStart = start;
-for (const u_int8_t *C = start; C < current; ++C)
{
- if (*C == '\n' || *C == '\r')
+ NSUInteger theLine = 0;
+ const u_int8_t *theLineStart = start;
+ for (const u_int8_t *C = start; C < current; ++C)
{
- theLineStart = C - 1;
- ++theLine;
+ if (*C == '\n' || *C == '\r')
+ {
+ theLineStart = C - 1;
+ ++theLine;
+ }
}
- }
-NSUInteger theCharacter = current - theLineStart;
+ NSUInteger theCharacter = current - theLineStart;
-NSRange theStartRange = NSIntersectionRange((NSRange){ .location = MAX((NSInteger)self.scanLocation - 20, 0), .length = 20 + (NSInteger)self.scanLocation - 20 }, (NSRange){ .location = 0, .length = self.data.length });
-NSRange theEndRange = NSIntersectionRange((NSRange){ .location = self.scanLocation, .length = 20 }, (NSRange){ .location = 0, .length = self.data.length });
+ NSRange theStartRange = NSIntersectionRange((NSRange){ .location = MAX((NSInteger)self.scanLocation - 20, 0), .length = 20 + (NSInteger)self.scanLocation - 20 }, (NSRange){ .location = 0, .length = self.data.length });
+ NSRange theEndRange = NSIntersectionRange((NSRange){ .location = self.scanLocation, .length = 20 }, (NSRange){ .location = 0, .length = self.data.length });
-NSString *theSnippet = [NSString stringWithFormat:@"%@!HERE>!%@",
- [[[NSString alloc] initWithData:[self.data subdataWithRange:theStartRange] encoding:NSUTF8StringEncoding] autorelease],
- [[[NSString alloc] initWithData:[self.data subdataWithRange:theEndRange] encoding:NSUTF8StringEncoding] autorelease]
- ];
+ NSString *theSnippet = [NSString stringWithFormat:@"%@!HERE>!%@",
+ [[[NSString alloc] initWithData:[self.data subdataWithRange:theStartRange] encoding:NSUTF8StringEncoding] autorelease],
+ [[[NSString alloc] initWithData:[self.data subdataWithRange:theEndRange] encoding:NSUTF8StringEncoding] autorelease]
+ ];
-NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithUnsignedInteger:theLine], @"line",
- [NSNumber numberWithUnsignedInteger:theCharacter], @"character",
- [NSNumber numberWithUnsignedInteger:self.scanLocation], @"location",
- theSnippet, @"snippet",
- NULL];
-return(theUserInfo);
-}
+ NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithUnsignedInteger:theLine], @"line",
+ [NSNumber numberWithUnsignedInteger:theCharacter], @"character",
+ [NSNumber numberWithUnsignedInteger:self.scanLocation], @"location",
+ theSnippet, @"snippet",
+ NULL];
+ return(theUserInfo);
+ }
@end
Oops, something went wrong.

0 comments on commit cfe1f37

Please sign in to comment.