summaryrefslogtreecommitdiff
path: root/platform/ios/Classes/MuLibraryController.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/Classes/MuLibraryController.m')
-rw-r--r--platform/ios/Classes/MuLibraryController.m15
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