Skip to content

Commit 263b8e4

Browse files
authored
Use maximum compression instead of the default one (#94)
Context: dotnet/android#5971 (comment) Also, attempt to tweak `zlib-ng` to use the best compression possible, by sacrificing speed.
1 parent 610e002 commit 263b8e4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ endif()
5555
#
5656
set(ZLIB_COMPAT ON CACHE BOOL "Build zlib-ng for compatibility with zlib" FORCE)
5757
set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Do not build zlib-ng tests" FORCE)
58+
set(WITH_NEW_STRATEGIES OFF CACHE BOOL "Disable faster, but with worse compression, deflate strategies" FORCE)
5859

5960
#
6061
# Read product version

LibZipSharp.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<_LibZipSharpNugetVersion>2.0.0-alpha4</_LibZipSharpNugetVersion>
3+
<_LibZipSharpNugetVersion>2.0.0-alpha5</_LibZipSharpNugetVersion>
44
<_NativeBuildDir>$(MSBuildThisFileDirectory)lzsbuild</_NativeBuildDir>
55
<_ExternalDir>$(MSBuildThisFileDirectory)external</_ExternalDir>
66
<_MonoPosixNugetVersion>7.0.0-alpha8.21302.6</_MonoPosixNugetVersion>

LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public ZipEntry AddStream (Stream stream, string archivePath, EntryPermissions p
329329
long index = Native.zip_file_add (archive, destPath, source, overwriteExisting ? OperationFlags.Overwrite : OperationFlags.None);
330330
if (index < 0)
331331
throw GetErrorException ();
332-
if (Native.zip_set_file_compression (archive, (ulong)index, compressionMethod, 0) < 0)
332+
if (Native.zip_set_file_compression (archive, (ulong)index, compressionMethod, 9) < 0)
333333
throw GetErrorException ();
334334
if (permissions == EntryPermissions.Default)
335335
permissions = DefaultFilePermissions;
@@ -410,7 +410,7 @@ public ZipEntry AddFile (string sourcePath, string archivePath = null,
410410
long index = PlatformServices.Instance.StoreSpecialFile (this, sourcePath, archivePath, out compressionMethod);
411411
if (index < 0)
412412
throw GetErrorException ();
413-
if (Native.zip_set_file_compression (archive, (ulong)index, isDir ? CompressionMethod.Store : compressionMethod, 0) < 0)
413+
if (Native.zip_set_file_compression (archive, (ulong)index, isDir ? CompressionMethod.Store : compressionMethod, 9) < 0)
414414
throw GetErrorException ();
415415
PlatformServices.Instance.SetEntryPermissions (this, sourcePath, (ulong)index, permissions);
416416
ZipEntry entry = ReadEntry ((ulong)index);

0 commit comments

Comments
 (0)