From 445255a9cd5ece8892f811aa9e8569a64694790f Mon Sep 17 00:00:00 2001 From: sewer56 Date: Mon, 4 Dec 2023 15:08:36 +0000 Subject: [PATCH] Fix: Bug on partial decompression of SOLID block. --- NexusMods.Archives.Nx.Tests/Tests/Packing/PackingTests.cs | 2 +- NexusMods.Archives.Nx/NexusMods.Archives.Nx.csproj | 3 +-- NexusMods.Archives.Nx/Utilities/Compression.cs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NexusMods.Archives.Nx.Tests/Tests/Packing/PackingTests.cs b/NexusMods.Archives.Nx.Tests/Tests/Packing/PackingTests.cs index c1b34e5..758f162 100644 --- a/NexusMods.Archives.Nx.Tests/Tests/Packing/PackingTests.cs +++ b/NexusMods.Archives.Nx.Tests/Tests/Packing/PackingTests.cs @@ -85,7 +85,7 @@ public void Can_Pack_And_Unpack_WithSolidOnlyBlocks(IFixture fixture) /// See associated PR https://github.com/Nexus-Mods/NexusMods.Archives.Nx/pull/13 for more details. /// [Theory] - // [InlineAutoData(CompressionPreference.Lz4)] // Broken until PR in K4os.Compression.LZ4 is merged. + [InlineAutoData(CompressionPreference.Lz4)] [InlineAutoData(CompressionPreference.Copy)] [InlineAutoData(CompressionPreference.ZStandard)] public void Can_Pack_And_Unpack_FirstSolidItem(CompressionPreference solidAlgorithm, IFixture fixture) diff --git a/NexusMods.Archives.Nx/NexusMods.Archives.Nx.csproj b/NexusMods.Archives.Nx/NexusMods.Archives.Nx.csproj index 1e62f30..c723974 100644 --- a/NexusMods.Archives.Nx/NexusMods.Archives.Nx.csproj +++ b/NexusMods.Archives.Nx/NexusMods.Archives.Nx.csproj @@ -16,8 +16,7 @@ - - + diff --git a/NexusMods.Archives.Nx/Utilities/Compression.cs b/NexusMods.Archives.Nx/Utilities/Compression.cs index fb1c85c..0e8cefb 100644 --- a/NexusMods.Archives.Nx/Utilities/Compression.cs +++ b/NexusMods.Archives.Nx/Utilities/Compression.cs @@ -167,7 +167,7 @@ public static unsafe void Decompress(CompressionPreference method, byte* source, case CompressionPreference.Lz4: { // Fastest API with minimal alloc. - var result = LZ4Codec.Decode(source, sourceLength, destination, destinationLength); + var result = LZ4Codec.PartialDecode(source, sourceLength, destination, destinationLength); if (result < 0) throw new InvalidOperationException($"LZ4 Decompression error: {result}");