diff options
author | Joseph Heenan <joseph@emobix.co.uk> | 2016-06-05 12:45:58 +0100 |
---|---|---|
committer | Joseph Heenan <joseph@emobix.co.uk> | 2016-06-09 10:57:47 +0100 |
commit | f53d79f0afd39d47f173530c59a00eb16b12bcba (patch) | |
tree | 208ec4e3cb2902e475cf5fd3338c523dd15c0efa /platform/ios/Classes/MuLibraryController.m | |
parent | 917b8ef89a75fbbce80a6eba506829f45470645c (diff) | |
download | mupdf-f53d79f0afd39d47f173530c59a00eb16b12bcba.tar.xz |
iOS: Replace char * with NSString in ObjC APIs
What is effectively our external API on iOS would be expected to use
NSString rather than char *.
Diffstat (limited to 'platform/ios/Classes/MuLibraryController.m')
-rw-r--r-- | platform/ios/Classes/MuLibraryController.m | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/platform/ios/Classes/MuLibraryController.m b/platform/ios/Classes/MuLibraryController.m index e5a1787f..10541475 100644 --- a/platform/ios/Classes/MuLibraryController.m +++ b/platform/ios/Classes/MuLibraryController.m @@ -20,7 +20,7 @@ static void showAlert(NSString *msg, NSString *filename) NSTimer *timer; MuDocRef *doc; NSString *_filename; - char *_filePath; + NSString *_filePath; } - (void) viewWillAppear: (BOOL)animated @@ -186,16 +186,13 @@ static NSString *moveOutOfInbox(NSString *docpath) - (void) openDocument: (NSString*)nsfilename { nsfilename = moveOutOfInbox(nsfilename); - NSString *nspath = [[NSArray arrayWithObjects:NSHomeDirectory(), @"Documents", nsfilename, nil] - componentsJoinedByString:@"/"]; - _filePath = malloc(strlen([nspath UTF8String])+1); + _filePath = [[[NSArray arrayWithObjects:NSHomeDirectory(), @"Documents", nsfilename, nil] + componentsJoinedByString:@"/"] retain]; if (_filePath == NULL) { showAlert(@"Out of memory in openDocument", nsfilename); return; } - strcpy(_filePath, [nspath UTF8String]); - dispatch_sync(queue, ^{}); _filename = [nsfilename retain]; @@ -227,7 +224,7 @@ static NSString *moveOutOfInbox(NSString *docpath) - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - char *password = (char*) [[[alertView textFieldAtIndex: 0] text] UTF8String]; + const char *password = [[[alertView textFieldAtIndex: 0] text] UTF8String]; [alertView dismissWithClickedButtonIndex: buttonIndex animated: TRUE]; if (buttonIndex == 1) { if (fz_authenticate_password(ctx, doc->doc, password)) @@ -248,13 +245,13 @@ static NSString *moveOutOfInbox(NSString *docpath) [document release]; } [_filename release]; - free(_filePath); + [_filePath release]; } - (void) onPasswordCancel { [_filename release]; - free(_filePath); + [_filePath release]; } @end |