Skip to content

Commit

Permalink
Use compact collection expression
Browse files Browse the repository at this point in the history
  • Loading branch information
jzebedee committed Jan 28, 2024
1 parent f0019ca commit 38b683c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/LibDeflate/Imports/Checksums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static partial class Checksums
/// 'buffer' is specified as NULL.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial UInt32 libdeflate_adler32(UInt32 adler, in byte buffer, size_t len);

///<summary>
Expand All @@ -25,6 +25,6 @@ internal static partial class Checksums
/// specified as NULL.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial UInt32 libdeflate_crc32(UInt32 crc, in byte buffer, size_t len);
}
18 changes: 9 additions & 9 deletions src/LibDeflate/Imports/Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ internal static partial class Compression
/// However, different threads may use different compressors concurrently.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_compressor libdeflate_alloc_compressor(int compression_level);

/// <summary>
/// Like <see cref="libdeflate_alloc_compressor"/> but allows specifying advanced options per-compressor.
/// </summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_compressor libdeflate_alloc_compressor_ex(int compression_level, in libdeflate_options options);

///<summary>
Expand All @@ -45,7 +45,7 @@ internal static partial class Compression
/// could not be compressed to 'out_nbytes_avail' bytes or fewer.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial size_t libdeflate_deflate_compress(libdeflate_compressor compressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail);

///<summary>
Expand Down Expand Up @@ -74,15 +74,15 @@ internal static partial class Compression
/// did not fit into the provided output buffer.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial size_t libdeflate_deflate_compress_bound(libdeflate_compressor compressor, size_t in_nbytes);

///<summary>
/// Like libdeflate_deflate_compress(), but stores the data in the zlib wrapper
/// format.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial size_t libdeflate_zlib_compress(libdeflate_compressor compressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail);

///<summary>
Expand All @@ -91,15 +91,15 @@ internal static partial class Compression
/// libdeflate_deflate_compress().
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial size_t libdeflate_zlib_compress_bound(libdeflate_compressor compressor, size_t in_nbytes);

///<summary>
/// Like libdeflate_deflate_compress(), but stores the data in the gzip wrapper
/// format.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial size_t libdeflate_gzip_compress(libdeflate_compressor compressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail);

///<summary>
Expand All @@ -108,7 +108,7 @@ internal static partial class Compression
/// libdeflate_deflate_compress().
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial size_t libdeflate_gzip_compress_bound(libdeflate_compressor compressor, size_t in_nbytes);

///<summary>
Expand All @@ -117,6 +117,6 @@ internal static partial class Compression
/// taken.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void libdeflate_free_compressor(libdeflate_compressor compressor);
}
4 changes: 2 additions & 2 deletions src/LibDeflate/Imports/CustomMemoryAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal static partial class CustomMemoryAllocator
/// structures in existence when calling this function.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void libdeflate_set_memory_allocator(malloc_func malloc, free_func free);

///<summary>
Expand All @@ -34,6 +34,6 @@ internal static partial class CustomMemoryAllocator
/// structures in existence when calling this function.
///</summary>
[LibraryImport(Constants.DllName, EntryPoint = "libdeflate_set_memory_allocator")]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static unsafe partial void libdeflate_set_memory_allocator_unsafe(delegate* unmanaged[Cdecl]<size_t, void*> malloc, delegate* unmanaged[Cdecl]<void*, void> free);
}
18 changes: 9 additions & 9 deletions src/LibDeflate/Imports/Decompression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public enum libdeflate_result
/// However, different threads may use different decompressors concurrently.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_decompressor libdeflate_alloc_decompressor();

/// <summary>
/// Like <see cref="libdeflate_alloc_decompressor"/> but allows specifying advanced options per-decompressor.
/// </summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_decompressor libdeflate_alloc_decompressor_ex(in libdeflate_options options);

///<summary>
Expand Down Expand Up @@ -93,7 +93,7 @@ public enum libdeflate_result
/// nonzero result code if decompression failed for another reason.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_result libdeflate_deflate_decompress(libdeflate_decompressor decompressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail, out size_t actual_out_nbytes_ret);

///<summary>
Expand All @@ -103,7 +103,7 @@ public enum libdeflate_result
/// byte boundary) is written to *actual_in_nbytes_ret.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_result libdeflate_deflate_decompress_ex(libdeflate_decompressor decompressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail, out size_t actual_in_nbytes_ret, out size_t actual_out_nbytes_ret);

///<summary>
Expand All @@ -115,7 +115,7 @@ public enum libdeflate_result
/// use libdeflate_zlib_decompress_ex().
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_result libdeflate_zlib_decompress(libdeflate_decompressor decompressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail, out size_t actual_out_nbytes_ret);

///<summary>
Expand All @@ -127,7 +127,7 @@ public enum libdeflate_result
/// use libdeflate_zlib_decompress_ex().
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_result libdeflate_zlib_decompress_ex(libdeflate_decompressor decompressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail, out size_t actual_in_nbytes_ret, out size_t actual_out_nbytes_ret);

///<summary>
Expand All @@ -139,7 +139,7 @@ public enum libdeflate_result
/// multi-member support.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_result libdeflate_gzip_decompress(libdeflate_decompressor decompressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail, out size_t actual_out_nbytes_ret);

///<summary>
Expand All @@ -150,7 +150,7 @@ public enum libdeflate_result
/// written to *actual_in_nbytes_ret.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial libdeflate_result libdeflate_gzip_decompress_ex(libdeflate_decompressor decompressor, in byte @in, size_t in_nbytes, ref byte @out, size_t out_nbytes_avail, out size_t actual_in_nbytes_ret, out size_t actual_out_nbytes_ret);

///<summary>
Expand All @@ -159,6 +159,6 @@ public enum libdeflate_result
/// is taken.
///</summary>
[LibraryImport(Constants.DllName)]
[UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void libdeflate_free_decompressor(libdeflate_decompressor compressor);
}

0 comments on commit 38b683c

Please sign in to comment.