Skip to content

Commit

Permalink
Merge pull request #17 from Nexus-Mods/add-lz4-decodepartial
Browse files Browse the repository at this point in the history
Fix: Bug on partial decompression of SOLID block.
  • Loading branch information
halgari authored Dec 4, 2023
2 parents d692b57 + 445255a commit 8c9eeaa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion NexusMods.Archives.Nx.Tests/Tests/Packing/PackingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </remarks>
[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)
Expand Down
3 changes: 1 addition & 2 deletions NexusMods.Archives.Nx/NexusMods.Archives.Nx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0-eap2" PrivateAssets="All" />
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.5"/>
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.3.5"/>
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.7-beta" />
<PackageReference Include="NetEscapades.EnumGenerators" Version="1.0.0-beta07" PrivateAssets="all" ExcludeAssets="runtime" />
<PackageReference Include="NexusMods.Hashing.xxHash64" Version="1.0.1" />
<PackageReference Include="PolySharp" Version="1.13.1">
Expand Down
2 changes: 1 addition & 1 deletion NexusMods.Archives.Nx/Utilities/Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");

Expand Down

0 comments on commit 8c9eeaa

Please sign in to comment.