1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Add support for zip64 format

This commit is contained in:
Ronan Timinello 2022-09-07 13:28:15 +02:00
parent 965d0ca4be
commit b849feb33d

View file

@ -51,6 +51,28 @@ struct ZipFile::ZipEntryHolder
entry.isSymbolicLink = (fileType == 0xA);
entry.filename = String::fromUTF8 (buffer + 46, fileNameLen);
auto const extraFieldLength = ByteOrder::littleEndianShort(buffer + 30);
if (extraFieldLength != 0)
{
auto extraFieldOffset = 0;
auto* extraHeaderPtr = buffer + 46 + fileNameLen;
auto* extraSectionPtr = extraHeaderPtr;
while (extraFieldOffset < extraFieldLength) {
auto extraHeaderTag = ByteOrder::littleEndianShort(extraSectionPtr);
auto extraFieldSectionLength = ByteOrder::littleEndianShort(extraSectionPtr + 2);
if (extraHeaderTag == 0x0001) // Zip64 Tag
{
entry.uncompressedSize = (int64)ByteOrder::littleEndianInt64(extraSectionPtr + 4);
if (extraFieldSectionLength > 8)
compressedSize = (int64)ByteOrder::littleEndianInt64(extraHeaderPtr + 12);
if (extraFieldSectionLength > 16)
streamOffset = (int64)ByteOrder::littleEndianInt64(extraHeaderPtr + 20);
}
extraFieldOffset += extraFieldSectionLength + 4;
extraSectionPtr = extraHeaderPtr + extraFieldOffset;
}
}
}
static Time parseFileTime (uint32 time, uint32 date) noexcept