Skip to content

Commit b92ae59

Browse files
bjorgk15tfu
authored andcommitted
Merge PR icsharpcode#325: Ability to mimic a zip file created by a Linux file-system
* respect the VersionMadeBy property of ZipEntry * correctly set HostSystem without clearing version (cherry picked from commit 43fd81e)
1 parent f727b4c commit b92ae59

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ICSharpCode.SharpZipLib/Zip/ZipEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public int HostSystem {
471471
}
472472

473473
set {
474-
versionMadeBy &= 0xff;
474+
versionMadeBy &= 0x00ff;
475475
versionMadeBy |= (ushort)((value & 0xff) << 8);
476476
}
477477
}

ICSharpCode.SharpZipLib/Zip/ZipFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,7 @@ int WriteCentralDirectoryHeader(ZipEntry entry)
18761876
WriteLEInt(ZipConstants.CentralHeaderSignature);
18771877

18781878
// Version made by
1879-
WriteLEShort(ZipConstants.VersionMadeBy);
1879+
WriteLEShort((entry.HostSystem << 8) | entry.VersionMadeBy);
18801880

18811881
// Version required to extract
18821882
WriteLEShort(entry.Version);

ICSharpCode.SharpZipLib/Zip/ZipOutputStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ public override void Finish()
647647

648648
foreach (ZipEntry entry in entries) {
649649
WriteLeInt(ZipConstants.CentralHeaderSignature);
650-
WriteLeShort(ZipConstants.VersionMadeBy);
650+
WriteLeShort((entry.HostSystem << 8) | entry.VersionMadeBy);
651651
WriteLeShort(entry.Version);
652652
WriteLeShort(entry.Flags);
653653
WriteLeShort((short)entry.CompressionMethodForHeader);

0 commit comments

Comments
 (0)