Differences From Artifact [b67377ac42]:
- File utils/ofzip/TarArchive.m — part of check-in [9104575517] at 2017-08-02 20:11:29 on branch trunk — OFTarArchive: Prepare for adding write support (user: js, size: 11002) [annotate] [blame] [check-ins using]
To Artifact [49a8dc5d2b]:
- File
utils/ofzip/TarArchive.m
— part of check-in
[3f34a360bf]
at
2017-08-05 12:27:30
on branch trunk
— Add OFMutableTarArchiveEntry
This is in preparation for OFTarArchive write support. (user: js, size: 11153) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
235 236 237 238 239 240 241 242 243 244 245 246 247 248 | while ((entry = [_archive nextEntry]) != nil) { void *pool = objc_autoreleasePoolPush(); OFString *fileName = [entry fileName]; OFString *outFileName = [fileName stringByStandardizingPath]; OFArray OF_GENERIC(OFString *) *pathComponents; OFString *directory; OFFile *output; uint64_t written = 0, size = [entry size]; int8_t percent = -1, newPercent; if (!all && ![files containsObject: fileName]) continue; if ([entry type] != OF_TAR_ARCHIVE_ENTRY_TYPE_FILE) { | > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | while ((entry = [_archive nextEntry]) != nil) { void *pool = objc_autoreleasePoolPush(); OFString *fileName = [entry fileName]; OFString *outFileName = [fileName stringByStandardizingPath]; OFArray OF_GENERIC(OFString *) *pathComponents; OFString *directory; OFFile *output; OFStream *stream; uint64_t written = 0, size = [entry size]; int8_t percent = -1, newPercent; if (!all && ![files containsObject: fileName]) continue; if ([entry type] != OF_TAR_ARCHIVE_ENTRY_TYPE_FILE) { |
︙ | ︙ | |||
315 316 317 318 319 320 321 | outFileName: outFileName]) goto outer_loop_end; output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); | > > | | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | outFileName: outFileName]) goto outer_loop_end; output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); stream = [_archive streamForReadingCurrentEntry]; while (![stream isAtEndOfStream]) { ssize_t length = [app copyBlockFromStream: stream toStream: output fileName: fileName]; if (length < 0) { app->_exitStatus = 1; goto outer_loop_end; } |
︙ | ︙ | |||
384 385 386 387 388 389 390 391 392 393 394 | return; } files = [OFMutableSet setWithArray: files_]; while ((entry = [_archive nextEntry]) != nil) { OFString *fileName = [entry fileName]; if (![files containsObject: fileName]) continue; | > > > | | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | return; } files = [OFMutableSet setWithArray: files_]; while ((entry = [_archive nextEntry]) != nil) { OFString *fileName = [entry fileName]; OFStream *stream; if (![files containsObject: fileName]) continue; stream = [_archive streamForReadingCurrentEntry]; while (![stream isAtEndOfStream]) { ssize_t length = [app copyBlockFromStream: stream toStream: of_stdout fileName: fileName]; if (length < 0) { app->_exitStatus = 1; return; } } [files removeObject: fileName]; [stream close]; if ([files count] == 0) break; } for (OFString *file in files) { [of_stderr writeLine: OF_LOCALIZED(@"file_not_in_archive", @"File %[file] is not in the archive!", @"file", file)]; app->_exitStatus = 1; } } @end |