@@ -252,16 +252,11 @@ return archive; } - (void)listFilesInArchive: (OFZIPArchive*)archive { - OFEnumerator OF_GENERIC(OFZIPArchiveEntry*) *enumerator; - OFZIPArchiveEntry *entry; - - enumerator = [[archive entries] objectEnumerator]; - - while ((entry = [enumerator nextObject]) != nil) { + for (OFZIPArchiveEntry *entry in [archive entries]) { void *pool = objc_autoreleasePoolPush(); [of_stdout writeLine: [entry fileName]]; if (_outputLevel >= 1) { @@ -311,26 +306,20 @@ - (void)extractFiles: (OFArray OF_GENERIC(OFString*)*)files fromArchive: (OFZIPArchive*)archive { OFFileManager *fileManager = [OFFileManager defaultManager]; - OFEnumerator OF_GENERIC(OFZIPArchiveEntry*) *entryEnumerator; - OFZIPArchiveEntry *entry; - bool all; - OFMutableSet OF_GENERIC(OFString*) *missing; - - all = ([files count] == 0); - missing = [OFMutableSet setWithArray: files]; - - entryEnumerator = [[archive entries] objectEnumerator]; - while ((entry = [entryEnumerator nextObject]) != nil) { + bool all = ([files count] == 0); + OFMutableSet OF_GENERIC(OFString*) *missing = + [OFMutableSet setWithArray: files]; + + for (OFZIPArchiveEntry *entry in [archive entries]) { void *pool = objc_autoreleasePoolPush(); OFString *fileName = [entry fileName]; OFString *outFileName = [fileName stringByStandardizingPath]; OFArray OF_GENERIC(OFString*) *pathComponents; - OFEnumerator OF_GENERIC(OFString*) *componentEnumerator; - OFString *component, *directory; + OFString *directory; OFStream *stream; OFFile *output; char buffer[BUFFER_SIZE]; uint64_t written = 0, size = [entry uncompressedSize]; int_fast8_t percent = -1, newPercent; @@ -352,12 +341,11 @@ _exitStatus = 1; goto outer_loop_end; } pathComponents = [outFileName pathComponents]; - componentEnumerator = [pathComponents objectEnumerator]; - while ((component = [componentEnumerator nextObject]) != nil) { + for (OFString *component in pathComponents) { if ([component isEqual: OF_PATH_PARENT_DIRECTORY]) { [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; _exitStatus = 1; @@ -478,17 +466,13 @@ outer_loop_end: objc_autoreleasePoolPop(pool); } if ([missing count] > 0) { - OFEnumerator OF_GENERIC(OFString*) *enumerator; - OFString *file; - - enumerator = [missing objectEnumerator]; - while ((file = [enumerator nextObject]) != nil) + for (OFString *file in missing) [of_stderr writeFormat: @"File %@ is not in the archive!\n", file]; _exitStatus = 1; } } @end