Skip to content

Commit

Permalink
Proposal
Browse files Browse the repository at this point in the history
Zip64 requires version 4.5
Number of disks is 4 bytes and not 8
  • Loading branch information
Erior committed Feb 14, 2021
1 parent 2dd17e3 commit 566c49c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SharpCompress/Writers/Zip/ZipWriter.cs
Expand Up @@ -253,7 +253,7 @@ private void WriteEndRecord(ulong size)

BinaryPrimitives.WriteUInt64LittleEndian(intBuf, (ulong)recordlen);
OutputStream.Write(intBuf); // Size of zip64 end of central directory record
BinaryPrimitives.WriteUInt16LittleEndian(intBuf, 0);
BinaryPrimitives.WriteUInt16LittleEndian(intBuf, 45);
OutputStream.Write(intBuf.Slice(0, 2)); // Made by
BinaryPrimitives.WriteUInt16LittleEndian(intBuf, 45);
OutputStream.Write(intBuf.Slice(0, 2)); // Version needed
Expand All @@ -278,8 +278,8 @@ private void WriteEndRecord(ulong size)
OutputStream.Write(intBuf.Slice(0, 4)); // Entry disk
BinaryPrimitives.WriteUInt64LittleEndian(intBuf, (ulong)streamPosition + size);
OutputStream.Write(intBuf); // Offset to the zip64 central directory
BinaryPrimitives.WriteUInt32LittleEndian(intBuf, 0);
OutputStream.Write(intBuf); // Number of disks
BinaryPrimitives.WriteUInt32LittleEndian(intBuf, 1);
OutputStream.Write(intBuf.Slice(0, 4)); // Number of disks

streamPosition += recordlen + (4 + 4 + 8 + 4);
streampositionvalue = streamPosition >= uint.MaxValue ? uint.MaxValue : (uint)streampositionvalue;
Expand Down

0 comments on commit 566c49c

Please sign in to comment.