Index: trunk/tools/WikiSnaps/Classes/ImageUploadViewController.m |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | } |
101 | 101 | |
102 | 102 | - (void)uploadFailed:(NSString *)error { |
103 | | - NSLog(error); |
| 103 | + NSLog(@"%@", error); |
104 | 104 | [self.navigationController popToRootViewControllerAnimated:YES]; |
105 | 105 | } |
106 | 106 | |
Index: trunk/tools/WikiSnaps/Classes/XMLtoDict/XMLReader.h |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | #import <Foundation/Foundation.h> |
8 | 8 | |
9 | 9 | |
10 | | -@interface XMLReader : NSObject |
| 10 | +@interface XMLReader : NSObject <NSXMLParserDelegate> |
11 | 11 | { |
12 | 12 | NSMutableArray *dictionaryStack; |
13 | 13 | NSMutableString *textInProgress; |
Index: trunk/tools/WikiSnaps/Classes/XMLtoDict/XMLReader.m |
— | — | @@ -68,6 +68,7 @@ |
69 | 69 | NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; |
70 | 70 | parser.delegate = self; |
71 | 71 | BOOL success = [parser parse]; |
| 72 | + [parser release]; |
72 | 73 | |
73 | 74 | // Return the stack's root dictionary on success |
74 | 75 | if (success) |
Index: trunk/tools/WikiSnaps/Classes/CommonsUpload.m |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | /* Private */ |
18 | 18 | @interface CommonsUpload (Internal) |
19 | 19 | |
20 | | -- (void)checkXML: (NSDictionary *)dict forAPIError: (NSError **)error; |
| 20 | +- (BOOL)checkXML: (NSDictionary *)dict forAPIError: (NSError **)error; |
21 | 21 | @end |
22 | 22 | |
23 | 23 | |
— | — | @@ -33,7 +33,9 @@ |
34 | 34 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; |
35 | 35 | [formatter setDateFormat:@"yyyy-MM-dd"]; |
36 | 36 | NSString *dateString = [formatter stringFromDate:today]; |
37 | | - NSLog(dateString); |
| 37 | + [formatter release]; |
| 38 | + |
| 39 | + NSLog(@"%@", dateString); |
38 | 40 | |
39 | 41 | return [NSString stringWithFormat: @"{{Information\n|Description={{en|1=%@}}\n|Author=[[User:%@]]\n|Source={{own}}\n|Date=%@\n|Permission=\n|other_versions=\n}}\n\n== {{int:license}} ==\n%@\n\n[[Category:%@]]", |
40 | 42 | description, |
— | — | @@ -298,17 +300,23 @@ |
299 | 301 | return NO; |
300 | 302 | } |
301 | 303 | |
302 | | -- (void)checkXML: (NSDictionary *)dict forAPIError: (NSError **)error { |
| 304 | +/** |
| 305 | + * @return true if the XML was good, false if an error occured |
| 306 | + */ |
| 307 | +- (BOOL)checkXML: (NSDictionary *)dict forAPIError: (NSError **)error { |
303 | 308 | NSDictionary *errorDict = [[dict objectForKey:@"api"] objectForKey: @"error"]; |
304 | 309 | if( errorDict ) { |
305 | 310 | NSMutableDictionary *nsErrorDict = [NSMutableDictionary dictionaryWithCapacity:5]; |
306 | 311 | [nsErrorDict setObject: @"Communication failure with server" forKey: NSLocalizedDescriptionKey ]; |
307 | 312 | [nsErrorDict setObject: [errorDict objectForKey:@"info"] forKey: NSLocalizedFailureReasonErrorKey ]; |
308 | | -NSLog( [errorDict objectForKey:@"info"] ); |
| 313 | +NSLog( @"%@", [errorDict objectForKey:@"info"] ); |
309 | 314 | |
310 | | - NSError *APIError = [NSError errorWithDomain: @"COMMONS_API_DOMAIN" code: 1 userInfo: nsErrorDict]; |
311 | | - *error = APIError; |
| 315 | + if (error != NULL) { |
| 316 | + *error = [NSError errorWithDomain: @"COMMONS_API_DOMAIN" code: 1 userInfo: nsErrorDict]; |
| 317 | + } |
| 318 | + return FALSE; |
312 | 319 | } |
| 320 | + return TRUE; |
313 | 321 | } |
314 | 322 | |
315 | 323 | @end |