Differences From Artifact [de5d10a91b]:
- File utils/ofzip/TarArchive.m — part of check-in [64c64c56c1] at 2017-04-09 12:26:05 on branch trunk — ofzip: Optimize printing a file from a tar file (user: js, size: 11138) [annotate] [blame] [check-ins using]
To Artifact [fe3cb3604c]:
- File
utils/ofzip/TarArchive.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 11147) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
52 53 54 55 56 57 58 | #endif } @implementation TarArchive + (void)initialize { if (self == [TarArchive class]) | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #endif } @implementation TarArchive + (void)initialize { if (self == [TarArchive class]) app = (OFZIP *)[[OFApplication sharedApplication] delegate]; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream { return [[[self alloc] initWithStream: stream] autorelease]; } - initWithStream: (OF_KINDOF(OFStream *))stream { self = [super init]; @try { _archive = [[OFTarArchive alloc] initWithStream: stream]; } @catch (id e) { [self release]; |
︙ | ︙ | |||
231 232 233 234 235 236 237 | } } objc_autoreleasePoolPop(pool); } } | | | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | } } objc_autoreleasePoolPop(pool); } } - (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files { OFFileManager *fileManager = [OFFileManager defaultManager]; bool all = ([files count] == 0); OFMutableSet OF_GENERIC(OFString *) *missing = [OFMutableSet setWithArray: files]; OFTarArchiveEntry *entry; 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; |
︙ | ︙ | |||
379 380 381 382 383 384 385 | @"File %[file] is not in the archive!", @"file", file)]; app->_exitStatus = 1; } } | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | @"File %[file] is not in the archive!", @"file", file)]; app->_exitStatus = 1; } } - (void)printFiles: (OFArray OF_GENERIC(OFString *) *)files_ { OFMutableSet *files; OFTarArchiveEntry *entry; if ([files_ count] < 1) { [of_stderr writeLine: OF_LOCALIZED(@"print_no_file_specified", @"Need one or more files to print!")]; |
︙ | ︙ |