@@ -174,18 +174,18 @@ OFArray OF_GENERIC(OFString *) *remainingArguments, *files; id archive; #ifdef OF_HAVE_SANDBOX OFSandbox *sandbox = [OFSandbox sandbox]; - [sandbox setAllowsStdIO: true]; - [sandbox setAllowsReadingFiles: true]; - [sandbox setAllowsWritingFiles: true]; - [sandbox setAllowsCreatingFiles: true]; - [sandbox setAllowsChangingFileAttributes: true]; - [sandbox setAllowsUserDatabaseReading: true]; + sandbox.allowsStdIO = true; + sandbox.allowsReadingFiles = true; + sandbox.allowsWritingFiles = true; + sandbox.allowsCreatingFiles = true; + sandbox.allowsChangingFileAttributes = true; + sandbox.allowsUserDatabaseReading = true; /* Dropped after parsing options */ - [sandbox setAllowsUnveil: true]; + sandbox.allowsUnveil = true; [OFApplication activateSandbox: sandbox]; #endif #ifndef OF_AMIGAOS @@ -246,26 +246,26 @@ case '=': [of_stderr writeLine: OF_LOCALIZED( @"option_takes_no_argument", @"%[prog]: Option --%[opt] takes no argument", @"prog", [OFApplication programName], - @"opt", [optionsParser lastLongOption])]; + @"opt", optionsParser.lastLongOption)]; [OFApplication terminateWithStatus: 1]; break; case ':': - if ([optionsParser lastLongOption] != nil) + if (optionsParser.lastLongOption != nil) [of_stderr writeLine: OF_LOCALIZED( @"long_option_requires_argument", @"%[prog]: Option --%[opt] requires an " @"argument", @"prog", [OFApplication programName], - @"opt", [optionsParser lastLongOption])]; + @"opt", optionsParser.lastLongOption)]; else { OFString *optStr = [OFString stringWithFormat: @"%C", - [optionsParser lastOption]]; + optionsParser.lastOption]; [of_stderr writeLine: OF_LOCALIZED( @"option_requires_argument", @"%[prog]: Option -%[opt] requires an " @"argument", @"prog", [OFApplication programName], @@ -273,20 +273,20 @@ } [OFApplication terminateWithStatus: 1]; break; case '?': - if ([optionsParser lastLongOption] != nil) + if (optionsParser.lastLongOption != nil) [of_stderr writeLine: OF_LOCALIZED( @"unknown_long_option", @"%[prog]: Unknown option: --%[opt]", @"prog", [OFApplication programName], - @"opt", [optionsParser lastLongOption])]; + @"opt", optionsParser.lastLongOption)]; else { OFString *optStr = [OFString stringWithFormat: @"%C", - [optionsParser lastOption]]; + optionsParser.lastOption]; [of_stderr writeLine: OF_LOCALIZED( @"unknown_option", @"%[prog]: Unknown option: -%[opt]", @"prog", [OFApplication programName], @"opt", optStr)]; @@ -307,94 +307,94 @@ @"encoding", encodingString)]; [OFApplication terminateWithStatus: 1]; } - remainingArguments = [optionsParser remainingArguments]; + remainingArguments = optionsParser.remainingArguments; switch (mode) { case 'a': case 'c': - if ([remainingArguments count] < 1) + if (remainingArguments.count < 1) help(of_stderr, false, 1); files = [remainingArguments objectsInRange: - of_range(1, [remainingArguments count] - 1)]; + of_range(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX - [sandbox unveilPath: [remainingArguments firstObject] + [sandbox unveilPath: remainingArguments.firstObject permissions: (mode == 'a' ? @"rwc" : @"wc")]; for (OFString *path in files) [sandbox unveilPath: path permissions: @"r"]; - [sandbox setAllowsUnveil: false]; + sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif archive = [self - openArchiveWithPath: [remainingArguments firstObject] + openArchiveWithPath: remainingArguments.firstObject type: type mode: mode encoding: encoding]; [archive addFiles: files]; break; case 'l': - if ([remainingArguments count] != 1) + if (remainingArguments.count != 1) help(of_stderr, false, 1); #ifdef OF_HAVE_SANDBOX - [sandbox unveilPath: [remainingArguments firstObject] + [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"]; - [sandbox setAllowsUnveil: false]; + sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif archive = [self - openArchiveWithPath: [remainingArguments firstObject] + openArchiveWithPath: remainingArguments.firstObject type: type mode: mode encoding: encoding]; [archive listFiles]; break; case 'p': - if ([remainingArguments count] < 1) + if (remainingArguments.count < 1) help(of_stderr, false, 1); #ifdef OF_HAVE_SANDBOX - [sandbox unveilPath: [remainingArguments firstObject] + [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"]; - [sandbox setAllowsUnveil: false]; + sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif files = [remainingArguments objectsInRange: - of_range(1, [remainingArguments count] - 1)]; + of_range(1, remainingArguments.count - 1)]; archive = [self - openArchiveWithPath: [remainingArguments firstObject] + openArchiveWithPath: remainingArguments.firstObject type: type mode: mode encoding: encoding]; [archive printFiles: files]; break; case 'x': - if ([remainingArguments count] < 1) + if (remainingArguments.count < 1) help(of_stderr, false, 1); files = [remainingArguments objectsInRange: - of_range(1, [remainingArguments count] - 1)]; + of_range(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX - [sandbox unveilPath: [remainingArguments firstObject] + [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"]; - if ([files count] > 0) + if (files.count > 0) for (OFString *path in files) [sandbox unveilPath: path permissions: @"wc"]; else { OFString *path = (outputDir != nil @@ -402,16 +402,16 @@ /* We need 'r' to change the directory to it. */ [sandbox unveilPath: path permissions: @"rwc"]; } - [sandbox setAllowsUnveil: false]; + sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif archive = [self - openArchiveWithPath: [remainingArguments firstObject] + openArchiveWithPath: remainingArguments.firstObject type: type mode: mode encoding: encoding]; if (outputDir != nil) @@ -420,28 +420,28 @@ @try { [archive extractFiles: files]; } @catch (OFCreateDirectoryFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_create_directory", @"Failed to create directory %[dir]: %[error]", - @"dir", [[e URL] fileSystemRepresentation], + @"dir", e.URL.fileSystemRepresentation, @"error", error)]; _exitStatus = 1; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_open_file", @"Failed to open file %[file]: %[error]", - @"file", [e path], + @"file", e.path, @"error", error)]; _exitStatus = 1; } break; @@ -488,17 +488,17 @@ @try { file = [OFFile fileWithPath: path mode: fileModeString]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_open_file", @"Failed to open file %[file]: %[error]", - @"file", [e path], + @"file", e.path, @"error", error)]; [OFApplication terminateWithStatus: 1]; } if (type == nil || [type isEqual: @"auto"]) { @@ -546,30 +546,29 @@ @"Unknown archive type: %[type]", @"type", type)]; goto error; } } @catch (OFNotImplementedException *e) { - if ((mode == 'a' || mode == 'c') && - sel_isEqual([e selector], + if ((mode == 'a' || mode == 'c') && sel_isEqual(e.selector, @selector(initWithStream:mode:))) { writingNotSupported(type); goto error; } @throw e; } @catch (OFReadFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_read_file", @"Failed to read file %[file]: %[error]", @"file", path, @"error", error)]; goto error; } @catch (OFSeekFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_seek_in_file", @"Failed to seek in file %[file]: %[error]", @"file", path, @"error", error)]; @@ -666,11 +665,11 @@ @try { length = [input readIntoBuffer: buffer length: BUFFER_SIZE]; } @catch (OFReadFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stdout writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_read_file", @"Failed to read file %[file]: %[error]", @"file", fileName, @@ -681,11 +680,11 @@ @try { [output writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFString *error = [OFString - stringWithCString: strerror([e errNo]) + stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stdout writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_write_file", @"Failed to write file %[file]: %[error]", @"file", fileName, @@ -698,11 +697,11 @@ - (OFString *)safeLocalPathForPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); - path = [path stringByStandardizingPath]; + path = path.stringByStandardizingPath; #if defined(OF_WINDOWS) || defined(OF_MSDOS) if ([path containsString: @":"] || [path hasPrefix: @"\\"]) { #elif defined(OF_AMIGAOS) if ([path containsString: @":"] || [path hasPrefix: @"/"]) { @@ -711,11 +710,11 @@ #endif objc_autoreleasePoolPop(pool); return nil; } - if ([path length] == 0) { + if (path.length == 0) { objc_autoreleasePoolPop(pool); return nil; } /* @@ -722,15 +721,15 @@ * After -[stringByStandardizingPath], everything representing parent * directory should be at the beginning, so in theory checking the * first component should be enough. But it does not hurt being * paranoid and checking all components, just in case. */ - for (OFString *component in [path pathComponents]) { + for (OFString *component in path.pathComponents) { #ifdef OF_AMIGAOS - if ([component length] == 0 || [component isEqual: @"/"]) { + if (component.length == 0 || [component isEqual: @"/"]) { #else - if ([component length] == 0 || [component isEqual: @".."]) { + if (component.length == 0 || [component isEqual: @".."]) { #endif objc_autoreleasePoolPop(pool); return nil; } }