From 38b683c9a38375c56b2b46be59d25dba4ef17346 Mon Sep 17 00:00:00 2001 From: "J. Zebedee" Date: Sat, 27 Jan 2024 21:45:35 -0600 Subject: [PATCH] Use compact collection expression --- src/LibDeflate/Imports/Checksums.cs | 4 ++-- src/LibDeflate/Imports/Compression.cs | 18 +++++++++--------- .../Imports/CustomMemoryAllocator.cs | 4 ++-- src/LibDeflate/Imports/Decompression.cs | 18 +++++++++--------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/LibDeflate/Imports/Checksums.cs b/src/LibDeflate/Imports/Checksums.cs index 2659e63..6ff6837 100644 --- a/src/LibDeflate/Imports/Checksums.cs +++ b/src/LibDeflate/Imports/Checksums.cs @@ -15,7 +15,7 @@ internal static partial class Checksums /// 'buffer' is specified as NULL. /// [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); /// @@ -25,6 +25,6 @@ internal static partial class Checksums /// specified as NULL. /// [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); } diff --git a/src/LibDeflate/Imports/Compression.cs b/src/LibDeflate/Imports/Compression.cs index e63e761..ed9baff 100644 --- a/src/LibDeflate/Imports/Compression.cs +++ b/src/LibDeflate/Imports/Compression.cs @@ -27,14 +27,14 @@ internal static partial class Compression /// However, different threads may use different compressors concurrently. /// [LibraryImport(Constants.DllName)] - [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial libdeflate_compressor libdeflate_alloc_compressor(int compression_level); /// /// Like but allows specifying advanced options per-compressor. /// [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); /// @@ -45,7 +45,7 @@ internal static partial class Compression /// could not be compressed to 'out_nbytes_avail' bytes or fewer. /// [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); /// @@ -74,7 +74,7 @@ internal static partial class Compression /// did not fit into the provided output buffer. /// [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); /// @@ -82,7 +82,7 @@ internal static partial class Compression /// format. /// [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); /// @@ -91,7 +91,7 @@ internal static partial class Compression /// libdeflate_deflate_compress(). /// [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); /// @@ -99,7 +99,7 @@ internal static partial class Compression /// format. /// [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); /// @@ -108,7 +108,7 @@ internal static partial class Compression /// libdeflate_deflate_compress(). /// [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); /// @@ -117,6 +117,6 @@ internal static partial class Compression /// taken. /// [LibraryImport(Constants.DllName)] - [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void libdeflate_free_compressor(libdeflate_compressor compressor); } diff --git a/src/LibDeflate/Imports/CustomMemoryAllocator.cs b/src/LibDeflate/Imports/CustomMemoryAllocator.cs index 07f76e1..b6825ba 100644 --- a/src/LibDeflate/Imports/CustomMemoryAllocator.cs +++ b/src/LibDeflate/Imports/CustomMemoryAllocator.cs @@ -22,7 +22,7 @@ internal static partial class CustomMemoryAllocator /// structures in existence when calling this function. /// [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); /// @@ -34,6 +34,6 @@ internal static partial class CustomMemoryAllocator /// structures in existence when calling this function. /// [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] malloc, delegate* unmanaged[Cdecl] free); } diff --git a/src/LibDeflate/Imports/Decompression.cs b/src/LibDeflate/Imports/Decompression.cs index 476997a..58c6531 100644 --- a/src/LibDeflate/Imports/Decompression.cs +++ b/src/LibDeflate/Imports/Decompression.cs @@ -50,14 +50,14 @@ public enum libdeflate_result /// However, different threads may use different decompressors concurrently. /// [LibraryImport(Constants.DllName)] - [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial libdeflate_decompressor libdeflate_alloc_decompressor(); /// /// Like but allows specifying advanced options per-decompressor. /// [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); /// @@ -93,7 +93,7 @@ public enum libdeflate_result /// nonzero result code if decompression failed for another reason. /// [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); /// @@ -103,7 +103,7 @@ public enum libdeflate_result /// byte boundary) is written to *actual_in_nbytes_ret. /// [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); /// @@ -115,7 +115,7 @@ public enum libdeflate_result /// use libdeflate_zlib_decompress_ex(). /// [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); /// @@ -127,7 +127,7 @@ public enum libdeflate_result /// use libdeflate_zlib_decompress_ex(). /// [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); /// @@ -139,7 +139,7 @@ public enum libdeflate_result /// multi-member support. /// [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); /// @@ -150,7 +150,7 @@ public enum libdeflate_result /// written to *actual_in_nbytes_ret. /// [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); /// @@ -159,6 +159,6 @@ public enum libdeflate_result /// is taken. /// [LibraryImport(Constants.DllName)] - [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] public static partial void libdeflate_free_decompressor(libdeflate_decompressor compressor); } \ No newline at end of file