Skip to content
This repository
Browse code

Made indent style universal

  • Loading branch information...
commit cfe1f37507fb81d63255ed9433dfbbf177dc3840 1 parent 0ba7d3d
Jonathan Wight authored February 11, 2011
460  Source/CDataScanner.m
@@ -37,304 +37,304 @@ @interface CDataScanner ()
37 37
 #pragma mark -
38 38
 
39 39
 inline static unichar CharacterAtPointer(void *start, void *end)
40  
-{
41  
-#pragma unused(end)
  40
+    {
  41
+    #pragma unused(end)
42 42
 
43  
-const u_int8_t theByte = *(u_int8_t *)start;
44  
-if (theByte & 0x80)
45  
-	{
46  
-	// TODO -- UNICODE!!!! (well in theory nothing todo here)
47  
-	}
48  
-const unichar theCharacter = theByte;
49  
-return(theCharacter);
50  
-}
  43
+    const u_int8_t theByte = *(u_int8_t *)start;
  44
+    if (theByte & 0x80)
  45
+        {
  46
+        // TODO -- UNICODE!!!! (well in theory nothing todo here)
  47
+        }
  48
+    const unichar theCharacter = theByte;
  49
+    return(theCharacter);
  50
+    }
51 51
 
52  
-static NSCharacterSet *sDoubleCharacters = NULL;
  52
+    static NSCharacterSet *sDoubleCharacters = NULL;
53 53
 
54  
-@implementation CDataScanner
  54
+    @implementation CDataScanner
55 55
 
56 56
 - (id)init
57  
-{
58  
-if ((self = [super init]) != NULL)
59  
-	{
60  
-	}
61  
-return(self);
62  
-}
  57
+    {
  58
+    if ((self = [super init]) != NULL)
  59
+        {
  60
+        }
  61
+    return(self);
  62
+    }
63 63
 
64 64
 - (id)initWithData:(NSData *)inData;
65  
-{
66  
-if ((self = [self init]) != NULL)
67  
-	{
68  
-	[self setData:inData];
69  
-	}
70  
-return(self);
71  
-}
72  
-
73  
-+ (void)initialize
74  
-{
75  
-if (sDoubleCharacters == NULL)
76 65
     {
77  
-    sDoubleCharacters = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789eE-+."] retain];
  66
+    if ((self = [self init]) != NULL)
  67
+        {
  68
+        [self setData:inData];
  69
+        }
  70
+    return(self);
  71
+    }
  72
+
  73
+    + (void)initialize
  74
+    {
  75
+    if (sDoubleCharacters == NULL)
  76
+        {
  77
+        sDoubleCharacters = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789eE-+."] retain];
  78
+        }
78 79
     }
79  
-}
80 80
 
81 81
 - (void)dealloc
82  
-{
83  
-[data release];
84  
-data = NULL;
85  
-//
86  
-[super dealloc];
87  
-}
  82
+    {
  83
+    [data release];
  84
+    data = NULL;
  85
+    //
  86
+    [super dealloc];
  87
+    }
88 88
 
89 89
 - (NSUInteger)scanLocation
90  
-{
91  
-return(current - start);
92  
-}
  90
+    {
  91
+    return(current - start);
  92
+    }
93 93
 
94 94
 - (NSUInteger)bytesRemaining
95  
-{
96  
-return(end - current);
97  
-}
98  
-
99  
-- (NSData *)data
100  
-{
101  
-return(data);
102  
-}
103  
-
104  
-- (void)setData:(NSData *)inData
105  
-{
106  
-if (data != inData)
107  
-	{
108  
-    [data release];
109  
-    data = [inData retain];
  95
+    {
  96
+    return(end - current);
110 97
     }
111 98
 
112  
-if (data)
  99
+- (NSData *)data
113 100
     {
114  
-    start = (u_int8_t *)data.bytes;
115  
-    end = start + data.length;
116  
-    current = start;
117  
-    length = data.length;
  101
+    return(data);
118 102
     }
119  
-else
  103
+
  104
+- (void)setData:(NSData *)inData
120 105
     {
121  
-    start = NULL;
122  
-    end = NULL;
123  
-    current = NULL;
124  
-    length = 0;
  106
+    if (data != inData)
  107
+        {
  108
+        [data release];
  109
+        data = [inData retain];
  110
+        }
  111
+
  112
+    if (data)
  113
+        {
  114
+        start = (u_int8_t *)data.bytes;
  115
+        end = start + data.length;
  116
+        current = start;
  117
+        length = data.length;
  118
+        }
  119
+    else
  120
+        {
  121
+        start = NULL;
  122
+        end = NULL;
  123
+        current = NULL;
  124
+        length = 0;
  125
+        }
125 126
     }
126  
-}
127 127
 
128 128
 - (void)setScanLocation:(NSUInteger)inScanLocation
129  
-{
130  
-current = start + inScanLocation;
131  
-}
  129
+    {
  130
+    current = start + inScanLocation;
  131
+    }
132 132
 
133 133
 - (BOOL)isAtEnd
134  
-{
135  
-return(self.scanLocation >= length);
136  
-}
  134
+    {
  135
+    return(self.scanLocation >= length);
  136
+    }
137 137
 
138 138
 - (unichar)currentCharacter
139  
-{
140  
-return(CharacterAtPointer(current, end));
141  
-}
  139
+    {
  140
+    return(CharacterAtPointer(current, end));
  141
+    }
142 142
 
143 143
 #pragma mark -
144 144
 
145 145
 - (unichar)scanCharacter
146  
-{
147  
-const unichar theCharacter = CharacterAtPointer(current++, end);
148  
-return(theCharacter);
149  
-}
  146
+    {
  147
+    const unichar theCharacter = CharacterAtPointer(current++, end);
  148
+    return(theCharacter);
  149
+    }
150 150
 
151 151
 - (BOOL)scanCharacter:(unichar)inCharacter
152  
-{
153  
-unichar theCharacter = CharacterAtPointer(current, end);
154  
-if (theCharacter == inCharacter)
155  
-	{
156  
-	++current;
157  
-	return(YES);
158  
-	}
159  
-else
160  
-	return(NO);
161  
-}
  152
+    {
  153
+    unichar theCharacter = CharacterAtPointer(current, end);
  154
+    if (theCharacter == inCharacter)
  155
+        {
  156
+        ++current;
  157
+        return(YES);
  158
+        }
  159
+    else
  160
+        return(NO);
  161
+    }
162 162
 
163 163
 - (BOOL)scanUTF8String:(const char *)inString intoString:(NSString **)outValue
164  
-{
165  
-const size_t theLength = strlen(inString);
166  
-if ((size_t)(end - current) < theLength)
167  
-	return(NO);
168  
-if (strncmp((char *)current, inString, theLength) == 0)
169  
-	{
170  
-	current += theLength;
171  
-	if (outValue)
172  
-		*outValue = [NSString stringWithUTF8String:inString];
173  
-	return(YES);
174  
-	}
175  
-return(NO);
176  
-}
  164
+    {
  165
+    const size_t theLength = strlen(inString);
  166
+    if ((size_t)(end - current) < theLength)
  167
+        return(NO);
  168
+    if (strncmp((char *)current, inString, theLength) == 0)
  169
+        {
  170
+        current += theLength;
  171
+        if (outValue)
  172
+            *outValue = [NSString stringWithUTF8String:inString];
  173
+        return(YES);
  174
+        }
  175
+    return(NO);
  176
+    }
177 177
 
178 178
 - (BOOL)scanString:(NSString *)inString intoString:(NSString **)outValue
179  
-{
180  
-if ((size_t)(end - current) < inString.length)
181  
-	return(NO);
182  
-if (strncmp((char *)current, [inString UTF8String], inString.length) == 0)
183  
-	{
184  
-	current += inString.length;
185  
-	if (outValue)
186  
-		*outValue = inString;
187  
-	return(YES);
188  
-	}
189  
-return(NO);
190  
-}
  179
+    {
  180
+    if ((size_t)(end - current) < inString.length)
  181
+        return(NO);
  182
+    if (strncmp((char *)current, [inString UTF8String], inString.length) == 0)
  183
+        {
  184
+        current += inString.length;
  185
+        if (outValue)
  186
+            *outValue = inString;
  187
+        return(YES);
  188
+        }
  189
+    return(NO);
  190
+    }
191 191
 
192 192
 - (BOOL)scanCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)outValue
193  
-{
194  
-u_int8_t *P;
195  
-for (P = current; P < end && [inSet characterIsMember:*P] == YES; ++P)
196  
-	;
  193
+    {
  194
+    u_int8_t *P;
  195
+    for (P = current; P < end && [inSet characterIsMember:*P] == YES; ++P)
  196
+        ;
197 197
 
198  
-if (P == current)
199  
-	{
200  
-	return(NO);
201  
-	}
  198
+    if (P == current)
  199
+        {
  200
+        return(NO);
  201
+        }
202 202
 
203  
-if (outValue)
204  
-	{
205  
-	*outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
206  
-	}
  203
+    if (outValue)
  204
+        {
  205
+        *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
  206
+        }
207 207
 
208  
-current = P;
  208
+    current = P;
209 209
 
210  
-return(YES);
211  
-}
  210
+    return(YES);
  211
+    }
212 212
 
213 213
 - (BOOL)scanUpToString:(NSString *)inString intoString:(NSString **)outValue
214  
-{
215  
-const char *theToken = [inString UTF8String];
216  
-const char *theResult = strnstr((char *)current, theToken, end - current);
217  
-if (theResult == NULL)
218  
-	{
219  
-	return(NO);
220  
-	}
  214
+    {
  215
+    const char *theToken = [inString UTF8String];
  216
+    const char *theResult = strnstr((char *)current, theToken, end - current);
  217
+    if (theResult == NULL)
  218
+        {
  219
+        return(NO);
  220
+        }
221 221
 
222  
-if (outValue)
223  
-	{
224  
-	*outValue = [[[NSString alloc] initWithBytes:current length:theResult - (char *)current encoding:NSUTF8StringEncoding] autorelease];
225  
-	}
  222
+    if (outValue)
  223
+        {
  224
+        *outValue = [[[NSString alloc] initWithBytes:current length:theResult - (char *)current encoding:NSUTF8StringEncoding] autorelease];
  225
+        }
226 226
 
227  
-current = (u_int8_t *)theResult;
  227
+    current = (u_int8_t *)theResult;
228 228
 
229  
-return(YES);
230  
-}
  229
+    return(YES);
  230
+    }
231 231
 
232 232
 - (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)outValue
233  
-{
234  
-u_int8_t *P;
235  
-for (P = current; P < end && [inSet characterIsMember:*P] == NO; ++P)
236  
-	;
  233
+    {
  234
+    u_int8_t *P;
  235
+    for (P = current; P < end && [inSet characterIsMember:*P] == NO; ++P)
  236
+        ;
237 237
 
238  
-if (P == current)
239  
-	{
240  
-	return(NO);
241  
-	}
  238
+    if (P == current)
  239
+        {
  240
+        return(NO);
  241
+        }
242 242
 
243  
-if (outValue)
244  
-	{
245  
-	*outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
246  
-	}
  243
+    if (outValue)
  244
+        {
  245
+        *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
  246
+        }
247 247
 
248  
-current = P;
  248
+    current = P;
249 249
 
250  
-return(YES);
251  
-}
  250
+    return(YES);
  251
+    }
252 252
 
253 253
 - (BOOL)scanNumber:(NSNumber **)outValue
254  
-	{
255  
-	NSString *theString = NULL;
256  
-	if ([self scanCharactersFromSet:sDoubleCharacters intoString:&theString])
257  
-		{
258  
-		if ([theString rangeOfString:@"."].location != NSNotFound)
259  
-			{
260  
-			if (outValue)
261  
-				{
262  
-				*outValue = [NSDecimalNumber decimalNumberWithString:theString];
263  
-				}
264  
-			return(YES);
265  
-			}
266  
-		else if ([theString rangeOfString:@"-"].location != NSNotFound)
267  
-			{
268  
-			if (outValue != NULL)
269  
-				{
270  
-				*outValue = [NSNumber numberWithLongLong:[theString longLongValue]];
271  
-				}
272  
-			return(YES);
273  
-			}
274  
-		else
275  
-			{
276  
-			if (outValue != NULL)
277  
-				{
278  
-				*outValue = [NSNumber numberWithUnsignedLongLong:strtoull([theString UTF8String], NULL, 0)];
279  
-				}
280  
-			return(YES);
281  
-			}
282  
-		
283  
-		}
284  
-	return(NO);
285  
-	}
286  
-		
287  
-- (BOOL)scanDecimalNumber:(NSDecimalNumber **)outValue;
288  
-	{
289  
-	NSString *theString = NULL;
290  
-	if ([self scanCharactersFromSet:sDoubleCharacters intoString:&theString])
291  
-		{
292  
-		if (outValue)
293  
-			{
294  
-			*outValue = [NSDecimalNumber decimalNumberWithString:theString];
295  
-			}
296  
-		return(YES);
297  
-		}
298  
-	return(NO);
299  
-	}
300  
-
301  
-- (BOOL)scanDataOfLength:(NSUInteger)inLength intoData:(NSData **)outData;
302  
-    {
303  
-    if (self.bytesRemaining < inLength)
304 254
         {
  255
+        NSString *theString = NULL;
  256
+        if ([self scanCharactersFromSet:sDoubleCharacters intoString:&theString])
  257
+            {
  258
+            if ([theString rangeOfString:@"."].location != NSNotFound)
  259
+                {
  260
+                if (outValue)
  261
+                    {
  262
+                    *outValue = [NSDecimalNumber decimalNumberWithString:theString];
  263
+                    }
  264
+                return(YES);
  265
+                }
  266
+            else if ([theString rangeOfString:@"-"].location != NSNotFound)
  267
+                {
  268
+                if (outValue != NULL)
  269
+                    {
  270
+                    *outValue = [NSNumber numberWithLongLong:[theString longLongValue]];
  271
+                    }
  272
+                return(YES);
  273
+                }
  274
+            else
  275
+                {
  276
+                if (outValue != NULL)
  277
+                    {
  278
+                    *outValue = [NSNumber numberWithUnsignedLongLong:strtoull([theString UTF8String], NULL, 0)];
  279
+                    }
  280
+                return(YES);
  281
+                }
  282
+            
  283
+            }
305 284
         return(NO);
306 285
         }
307  
-    
308  
-    if (outData)
  286
+            
  287
+- (BOOL)scanDecimalNumber:(NSDecimalNumber **)outValue;
309 288
         {
310  
-        *outData = [NSData dataWithBytes:current length:inLength];
  289
+        NSString *theString = NULL;
  290
+        if ([self scanCharactersFromSet:sDoubleCharacters intoString:&theString])
  291
+            {
  292
+            if (outValue)
  293
+                {
  294
+                *outValue = [NSDecimalNumber decimalNumberWithString:theString];
  295
+                }
  296
+            return(YES);
  297
+            }
  298
+        return(NO);
311 299
         }
312 300
 
313  
-    current += inLength;
314  
-    return(YES);
315  
-    }
  301
+- (BOOL)scanDataOfLength:(NSUInteger)inLength intoData:(NSData **)outData;
  302
+        {
  303
+        if (self.bytesRemaining < inLength)
  304
+            {
  305
+            return(NO);
  306
+            }
  307
+        
  308
+        if (outData)
  309
+            {
  310
+            *outData = [NSData dataWithBytes:current length:inLength];
  311
+            }
  312
+
  313
+        current += inLength;
  314
+        return(YES);
  315
+        }
316 316
 
317 317
 
318 318
 - (void)skipWhitespace
319  
-{
320  
-u_int8_t *P;
321  
-for (P = current; P < end && (isspace(*P)); ++P)
322  
-	;
  319
+    {
  320
+    u_int8_t *P;
  321
+    for (P = current; P < end && (isspace(*P)); ++P)
  322
+        ;
323 323
 
324  
-current = P;
325  
-}
  324
+    current = P;
  325
+    }
326 326
 
327 327
 - (NSString *)remainingString
328  
-{
329  
-NSData *theRemainingData = [NSData dataWithBytes:current length:end - current];
330  
-NSString *theString = [[[NSString alloc] initWithData:theRemainingData encoding:NSUTF8StringEncoding] autorelease];
331  
-return(theString);
332  
-}
  328
+    {
  329
+    NSData *theRemainingData = [NSData dataWithBytes:current length:end - current];
  330
+    NSString *theString = [[[NSString alloc] initWithData:theRemainingData encoding:NSUTF8StringEncoding] autorelease];
  331
+    return(theString);
  332
+    }
333 333
 
334 334
 - (NSData *)remainingData;
335  
-{
336  
-NSData *theRemainingData = [NSData dataWithBytes:current length:end - current];
337  
-return(theRemainingData);
338  
-}
  335
+    {
  336
+    NSData *theRemainingData = [NSData dataWithBytes:current length:end - current];
  337
+    return(theRemainingData);
  338
+    }
339 339
 
340  
-@end
  340
+    @end
82  Source/Experimental/CFilteringJSONSerializer.m
@@ -14,57 +14,57 @@ @implementation CFilteringJSONSerializer
14 14
 @synthesize convertersByName;
15 15
 
16 16
 - (void)dealloc
17  
-{
18  
-[tests release];
19  
-tests = NULL;
20  
-//
21  
-[convertersByName release];
22  
-convertersByName = NULL;
23  
-//
24  
-[super dealloc];
25  
-}
  17
+    {
  18
+    [tests release];
  19
+    tests = NULL;
  20
+    //
  21
+    [convertersByName release];
  22
+    convertersByName = NULL;
  23
+    //
  24
+    [super dealloc];
  25
+    }
26 26
 
27 27
 - (NSData *)serializeObject:(id)inObject error:(NSError **)outError
28  
-{
29  
-NSData *theData = NULL;
30  
-for (JSONConversionTest theTest in self.tests)
31  
-	{
32  
-	NSString *theName = theTest(inObject);
33  
-	if (theName != NULL)
34  
-		{
35  
-        id theObject = NULL;
36  
-		JSONConversionConverter theConverter = [self.convertersByName objectForKey:theName];
37  
-        if (theConverter)
  28
+    {
  29
+    NSData *theData = NULL;
  30
+    for (JSONConversionTest theTest in self.tests)
  31
+        {
  32
+        NSString *theName = theTest(inObject);
  33
+        if (theName != NULL)
38 34
             {
39  
-            theObject = theConverter(inObject);
40  
-            }
41  
-            
42  
-		if (theObject)
43  
-			{
44  
-            if ([theObject isKindOfClass:[NSData class]])
  35
+            id theObject = NULL;
  36
+            JSONConversionConverter theConverter = [self.convertersByName objectForKey:theName];
  37
+            if (theConverter)
45 38
                 {
46  
-                theData = theObject;
47  
-                break;
  39
+                theObject = theConverter(inObject);
48 40
                 }
49  
-            else
  41
+                
  42
+            if (theObject)
50 43
                 {
51  
-                NSError *theError = NULL;
52  
-                theData = [super serializeObject:theObject error:&theError];
53  
-                if (theData != NULL)
  44
+                if ([theObject isKindOfClass:[NSData class]])
54 45
                     {
  46
+                    theData = theObject;
55 47
                     break;
56 48
                     }
  49
+                else
  50
+                    {
  51
+                    NSError *theError = NULL;
  52
+                    theData = [super serializeObject:theObject error:&theError];
  53
+                    if (theData != NULL)
  54
+                        {
  55
+                        break;
  56
+                        }
  57
+                    }
57 58
                 }
58  
-			}
  59
+            }
  60
+        }
  61
+        
  62
+    if (theData == NULL)
  63
+        {
  64
+        theData = [super serializeObject:inObject error:outError];
59 65
         }
60  
-	}
61  
-	
62  
-if (theData == NULL)
63  
-	{
64  
-	theData = [super serializeObject:inObject error:outError];
65  
-	}
66  
-	
67  
-return(theData);
68  
-}
  66
+        
  67
+    return(theData);
  68
+    }
69 69
 
70 70
 @end
96  Source/Extensions/CDataScanner_Extensions.m
@@ -64,72 +64,72 @@ - (BOOL)scanCStyleComment:(NSString **)outComment
64 64
 }
65 65
 
66 66
 - (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment
67  
-{
68  
-if ([self scanString:@"//" intoString:NULL] == YES)
69  
-	{
70  
-    unichar theCharacters[] = { LF, FF, CR, NEL, LS, PS, };
71  
-    NSCharacterSet *theLineBreaksCharacterSet = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithCharacters:theCharacters length:sizeof(theCharacters) / sizeof(*theCharacters)]];
  67
+    {
  68
+    if ([self scanString:@"//" intoString:NULL] == YES)
  69
+        {
  70
+        unichar theCharacters[] = { LF, FF, CR, NEL, LS, PS, };
  71
+        NSCharacterSet *theLineBreaksCharacterSet = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithCharacters:theCharacters length:sizeof(theCharacters) / sizeof(*theCharacters)]];
72 72
 
73  
-	NSString *theComment = NULL;
74  
-	[self scanUpToCharactersFromSet:theLineBreaksCharacterSet intoString:&theComment];
75  
-	[self scanCharactersFromSet:theLineBreaksCharacterSet intoString:NULL];
  73
+        NSString *theComment = NULL;
  74
+        [self scanUpToCharactersFromSet:theLineBreaksCharacterSet intoString:&theComment];
  75
+        [self scanCharactersFromSet:theLineBreaksCharacterSet intoString:NULL];
76 76
 
77  
-	if (outComment != NULL)
78  
-		*outComment = theComment;
  77
+        if (outComment != NULL)
  78
+            *outComment = theComment;
79 79
 
80  
-	return(YES);
81  
-	}
82  
-else
83  
-	{
84  
-	return(NO);
85  
-	}
86  
-}
  80
+        return(YES);
  81
+        }
  82
+    else
  83
+        {
  84
+        return(NO);
  85
+        }
  86
+    }
87 87
 
88 88
 - (NSUInteger)lineOfScanLocation
89  
-{
90  
-NSUInteger theLine = 0;
91  
-for (const u_int8_t *C = start; C < current; ++C)
92 89
     {
93  
-    // TODO: JIW What about MS-DOS line endings you bastard! (Also other unicode line endings)
94  
-    if (*C == '\n' || *C == '\r')
  90
+    NSUInteger theLine = 0;
  91
+    for (const u_int8_t *C = start; C < current; ++C)
95 92
         {
96  
-        ++theLine;
  93
+        // TODO: JIW What about MS-DOS line endings you bastard! (Also other unicode line endings)
  94
+        if (*C == '\n' || *C == '\r')
  95
+            {
  96
+            ++theLine;
  97
+            }
97 98
         }
  99
+    return(theLine);
98 100
     }
99  
-return(theLine);
100  
-}
101 101
 
102 102
 - (NSDictionary *)userInfoForScanLocation
103  
-{
104  
-NSUInteger theLine = 0;
105  
-const u_int8_t *theLineStart = start;
106  
-for (const u_int8_t *C = start; C < current; ++C)
107 103
     {
108  
-    if (*C == '\n' || *C == '\r')
  104
+    NSUInteger theLine = 0;
  105
+    const u_int8_t *theLineStart = start;
  106
+    for (const u_int8_t *C = start; C < current; ++C)
109 107
         {
110  
-        theLineStart = C - 1;
111  
-        ++theLine;
  108
+        if (*C == '\n' || *C == '\r')
  109
+            {
  110
+            theLineStart = C - 1;
  111
+            ++theLine;
  112
+            }
112 113
         }
113  
-    }
114 114
 
115  
-NSUInteger theCharacter = current - theLineStart;
  115
+    NSUInteger theCharacter = current - theLineStart;
116 116
 
117  
-NSRange theStartRange = NSIntersectionRange((NSRange){ .location = MAX((NSInteger)self.scanLocation - 20, 0), .length = 20 + (NSInteger)self.scanLocation - 20 }, (NSRange){ .location = 0, .length = self.data.length });
118  
-NSRange theEndRange = NSIntersectionRange((NSRange){ .location = self.scanLocation, .length = 20 }, (NSRange){ .location = 0, .length = self.data.length });
  117
+    NSRange theStartRange = NSIntersectionRange((NSRange){ .location = MAX((NSInteger)self.scanLocation - 20, 0), .length = 20 + (NSInteger)self.scanLocation - 20 }, (NSRange){ .location = 0, .length = self.data.length });
  118
+    NSRange theEndRange = NSIntersectionRange((NSRange){ .location = self.scanLocation, .length = 20 }, (NSRange){ .location = 0, .length = self.data.length });
119 119
 
120 120
 
121  
-NSString *theSnippet = [NSString stringWithFormat:@"%@!HERE>!%@",
122  
-    [[[NSString alloc] initWithData:[self.data subdataWithRange:theStartRange] encoding:NSUTF8StringEncoding] autorelease],
123  
-    [[[NSString alloc] initWithData:[self.data subdataWithRange:theEndRange] encoding:NSUTF8StringEncoding] autorelease]
124  
-    ];
  121
+    NSString *theSnippet = [NSString stringWithFormat:@"%@!HERE>!%@",
  122
+        [[[NSString alloc] initWithData:[self.data subdataWithRange:theStartRange] encoding:NSUTF8StringEncoding] autorelease],
  123
+        [[[NSString alloc] initWithData:[self.data subdataWithRange:theEndRange] encoding:NSUTF8StringEncoding] autorelease]
  124
+        ];
125 125
 
126  
-NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
127  
-    [NSNumber numberWithUnsignedInteger:theLine], @"line",
128  
-    [NSNumber numberWithUnsignedInteger:theCharacter], @"character",
129  
-    [NSNumber numberWithUnsignedInteger:self.scanLocation], @"location",
130  
-    theSnippet, @"snippet",
131  
-    NULL];
132  
-return(theUserInfo);    
133  
-}
  126
+    NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
  127
+        [NSNumber numberWithUnsignedInteger:theLine], @"line",
  128
+        [NSNumber numberWithUnsignedInteger:theCharacter], @"character",
  129
+        [NSNumber numberWithUnsignedInteger:self.scanLocation], @"location",
  130
+        theSnippet, @"snippet",
  131
+        NULL];
  132
+    return(theUserInfo);    
  133
+    }
134 134
 
135 135
 @end
172  Source/JSON/CJSONDeserializer.m
@@ -42,119 +42,119 @@ @implementation CJSONDeserializer
42 42
 @synthesize scanner;
43 43
 
44 44
 + (id)deserializer
45  
-{
46  
-return([[[self alloc] init] autorelease]);
47  
-}
  45
+    {
  46
+    return([[[self alloc] init] autorelease]);
  47
+    }
48 48
 
49 49
 - (id)init
50  
-{
51  
-if ((self = [super init]) != NULL)
52 50
     {
  51
+    if ((self = [super init]) != NULL)
  52
+        {
  53
+        }
  54
+    return(self);
53 55
     }
54  
-return(self);
55  
-}
56 56
 
57 57
 - (void)dealloc
58  
-{
59  
-[scanner release];
60  
-scanner = NULL;
61  
-//
62  
-[super dealloc];
63  
-}
  58
+    {
  59
+    [scanner release];
  60
+    scanner = NULL;
  61
+    //
  62
+    [super dealloc];
  63
+    }
64 64
 
65 65
 #pragma mark -
66 66
 
67 67
 - (CJSONScanner *)scanner
68  
-{
69  
-if (scanner == NULL)
70  
-	{
71  
-	scanner = [[CJSONScanner alloc] init];
72  
-	}
73  
-return(scanner);
74  
-}
75  
-
76  
-- (id)nullObject
77 68
     {
78  
-    return(self.scanner.nullObject);
  69
+    if (scanner == NULL)
  70
+        {
  71
+        scanner = [[CJSONScanner alloc] init];
  72
+        }
  73
+    return(scanner);
79 74
     }
80 75
 
  76
+- (id)nullObject
  77
+        {
  78
+        return(self.scanner.nullObject);
  79
+        }
  80
+
81 81
 - (void)setNullObject:(id)inNullObject
82  
-    {
83  
-    self.scanner.nullObject = inNullObject;
84  
-    }
  82
+        {
  83
+        self.scanner.nullObject = inNullObject;
  84
+        }
85 85
 
86 86
 #pragma mark -
87 87
 
88 88
 - (NSStringEncoding)allowedEncoding
89  
-	{
90  
-	return(self.scanner.allowedEncoding);
91  
-	}
  89
+        {
  90
+        return(self.scanner.allowedEncoding);
  91
+        }
92 92
 
93 93
 - (void)setAllowedEncoding:(NSStringEncoding)inAllowedEncoding
94  
-	{
95  
-	self.scanner.allowedEncoding = inAllowedEncoding;
96  
-	}
  94
+        {
  95
+        self.scanner.allowedEncoding = inAllowedEncoding;
  96
+        }
97 97
 
98 98
 #pragma mark -
99 99
 
100 100
 - (id)deserialize:(NSData *)inData error:(NSError **)outError
101  
-{
102  
-if (inData == NULL || [inData length] == 0)
103  
-	{
104  
-	if (outError)
105  
-		*outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
106  
-
107  
-	return(NULL);
108  
-	}
109  
-if ([self.scanner setData:inData error:outError] == NO)
110  
-	{
111  
-	return(NULL);
112  
-	}
113  
-id theObject = NULL;
114  
-if ([self.scanner scanJSONObject:&theObject error:outError] == YES)
115  
-	return(theObject);
116  
-else
117  
-	return(NULL);
118  
-}
  101
+    {
  102
+    if (inData == NULL || [inData length] == 0)
  103
+        {
  104
+        if (outError)
  105
+            *outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
  106
+
  107
+        return(NULL);
  108
+        }
  109
+    if ([self.scanner setData:inData error:outError] == NO)
  110
+        {
  111
+        return(NULL);
  112
+        }
  113
+    id theObject = NULL;
  114
+    if ([self.scanner scanJSONObject:&theObject error:outError] == YES)
  115
+        return(theObject);
  116
+    else
  117
+        return(NULL);
  118
+    }
119 119
 
120 120
 - (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError
121  
-{
122  
-if (inData == NULL || [inData length] == 0)
123  
-	{
124  
-	if (outError)
125  
-		*outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
126  
-
127  
-	return(NULL);
128  
-	}
129  
-if ([self.scanner setData:inData error:outError] == NO)
130  
-	{
131  
-	return(NULL);
132  
-	}
133  
-NSDictionary *theDictionary = NULL;
134  
-if ([self.scanner scanJSONDictionary:&theDictionary error:outError] == YES)
135  
-	return(theDictionary);
136  
-else
137  
-	return(NULL);
138  
-}
  121
+    {
  122
+    if (inData == NULL || [inData length] == 0)
  123
+        {
  124
+        if (outError)
  125
+            *outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
  126
+
  127
+        return(NULL);
  128
+        }
  129
+    if ([self.scanner setData:inData error:outError] == NO)
  130
+        {
  131
+        return(NULL);
  132
+        }
  133
+    NSDictionary *theDictionary = NULL;
  134
+    if ([self.scanner scanJSONDictionary:&theDictionary error:outError] == YES)
  135
+        return(theDictionary);
  136
+    else
  137
+        return(NULL);
  138
+    }
139 139
 
140 140
 - (id)deserializeAsArray:(NSData *)inData error:(NSError **)outError
141  
-{
142  
-if (inData == NULL || [inData length] == 0)
143  
-	{
144  
-	if (outError)
145  
-		*outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
146  
-
147  
-	return(NULL);
148  
-	}
149  
-if ([self.scanner setData:inData error:outError] == NO)
150  
-	{
151  
-	return(NULL);
152  
-	}
153  
-NSArray *theArray = NULL;
154  
-if ([self.scanner scanJSONArray:&theArray error:outError] == YES)
155  
-	return(theArray);
156  
-else
157  
-	return(NULL);
158  
-}
  141
+    {
  142
+    if (inData == NULL || [inData length] == 0)
  143
+        {
  144
+        if (outError)
  145
+            *outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
  146
+
  147
+        return(NULL);
  148
+        }
  149
+    if ([self.scanner setData:inData error:outError] == NO)
  150
+        {
  151
+        return(NULL);
  152
+        }
  153
+    NSArray *theArray = NULL;
  154
+    if ([self.scanner scanJSONArray:&theArray error:outError] == YES)
  155
+        return(theArray);
  156
+    else
  157
+        return(NULL);
  158
+    }
159 159
 
160 160
 @end
1,034  Source/JSON/CJSONScanner.m
@@ -38,13 +38,13 @@
38 38
 NSString *const kJSONScannerErrorDomain = @"CJSONScannerErrorDomain";
39 39
 
40 40
 inline static int HexToInt(char inCharacter)
41  
-{
42  
-int theValues[] = { 0x0 /* 48 '0' */, 0x1 /* 49 '1' */, 0x2 /* 50 '2' */, 0x3 /* 51 '3' */, 0x4 /* 52 '4' */, 0x5 /* 53 '5' */, 0x6 /* 54 '6' */, 0x7 /* 55 '7' */, 0x8 /* 56 '8' */, 0x9 /* 57 '9' */, -1 /* 58 ':' */, -1 /* 59 ';' */, -1 /* 60 '<' */, -1 /* 61 '=' */, -1 /* 62 '>' */, -1 /* 63 '?' */, -1 /* 64 '@' */, 0xa /* 65 'A' */, 0xb /* 66 'B' */, 0xc /* 67 'C' */, 0xd /* 68 'D' */, 0xe /* 69 'E' */, 0xf /* 70 'F' */, -1 /* 71 'G' */, -1 /* 72 'H' */, -1 /* 73 'I' */, -1 /* 74 'J' */, -1 /* 75 'K' */, -1 /* 76 'L' */, -1 /* 77 'M' */, -1 /* 78 'N' */, -1 /* 79 'O' */, -1 /* 80 'P' */, -1 /* 81 'Q' */, -1 /* 82 'R' */, -1 /* 83 'S' */, -1 /* 84 'T' */, -1 /* 85 'U' */, -1 /* 86 'V' */, -1 /* 87 'W' */, -1 /* 88 'X' */, -1 /* 89 'Y' */, -1 /* 90 'Z' */, -1 /* 91 '[' */, -1 /* 92 '\' */, -1 /* 93 ']' */, -1 /* 94 '^' */, -1 /* 95 '_' */, -1 /* 96 '`' */, 0xa /* 97 'a' */, 0xb /* 98 'b' */, 0xc /* 99 'c' */, 0xd /* 100 'd' */, 0xe /* 101 'e' */, 0xf /* 102 'f' */, };
43  
-if (inCharacter >= '0' && inCharacter <= 'f')
44  
-	return(theValues[inCharacter - '0']);
45  
-else
46  
-	return(-1);
47  
-}
  41
+    {
  42
+    int theValues[] = { 0x0 /* 48 '0' */, 0x1 /* 49 '1' */, 0x2 /* 50 '2' */, 0x3 /* 51 '3' */, 0x4 /* 52 '4' */, 0x5 /* 53 '5' */, 0x6 /* 54 '6' */, 0x7 /* 55 '7' */, 0x8 /* 56 '8' */, 0x9 /* 57 '9' */, -1 /* 58 ':' */, -1 /* 59 ';' */, -1 /* 60 '<' */, -1 /* 61 '=' */, -1 /* 62 '>' */, -1 /* 63 '?' */, -1 /* 64 '@' */, 0xa /* 65 'A' */, 0xb /* 66 'B' */, 0xc /* 67 'C' */, 0xd /* 68 'D' */, 0xe /* 69 'E' */, 0xf /* 70 'F' */, -1 /* 71 'G' */, -1 /* 72 'H' */, -1 /* 73 'I' */, -1 /* 74 'J' */, -1 /* 75 'K' */, -1 /* 76 'L' */, -1 /* 77 'M' */, -1 /* 78 'N' */, -1 /* 79 'O' */, -1 /* 80 'P' */, -1 /* 81 'Q' */, -1 /* 82 'R' */, -1 /* 83 'S' */, -1 /* 84 'T' */, -1 /* 85 'U' */, -1 /* 86 'V' */, -1 /* 87 'W' */, -1 /* 88 'X' */, -1 /* 89 'Y' */, -1 /* 90 'Z' */, -1 /* 91 '[' */, -1 /* 92 '\' */, -1 /* 93 ']' */, -1 /* 94 '^' */, -1 /* 95 '_' */, -1 /* 96 '`' */, 0xa /* 97 'a' */, 0xb /* 98 'b' */, 0xc /* 99 'c' */, 0xd /* 100 'd' */, 0xe /* 101 'e' */, 0xf /* 102 'f' */, };
  43
+    if (inCharacter >= '0' && inCharacter <= 'f')
  44
+        return(theValues[inCharacter - '0']);
  45
+    else
  46
+        return(-1);
  47
+    }
48 48
 
49 49
 @interface CJSONScanner ()
50 50
 - (BOOL)scanNotQuoteCharactersIntoString:(NSString **)outValue;
@@ -59,583 +59,583 @@ @implementation CJSONScanner
59 59
 @synthesize allowedEncoding;
60 60
 
61 61
 - (id)init
62  
-{
63  
-if ((self = [super init]) != NULL)
64  
-	{
65  
-	strictEscapeCodes = NO;
66  
-    nullObject = [[NSNull null] retain];
67  
-	}
68  
-return(self);
69  
-}
  62
+    {
  63
+    if ((self = [super init]) != NULL)
  64
+        {
  65
+        strictEscapeCodes = NO;
  66
+        nullObject = [[NSNull null] retain];
  67
+        }
  68
+    return(self);
  69
+    }
70 70
 
71 71
 - (void)dealloc
72  
-{
73  
-[nullObject release];
74  
-nullObject = NULL;
75  
-//
76  
-[super dealloc];
77  
-}
  72
+    {
  73
+    [nullObject release];
  74
+    nullObject = NULL;
  75
+    //
  76
+    [super dealloc];
  77
+    }
78 78
 
79 79
 #pragma mark -
80 80
 
81 81
 - (BOOL)setData:(NSData *)inData error:(NSError **)outError;
82  
-{
83  
-NSData *theData = inData;
84  
-if (theData && theData.length >= 4)
85  
-	{
86  
-	// This code is lame, but it works. Because the first character of any JSON string will always be a (ascii) control character we can work out the Unicode encoding by the bit pattern. See section 3 of http://www.ietf.org/rfc/rfc4627.txt
87  
-	const char *theChars = theData.bytes;
88  
-	NSStringEncoding theEncoding = NSUTF8StringEncoding;
89  
-	if (theChars[0] != 0 && theChars[1] == 0)
90  
-		{
91  
-		if (theChars[2] != 0 && theChars[3] == 0)
92  
-			theEncoding = NSUTF16LittleEndianStringEncoding;
93  
-		else if (theChars[2] == 0 && theChars[3] == 0)
94  
-			theEncoding = NSUTF32LittleEndianStringEncoding;
95  
-		}
96  
-	else if (theChars[0] == 0 && theChars[2] == 0 && theChars[3] != 0)
97  
-		{
98  
-		if (theChars[1] == 0)
99  
-			theEncoding = NSUTF32BigEndianStringEncoding;
100  
-		else if (theChars[1] != 0)
101  
-			theEncoding = NSUTF16BigEndianStringEncoding;
102  
-		}
103  
-		
104  
-	NSString *theString = [[NSString alloc] initWithData:theData encoding:theEncoding];
105  
-	if (theString == NULL && self.allowedEncoding != 0)
106  
-		{
107  
-		theString = [[NSString alloc] initWithData:theData encoding:self.allowedEncoding];
108  
-		}
109  
-	theData = [theString dataUsingEncoding:NSUTF8StringEncoding];
110  
-	[theString release];
111  
-	}
112  
-
113  
-if (theData)
114  
-	{
115  
-	[super setData:theData];
116  
-	return(YES);
117  
-	}
118  
-else
119  
-	{
120  
-	if (outError)
121  
-		{
122  
-		NSMutableDictionary *theUserInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
123  
-			@"Could not scan data. Data wasn't encoded properly?", NSLocalizedDescriptionKey,
124  
-			NULL];
125  
-		[theUserInfo addEntriesFromDictionary:self.userInfoForScanLocation];
126  
-		*outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-1 userInfo:theUserInfo];
127  
-		}
128  
-	return(NO);
129  
-	}
130  
-}
  82
+    {
  83
+    NSData *theData = inData;
  84
+    if (theData && theData.length >= 4)
  85
+        {
  86
+        // This code is lame, but it works. Because the first character of any JSON string will always be a (ascii) control character we can work out the Unicode encoding by the bit pattern. See section 3 of http://www.ietf.org/rfc/rfc4627.txt
  87
+        const char *theChars = theData.bytes;
  88
+        NSStringEncoding theEncoding = NSUTF8StringEncoding;
  89
+        if (theChars[0] != 0 && theChars[1] == 0)
  90
+            {
  91
+            if (theChars[2] != 0 && theChars[3] == 0)
  92
+                theEncoding = NSUTF16LittleEndianStringEncoding;
  93
+            else if (theChars[2] == 0 && theChars[3] == 0)
  94
+                theEncoding = NSUTF32LittleEndianStringEncoding;
  95
+            }
  96
+        else if (theChars[0] == 0 && theChars[2] == 0 && theChars[3] != 0)
  97
+            {
  98
+            if (theChars[1] == 0)
  99
+                theEncoding = NSUTF32BigEndianStringEncoding;
  100
+            else if (theChars[1] != 0)
  101
+                theEncoding = NSUTF16BigEndianStringEncoding;
  102
+            }
  103
+            
  104
+        NSString *theString = [[NSString alloc] initWithData:theData encoding:theEncoding];
  105
+        if (theString == NULL && self.allowedEncoding != 0)
  106
+            {
  107
+            theString = [[NSString alloc] initWithData:theData encoding:self.allowedEncoding];
  108
+            }
  109
+        theData = [theString dataUsingEncoding:NSUTF8StringEncoding];
  110
+        [theString release];
  111
+        }
  112
+
  113
+    if (theData)
  114
+        {
  115
+        [super setData:theData];
  116
+        return(YES);
  117
+        }
  118
+    else
  119
+        {
  120
+        if (outError)
  121
+            {
  122
+            NSMutableDictionary *theUserInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
  123
+                @"Could not scan data. Data wasn't encoded properly?", NSLocalizedDescriptionKey,
  124
+                NULL];
  125
+            [theUserInfo addEntriesFromDictionary:self.userInfoForScanLocation];
  126
+            *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-1 userInfo:theUserInfo];
  127
+            }
  128
+        return(NO);
  129
+        }
  130
+    }
131 131
 
132 132
 - (void)setData:(NSData *)inData
133  
-{
134  
-[self setData:inData error:NULL];
135  
-}
  133
+    {
  134
+    [self setData:inData error:NULL];
  135
+    }
136 136
 
137 137
 #pragma mark -
138 138
 
139 139
 - (BOOL)scanJSONObject:(id *)outObject error:(NSError **)outError
140  
-{
141  
-BOOL theResult = YES;
142  
-
143  
-[self skipWhitespace];
144  
-
145  
-id theObject = NULL;
146  
-
147  
-const unichar C = [self currentCharacter];
148  
-switch (C)
149  
-	{
150  
-	case 't':
151  
-		if ([self scanUTF8String:"true" intoString:NULL])
152  
-			{
153  
-			theObject = [NSNumber numberWithBool:YES];
154  
-			}
155  
-		break;
156  
-	case 'f':
157  
-		if ([self scanUTF8String:"false" intoString:NULL])