Skip to content

Commit

Permalink
Merge pull request #571 from Erior/feature/540
Browse files Browse the repository at this point in the history
Proposal fixing Extra bytes written when setting zip64
  • Loading branch information
adamhathcock committed Feb 14, 2021
2 parents 5b52463 + 566c49c commit f48a6d4
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 f48a6d4

Please sign in to comment.