Authored by Justin R. Miller

resolve some very subtle memory problems under non-ARC

@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 { 67 {
68 if ( ! _imageURLString) 68 if ( ! _imageURLString)
69 { 69 {
70 - NSString *imagerySetString; 70 + NSString *imagerySetString = nil;
71 71
72 if (_imagerySet == RMBingImagerySetAerial) 72 if (_imagerySet == RMBingImagerySetAerial)
73 imagerySetString = @"Aerial"; 73 imagerySetString = @"Aerial";
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 [[NSNotificationCenter defaultCenter] postNotificationName:RMTileRequested object:[NSNumber numberWithUnsignedLongLong:RMTileKey(tile)]]; 103 [[NSNotificationCenter defaultCenter] postNotificationName:RMTileRequested object:[NSNumber numberWithUnsignedLongLong:RMTileKey(tile)]];
104 }); 104 });
105 105
106 - __block UIImage *image; 106 + __block UIImage *image = nil;
107 107
108 [queue inDatabase:^(FMDatabase *db) 108 [queue inDatabase:^(FMDatabase *db)
109 { 109 {
@@ -250,7 +250,7 @@ @@ -250,7 +250,7 @@
250 250
251 - (NSString *)legend 251 - (NSString *)legend
252 { 252 {
253 - __block NSString *legend; 253 + __block NSString *legend = nil;
254 254
255 [queue inDatabase:^(FMDatabase *db) 255 [queue inDatabase:^(FMDatabase *db)
256 { 256 {
@@ -332,7 +332,7 @@ @@ -332,7 +332,7 @@
332 332
333 - (NSString *)shortName 333 - (NSString *)shortName
334 { 334 {
335 - __block NSString *shortName; 335 + __block NSString *shortName = nil;
336 336
337 [queue inDatabase:^(FMDatabase *db) 337 [queue inDatabase:^(FMDatabase *db)
338 { 338 {
@@ -353,7 +353,7 @@ @@ -353,7 +353,7 @@
353 353
354 - (NSString *)longDescription 354 - (NSString *)longDescription
355 { 355 {
356 - __block NSString *description; 356 + __block NSString *description = nil;
357 357
358 [queue inDatabase:^(FMDatabase *db) 358 [queue inDatabase:^(FMDatabase *db)
359 { 359 {
@@ -374,7 +374,7 @@ @@ -374,7 +374,7 @@
374 374
375 - (NSString *)shortAttribution 375 - (NSString *)shortAttribution
376 { 376 {
377 - __block NSString *attribution; 377 + __block NSString *attribution = nil;
378 378
379 [queue inDatabase:^(FMDatabase *db) 379 [queue inDatabase:^(FMDatabase *db)
380 { 380 {
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 options:0 70 options:0
71 error:nil] retain]; 71 error:nil] retain];
72 72
73 - id dataObject; 73 + id dataObject = nil;
74 74
75 if (mapView && (dataObject = [_infoDictionary objectForKey:@"data"]) && dataObject) 75 if (mapView && (dataObject = [_infoDictionary objectForKey:@"data"]) && dataObject)
76 { 76 {
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 { 80 {
81 NSURL *dataURL = [NSURL URLWithString:[dataObject objectAtIndex:0]]; 81 NSURL *dataURL = [NSURL URLWithString:[dataObject objectAtIndex:0]];
82 82
83 - NSMutableString *jsonString; 83 + NSMutableString *jsonString = nil;
84 84
85 if (dataURL && (jsonString = [NSMutableString stringWithContentsOfURL:dataURL encoding:NSUTF8StringEncoding error:nil]) && jsonString) 85 if (dataURL && (jsonString = [NSMutableString stringWithContentsOfURL:dataURL encoding:NSUTF8StringEncoding error:nil]) && jsonString)
86 { 86 {
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 [jsonString replaceCharactersInRange:NSMakeRange([jsonString length] - 2, 2) withString:@""]; 90 [jsonString replaceCharactersInRange:NSMakeRange([jsonString length] - 2, 2) withString:@""];
91 } 91 }
92 92
93 - id jsonObject; 93 + id jsonObject = nil;
94 94
95 if ((jsonObject = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]) && [jsonObject isKindOfClass:[NSDictionary class]]) 95 if ((jsonObject = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]) && [jsonObject isKindOfClass:[NSDictionary class]])
96 { 96 {
@@ -146,7 +146,7 @@ @@ -146,7 +146,7 @@
146 146
147 - (id)initWithReferenceURL:(NSURL *)referenceURL enablingDataOnMapView:(RMMapView *)mapView 147 - (id)initWithReferenceURL:(NSURL *)referenceURL enablingDataOnMapView:(RMMapView *)mapView
148 { 148 {
149 - id dataObject; 149 + id dataObject = nil;
150 150
151 if ([[referenceURL pathExtension] isEqualToString:@"jsonp"]) 151 if ([[referenceURL pathExtension] isEqualToString:@"jsonp"])
152 referenceURL = [NSURL URLWithString:[[referenceURL absoluteString] stringByReplacingOccurrencesOfString:@".jsonp" 152 referenceURL = [NSURL URLWithString:[[referenceURL absoluteString] stringByReplacingOccurrencesOfString:@".jsonp"
@@ -198,7 +198,7 @@ @@ -198,7 +198,7 @@
198 if ([self.infoDictionary objectForKey:@"scheme"] && [[self.infoDictionary objectForKey:@"scheme"] isEqual:@"tms"]) 198 if ([self.infoDictionary objectForKey:@"scheme"] && [[self.infoDictionary objectForKey:@"scheme"] isEqual:@"tms"])
199 y = pow(2, zoom) - tile.y - 1; 199 y = pow(2, zoom) - tile.y - 1;
200 200
201 - NSString *tileURLString; 201 + NSString *tileURLString = nil;
202 202
203 if ([self.infoDictionary objectForKey:@"tiles"]) 203 if ([self.infoDictionary objectForKey:@"tiles"])
204 tileURLString = [[self.infoDictionary objectForKey:@"tiles"] objectAtIndex:0]; 204 tileURLString = [[self.infoDictionary objectForKey:@"tiles"] objectAtIndex:0];
@@ -212,7 +212,7 @@ @@ -212,7 +212,7 @@
212 212
213 if (_imageQuality != RMMapBoxSourceQualityFull) 213 if (_imageQuality != RMMapBoxSourceQualityFull)
214 { 214 {
215 - NSString *qualityExtension; 215 + NSString *qualityExtension = nil;
216 216
217 switch (_imageQuality) 217 switch (_imageQuality)
218 { 218 {
@@ -282,7 +282,7 @@ @@ -282,7 +282,7 @@
282 { 282 {
283 id bounds = [self.infoDictionary objectForKey:@"bounds"]; 283 id bounds = [self.infoDictionary objectForKey:@"bounds"];
284 284
285 - NSArray *parts; 285 + NSArray *parts = nil;
286 286
287 if ([bounds isKindOfClass:[NSArray class]]) 287 if ([bounds isKindOfClass:[NSArray class]])
288 parts = bounds; 288 parts = bounds;
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
94 94
95 - (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColor:(UIColor *)color size:(RMMarkerMapBoxImageSize)size 95 - (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColor:(UIColor *)color size:(RMMarkerMapBoxImageSize)size
96 { 96 {
97 - NSString *sizeString; 97 + NSString *sizeString = nil;
98 98
99 switch (size) 99 switch (size)
100 { 100 {
@@ -112,7 +112,7 @@ @@ -112,7 +112,7 @@
112 break; 112 break;
113 } 113 }
114 114
115 - NSString *colorHex; 115 + NSString *colorHex = nil;
116 116
117 if (color) 117 if (color)
118 { 118 {
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
140 (colorHex ? [@"+" stringByAppendingString:[colorHex stringByReplacingOccurrencesOfString:@"#" withString:@""]] : @"+ff0000"), 140 (colorHex ? [@"+" stringByAppendingString:[colorHex stringByReplacingOccurrencesOfString:@"#" withString:@""]] : @"+ff0000"),
141 (useRetina ? @"@2x" : @"")]]; 141 (useRetina ? @"@2x" : @"")]];
142 142
143 - UIImage *image; 143 + UIImage *image = nil;
144 144
145 NSString *cachePath = [NSString stringWithFormat:@"%@/%@", kCachesPath, [imageURL lastPathComponent]]; 145 NSString *cachePath = [NSString stringWithFormat:@"%@/%@", kCachesPath, [imageURL lastPathComponent]];
146 146