Refactor buffer parameter passing in LZO, LZVN, and XZ encoding/decoding methods

This commit is contained in:
2026-02-08 23:20:33 +00:00
parent 68df173c2f
commit 28a12ca322
3 changed files with 6 additions and 6 deletions

View File

@@ -42,7 +42,7 @@ public sealed partial class LZO
/// <param name="algorithm">Which algorithm to use</param>
/// <returns>Error code or 0 on success</returns>
[LibraryImport("libAaru.Compression.Native", SetLastError = true)]
private static partial int AARU_lzo_decode_buffer(byte[] dst_buffer, ref nuint dst_size, in byte[] src_buffer,
private static partial int AARU_lzo_decode_buffer(byte[] dst_buffer, ref nuint dst_size, byte[] src_buffer,
nuint src_size, Algorithm algorithm);
@@ -58,7 +58,7 @@ public sealed partial class LZO
/// <param name="algorithm">Which algorithm to use</param>
/// <returns>Error code or 0 on success</returns>
[LibraryImport("libAaru.Compression.Native", SetLastError = true)]
private static partial int AARU_lzo_encode_buffer(byte[] dst_buffer, ref nuint dst_size, in byte[] src_buffer,
private static partial int AARU_lzo_encode_buffer(byte[] dst_buffer, ref nuint dst_size, byte[] src_buffer,
nuint src_size, Algorithm algorithm, int compression_level);
/// <summary>Decodes a buffer compressed with LZO</summary>

View File

@@ -65,7 +65,7 @@ public static partial class LZVN
/// <param name="scratch_buffer">Scratch buffer</param>
/// <returns></returns>
[LibraryImport("libAaru.Compression.Native", SetLastError = true)]
private static partial nuint AARU_lzvn_encode_buffer(byte[] dst_buffer, nuint dst_size, in byte[] src_buffer,
private static partial nuint AARU_lzvn_encode_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer,
nuint src_size, byte[] scratch_buffer);
/// <summary>Decodes a buffer compressed with LZVN</summary>
@@ -95,7 +95,7 @@ public static partial class LZVN
byte[] scratch = new byte[1048576]; // LZVN requires a 512KB scratch buffer for encoding, let's give it twice that
return (long)AARU_lzvn_encode_buffer(destination, (nuint)destination.LongLength, in source, (nuint)source.LongLength, scratch);
return (long)AARU_lzvn_encode_buffer(destination, (nuint)destination.LongLength, source, (nuint)source.LongLength, scratch);
}
/// <summary>Decodes a buffer compressed with LZVN</summary>

View File

@@ -26,7 +26,7 @@ public static partial class XZ
/// <param name="src_size">Size of the source buffer</param>
/// <returns></returns>
[LibraryImport("libAaru.Compression.Native", SetLastError = true)]
private static partial int AARU_xz_decode_buffer(byte[] dst_buffer, ref nuint dst_size, in byte[] src_buffer,
private static partial int AARU_xz_decode_buffer(byte[] dst_buffer, ref nuint dst_size, byte[] src_buffer,
nuint src_size);
@@ -42,7 +42,7 @@ public static partial class XZ
/// <param name="checkType">Checksum to use</param>
/// <returns>The size of the compressed data, or -1 on error.</returns>
[LibraryImport("libAaru.Compression.Native", SetLastError = true)]
private static partial int AARU_xz_encode_buffer(byte[] dst_buffer, ref nuint dst_size, in byte[] src_buffer,
private static partial int AARU_xz_encode_buffer(byte[] dst_buffer, ref nuint dst_size, byte[] src_buffer,
nuint src_size, uint level, CheckType checkType);
/// <summary>Decodes a buffer compressed with XZ</summary>