293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
missing = [OFMutableSet setWithArray: files];
entryEnumerator = [[archive entries] objectEnumerator];
while ((entry = [entryEnumerator nextObject]) != nil) {
void *pool = objc_autoreleasePoolPush();
OFString *fileName = [entry fileName];
OFString *outFileName = [fileName stringByStandardizingPath];
OFEnumerator OF_GENERIC(OFString*) *componentEnumerator;
OFString *component, *directory;
OFStream *stream;
OFFile *output;
char buffer[BUFFER_SIZE];
uint64_t written = 0, size = [entry uncompressedSize];
int_fast8_t percent = -1, newPercent;
|
>
|
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
missing = [OFMutableSet setWithArray: files];
entryEnumerator = [[archive entries] objectEnumerator];
while ((entry = [entryEnumerator nextObject]) != nil) {
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;
OFStream *stream;
OFFile *output;
char buffer[BUFFER_SIZE];
uint64_t written = 0, size = [entry uncompressedSize];
int_fast8_t percent = -1, newPercent;
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
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 >= 0)
[of_stdout writeFormat: @"Extracting %@...", fileName];
if ([fileName hasSuffix: @"/"]) {
[OFFile createDirectoryAtPath: outFileName
createParents: true];
setPermissions(outFileName, entry);
if (_outputLevel >= 0)
[of_stdout writeLine: @" done"];
continue;
}
directory = [outFileName stringByDeletingLastPathComponent];
if (![OFFile directoryExistsAtPath: directory])
[OFFile createDirectoryAtPath: directory
createParents: true];
if ([OFFile fileExistsAtPath: outFileName] && _override != 1) {
OFString *line;
if (_override == -1) {
if (_outputLevel >= 0)
[of_stdout writeLine: @" skipped"];
continue;
}
do {
[of_stderr writeFormat:
@"\rOverride %@? [ynAN?] ", fileName];
line = [of_stdin readLine];
|
>
<
>
>
|
<
>
<
>
>
|
|
>
|
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
if ([outFileName hasPrefix: @"/"]) {
#else
if ([outFileName hasPrefix: @"/"] ||
[outFileName containsString: @":"]) {
#endif
[of_stderr writeFormat: @"Refusing to extract %@!\n",
fileName];
_exitStatus = 1;
goto outer_loop_end;
}
pathComponents = [outFileName pathComponents];
componentEnumerator = [pathComponents objectEnumerator];
while ((component = [componentEnumerator nextObject]) != nil) {
if ([component isEqual: OF_PATH_PARENT_DIRECTORY]) {
[of_stderr writeFormat:
@"Refusing to extract %@!\n", fileName];
_exitStatus = 1;
goto outer_loop_end;
}
}
outFileName = [OFString pathWithComponents: pathComponents];
if (_outputLevel >= 0)
[of_stdout writeFormat: @"Extracting %@...", fileName];
if ([fileName hasSuffix: @"/"]) {
[OFFile createDirectoryAtPath: outFileName
createParents: true];
setPermissions(outFileName, entry);
if (_outputLevel >= 0)
[of_stdout writeLine: @" done"];
goto outer_loop_end;
}
directory = [outFileName stringByDeletingLastPathComponent];
if (![OFFile directoryExistsAtPath: directory])
[OFFile createDirectoryAtPath: directory
createParents: true];
if ([OFFile fileExistsAtPath: outFileName] && _override != 1) {
OFString *line;
if (_override == -1) {
if (_outputLevel >= 0)
[of_stdout writeLine: @" skipped"];
goto outer_loop_end;
}
do {
[of_stderr writeFormat:
@"\rOverride %@? [ynAN?] ", fileName];
line = [of_stdin readLine];
|
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
_override = 1;
else if ([line isEqual: @"N"])
_override = -1;
if ([line isEqual: @"n"] || [line isEqual: @"N"]) {
[of_stdout writeFormat: @"Skipping %@...\n",
fileName];
continue;
}
[of_stdout writeFormat: @"Extracting %@...", fileName];
}
stream = [archive streamForReadingFile: fileName];
output = [OFFile fileWithPath: outFileName
|
|
>
|
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
_override = 1;
else if ([line isEqual: @"N"])
_override = -1;
if ([line isEqual: @"n"] || [line isEqual: @"N"]) {
[of_stdout writeFormat: @"Skipping %@...\n",
fileName];
goto outer_loop_end;
}
[of_stdout writeFormat: @"Extracting %@...", fileName];
}
stream = [archive streamForReadingFile: fileName];
output = [OFFile fileWithPath: outFileName
|