CB-8351 Use argumentForIndex rather than NSArray extension
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/003bd2d9 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/003bd2d9 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/003bd2d9 Branch: refs/heads/master Commit: 003bd2d9bf6f98caea28f92a373ac0159b5b588e Parents: 2571351 Author: Andrew Grieve <agri...@chromium.org> Authored: Fri Jan 23 09:49:20 2015 -0500 Committer: Andrew Grieve <agri...@chromium.org> Committed: Fri Jan 23 09:49:20 2015 -0500 ---------------------------------------------------------------------- src/ios/CDVFile.m | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/003bd2d9/src/ios/CDVFile.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m index c0deb32..7242aee 100644 --- a/src/ios/CDVFile.m +++ b/src/ios/CDVFile.m @@ -411,11 +411,9 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; - (void)requestFileSystem:(CDVInvokedUrlCommand*)command { - NSArray* arguments = command.arguments; - // arguments - NSString* strType = [arguments objectAtIndex:0]; - unsigned long long size = [[arguments objectAtIndex:1] longLongValue]; + NSString* strType = [command argumentAtIndex:0]; + unsigned long long size = [[command argumentAtIndex:1] longLongValue]; int type = [strType intValue]; CDVPluginResult* result = nil; @@ -536,7 +534,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; - (void)resolveLocalFileSystemURI:(CDVInvokedUrlCommand*)command { // arguments - NSString* localURIstr = [command.arguments objectAtIndex:0]; + NSString* localURIstr = [command argumentAtIndex:0]; CDVPluginResult* result; localURIstr = [self encodePath:localURIstr]; //encode path before resolving @@ -584,7 +582,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; NSMutableDictionary* options = nil; if ([arguments count] >= 3) { - options = [arguments objectAtIndex:2 withDefault:nil]; + options = [command argumentAtIndex:2 withDefault:nil]; } // add getDir to options and call getFile() if (options != nil) { @@ -622,10 +620,10 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; */ - (void)getFile:(CDVInvokedUrlCommand*)command { - NSString* baseURIstr = [command.arguments objectAtIndex:0]; + NSString* baseURIstr = [command argumentAtIndex:0]; CDVFilesystemURL* baseURI = [self fileSystemURLforArg:baseURIstr]; - NSString* requestedPath = [command.arguments objectAtIndex:1]; - NSDictionary* options = [command.arguments objectAtIndex:2 withDefault:nil]; + NSString* requestedPath = [command argumentAtIndex:1]; + NSDictionary* options = [command argumentAtIndex:2 withDefault:nil]; NSObject<CDVFileSystem> *fs = [self filesystemForURL:baseURI]; CDVPluginResult* result = [fs getFileForURL:baseURI requestedPath:requestedPath options:options]; @@ -662,7 +660,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; { // arguments CDVFilesystemURL* localURI = [self fileSystemURLforArg:command.arguments[0]]; - NSDictionary* options = [command.arguments objectAtIndex:1 withDefault:nil]; + NSDictionary* options = [command argumentAtIndex:1 withDefault:nil]; NSObject<CDVFileSystem> *fs = [self filesystemForURL:localURI]; CDVPluginResult* result = [fs setMetadataForURL:localURI withObject:options]; @@ -741,8 +739,8 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; NSArray* arguments = command.arguments; // arguments - NSString* srcURLstr = [arguments objectAtIndex:0]; - NSString* destURLstr = [arguments objectAtIndex:1]; + NSString* srcURLstr = [command argumentAtIndex:0]; + NSString* destURLstr = [command argumentAtIndex:1]; CDVPluginResult *result; @@ -760,7 +758,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; NSObject<CDVFileSystem> *destFs = [self filesystemForURL:destURL]; // optional argument; use last component from srcFullPath if new name not provided - NSString* newName = ([arguments count] > 2) ? [arguments objectAtIndex:2] : [srcURL.url lastPathComponent]; + NSString* newName = ([arguments count] > 2) ? [command argumentAtIndex:2] : [srcURL.url lastPathComponent]; if ([newName rangeOfString:@":"].location != NSNotFound) { // invalid chars in new name result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsInt:ENCODING_ERR]; @@ -941,7 +939,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; { // arguments CDVFilesystemURL* localURI = [self fileSystemURLforArg:command.arguments[0]]; - unsigned long long pos = (unsigned long long)[[command.arguments objectAtIndex:1] longLongValue]; + unsigned long long pos = (unsigned long long)[[command argumentAtIndex:1] longLongValue]; NSObject<CDVFileSystem> *fs = [self filesystemForURL:localURI]; CDVPluginResult *result = [fs truncateFileAtURL:localURI atPosition:pos]; @@ -960,12 +958,11 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; { [self.commandDelegate runInBackground:^ { NSString* callbackId = command.callbackId; - NSArray* arguments = command.arguments; // arguments CDVFilesystemURL* localURI = [self fileSystemURLforArg:command.arguments[0]]; - id argData = [arguments objectAtIndex:1]; - unsigned long long pos = (unsigned long long)[[arguments objectAtIndex:2] longLongValue]; + id argData = [command argumentAtIndex:1]; + unsigned long long pos = (unsigned long long)[[command argumentAtIndex:2] longLongValue]; NSObject<CDVFileSystem> *fs = [self filesystemForURL:localURI]; @@ -1003,7 +1000,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; - (void)testFileExists:(CDVInvokedUrlCommand*)command { // arguments - NSString* argPath = [command.arguments objectAtIndex:0]; + NSString* argPath = [command argumentAtIndex:0]; // Get the file manager NSFileManager* fMgr = [NSFileManager defaultManager]; @@ -1018,7 +1015,7 @@ NSString* const kCDVFilesystemURLPrefix = @"cdvfile"; - (void)testDirectoryExists:(CDVInvokedUrlCommand*)command { // arguments - NSString* argPath = [command.arguments objectAtIndex:0]; + NSString* argPath = [command argumentAtIndex:0]; // Get the file manager NSFileManager* fMgr = [[NSFileManager alloc] init]; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org