Overview
Comment: | OFZIP: Keep going after non-fatal errors.
The error will be reported instantly, but the program will not terminate |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7e6942f3487eedf41a6851ab44d54099 |
User & Date: | js on 2013-12-21 01:12:29 |
Other Links: | manifest | tags |
Context
2013-12-21
| ||
01:26 | OFZIPArchive: Better handling of invalid archives. check-in: 9e2ddb3a59 user: js tags: trunk | |
01:12 | OFZIP: Keep going after non-fatal errors. check-in: 7e6942f348 user: js tags: trunk | |
01:10 | OFZIP: Add quiet mode. check-in: 8e35da9d61 user: js tags: trunk | |
Changes
Modified utils/OFZIP.m from [6b66318439] to [a3579a0193].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #import "macros.h" #define BUFFER_SIZE 4096 @interface OFZIP: OFObject { int_fast8_t _override, _outputLevel; } - (void)listFilesInArchive: (OFZIPArchive*)archive; - (void)extractFiles: (OFArray*)files fromArchive: (OFZIPArchive*)archive; @end | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "macros.h" #define BUFFER_SIZE 4096 @interface OFZIP: OFObject { int_fast8_t _override, _outputLevel; int _exitStatus; } - (void)listFilesInArchive: (OFZIPArchive*)archive; - (void)extractFiles: (OFArray*)files fromArchive: (OFZIPArchive*)archive; @end |
︙ | ︙ | |||
131 132 133 134 135 136 137 | fromArchive: archive]; break; default: help(of_stderr, true, 1); break; } | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | fromArchive: archive]; break; default: help(of_stderr, true, 1); break; } [OFApplication terminateWithStatus: _exitStatus]; } - (void)listFilesInArchive: (OFZIPArchive*)archive { OFEnumerator *enumerator = [[archive entries] objectEnumerator]; OFZIPArchiveEntry *entry; |
︙ | ︙ | |||
191 192 193 194 195 196 197 | if ([outFileName hasPrefix: @"/"]) { #else if ([outFileName hasPrefix: @"/"] || [outFileName containsString: @":"]) { #endif [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; | | > | > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | if ([outFileName hasPrefix: @"/"]) { #else if ([outFileName hasPrefix: @"/"] || [outFileName containsString: @":"]) { #endif [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; _exitStatus = 1; continue; } componentEnumerator = [[outFileName pathComponents] objectEnumerator]; while ((component = [componentEnumerator nextObject]) != nil) { if ([component isEqual: OF_PATH_PARENT_DIRECTORY]) { [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; _exitStatus = 1; continue; } } if (_outputLevel > -1) [of_stdout writeFormat: @"Extracting %@...", fileName]; if ([fileName hasSuffix: @"/"]) { |
︙ | ︙ | |||
296 297 298 299 300 301 302 | OFString *file; enumerator = [missing objectEnumerator]; while ((file = [enumerator nextObject]) != nil) [of_stderr writeFormat: @"File %@ is not in the archive!\n", file]; | | | 299 300 301 302 303 304 305 306 307 308 309 | OFString *file; enumerator = [missing objectEnumerator]; while ((file = [enumerator nextObject]) != nil) [of_stderr writeFormat: @"File %@ is not in the archive!\n", file]; _exitStatus = 1; } } @end |