mirror of
https://github.com/aaru-dps/Aaru.git
synced 2026-04-05 21:44:05 +00:00
Refactor buffer parameter passing in LZO, LZVN, and XZ encoding/decoding methods
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user