Differences From Artifact [03f366c882]:
- File
src/OFZIPArchive.m
— part of check-in
[a847357585]
at
2023-07-26 19:05:36
on branch trunk
— OFZIPArchive: Handle CD spanning multiple parts
Unfortunately, I could not find a file to test this with, as this is an
extremely rare corner case that basically doesn't seem to exist with
real world files: It requires an extremely small part size for an
archive with thousands of files. (user: js, size: 28748) [annotate] [blame] [check-ins using] [more...]
To Artifact [0f27411636]:
- File src/OFZIPArchive.m — part of check-in [8d4650f6c1] at 2024-03-10 23:33:44 on branch 1.0 — OFZIPArchive: Write correct number of disks (user: js, size: 28733) [annotate] [blame] [check-ins using] [more...]
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * |
︙ | ︙ | |||
339 340 341 342 343 344 345 | /* * FIXME: Handle number of the disk containing ZIP64 end of * central directory record. */ diskNumber = [_stream readLittleEndianInt32]; offset64 = [_stream readLittleEndianInt64]; | | < < < | > | 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 374 | /* * FIXME: Handle number of the disk containing ZIP64 end of * central directory record. */ diskNumber = [_stream readLittleEndianInt32]; offset64 = [_stream readLittleEndianInt64]; _diskNumber = _lastDiskNumber = [_stream readLittleEndianInt32]; if (offset64 < 0 || (OFStreamOffset)offset64 != offset64) @throw [OFOutOfRangeException exception]; seekOrThrowInvalidFormat(self, &diskNumber, (OFStreamOffset)offset64, OFSeekSet); if ([_stream readLittleEndianInt32] != 0x06064B50) @throw [OFInvalidFormatException exception]; size = [_stream readLittleEndianInt64]; if (size < 44) @throw [OFInvalidFormatException exception]; /* version made by */ [_stream readLittleEndianInt16]; /* version needed to extract */ [_stream readLittleEndianInt16]; diskNumber = [_stream readLittleEndianInt32]; if (diskNumber != _diskNumber) @throw [OFInvalidFormatException exception]; _centralDirectoryDisk = [_stream readLittleEndianInt32]; _centralDirectoryEntriesInDisk = [_stream readLittleEndianInt64]; _centralDirectoryEntries = [_stream readLittleEndianInt64]; _centralDirectorySize = [_stream readLittleEndianInt64]; |
︙ | ︙ | |||
575 576 577 578 579 580 581 582 583 584 585 586 587 588 | entry.versionMadeBy = (entry.versionMadeBy & 0xFF00) | 45; entry.minVersionNeeded = (entry.minVersionNeeded & 0xFF00) | 45; entry.compressedSize = 0; entry.uncompressedSize = 0; entry.CRC32 = 0; entry.generalPurposeBitFlag |= (seekable ? 0 : (1u << 3)) | (1u << 11); entry.of_localFileHeaderOffset = _offset; [_stream writeLittleEndianInt32: 0x04034B50]; [_stream writeLittleEndianInt16: entry.minVersionNeeded]; [_stream writeLittleEndianInt16: entry.generalPurposeBitFlag]; [_stream writeLittleEndianInt16: entry.compressionMethod]; [_stream writeLittleEndianInt16: entry.of_lastModifiedFileTime]; | > | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | entry.versionMadeBy = (entry.versionMadeBy & 0xFF00) | 45; entry.minVersionNeeded = (entry.minVersionNeeded & 0xFF00) | 45; entry.compressedSize = 0; entry.uncompressedSize = 0; entry.CRC32 = 0; entry.generalPurposeBitFlag |= (seekable ? 0 : (1u << 3)) | (1u << 11); entry.of_startDiskNumber = _diskNumber; entry.of_localFileHeaderOffset = _offset; [_stream writeLittleEndianInt32: 0x04034B50]; [_stream writeLittleEndianInt16: entry.minVersionNeeded]; [_stream writeLittleEndianInt16: entry.generalPurposeBitFlag]; [_stream writeLittleEndianInt16: entry.compressionMethod]; [_stream writeLittleEndianInt16: entry.of_lastModifiedFileTime]; |
︙ | ︙ | |||
659 660 661 662 663 664 665 | [_stream writeLittleEndianInt64: _centralDirectoryOffset]; /* ZIP64 end of central directory locator */ [_stream writeLittleEndianInt32: 0x07064B50]; [_stream writeLittleEndianInt32: _diskNumber]; [_stream writeLittleEndianInt64: _centralDirectoryOffset + _centralDirectorySize]; | | | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | [_stream writeLittleEndianInt64: _centralDirectoryOffset]; /* ZIP64 end of central directory locator */ [_stream writeLittleEndianInt32: 0x07064B50]; [_stream writeLittleEndianInt32: _diskNumber]; [_stream writeLittleEndianInt64: _centralDirectoryOffset + _centralDirectorySize]; [_stream writeLittleEndianInt32: 0]; /* Total number of disks */ /* End of central directory */ [_stream writeLittleEndianInt32: 0x06054B50]; [_stream writeLittleEndianInt16: 0xFFFF]; /* Disk number */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD disk */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries in disk */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries */ |
︙ | ︙ |