Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use GeneratedDllImport for blittable p/invokes in System.IO.Compressi…
…on, System.IO.Compression.Brotli
  • Loading branch information
elinor-fung committed Nov 15, 2021
commit a26d333e77c960eb68800435549ce70e53615d3c
16 changes: 8 additions & 8 deletions src/libraries/Common/src/Interop/Interop.Brotli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ internal static unsafe partial int BrotliDecoderDecompressStream(
SafeBrotliDecoderHandle state, ref nuint availableIn, byte** nextIn,
ref nuint availableOut, byte** nextOut, out nuint totalOut);

[DllImport(Libraries.CompressionNative)]
internal static extern unsafe BOOL BrotliDecoderDecompress(nuint availableInput, byte* inBytes, nuint* availableOutput, byte* outBytes);
[GeneratedDllImport(Libraries.CompressionNative)]
internal static unsafe partial BOOL BrotliDecoderDecompress(nuint availableInput, byte* inBytes, nuint* availableOutput, byte* outBytes);

[DllImport(Libraries.CompressionNative)]
internal static extern void BrotliDecoderDestroyInstance(IntPtr state);
[GeneratedDllImport(Libraries.CompressionNative)]
internal static partial void BrotliDecoderDestroyInstance(IntPtr state);

[GeneratedDllImport(Libraries.CompressionNative)]
internal static partial BOOL BrotliDecoderIsFinished(SafeBrotliDecoderHandle state);
Expand All @@ -41,10 +41,10 @@ internal static unsafe partial BOOL BrotliEncoderCompressStream(
[GeneratedDllImport(Libraries.CompressionNative)]
internal static partial BOOL BrotliEncoderHasMoreOutput(SafeBrotliEncoderHandle state);

[DllImport(Libraries.CompressionNative)]
internal static extern void BrotliEncoderDestroyInstance(IntPtr state);
[GeneratedDllImport(Libraries.CompressionNative)]
internal static partial void BrotliEncoderDestroyInstance(IntPtr state);

[DllImport(Libraries.CompressionNative)]
internal static extern unsafe BOOL BrotliEncoderCompress(int quality, int window, int v, nuint availableInput, byte* inBytes, nuint* availableOutput, byte* outBytes);
[GeneratedDllImport(Libraries.CompressionNative)]
internal static unsafe partial BOOL BrotliEncoderCompress(int quality, int window, int v, nuint availableInput, byte* inBytes, nuint* availableOutput, byte* outBytes);
}
}
36 changes: 18 additions & 18 deletions src/libraries/Common/src/Interop/Interop.zlib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ internal static partial class Interop
{
internal static partial class zlib
{
[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateInit2_")]
internal static extern unsafe ZLibNative.ErrorCode DeflateInit2_(
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateInit2_")]
internal static unsafe partial ZLibNative.ErrorCode DeflateInit2_(
ZLibNative.ZStream* stream,
ZLibNative.CompressionLevel level,
ZLibNative.CompressionMethod method,
int windowBits,
int memLevel,
ZLibNative.CompressionStrategy strategy);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Deflate")]
internal static extern unsafe ZLibNative.ErrorCode Deflate(ZLibNative.ZStream* stream, ZLibNative.FlushCode flush);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Deflate")]
internal static unsafe partial ZLibNative.ErrorCode Deflate(ZLibNative.ZStream* stream, ZLibNative.FlushCode flush);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateReset")]
internal static extern unsafe ZLibNative.ErrorCode DeflateReset(ZLibNative.ZStream* stream);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateReset")]
internal static unsafe partial ZLibNative.ErrorCode DeflateReset(ZLibNative.ZStream* stream);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateEnd")]
internal static extern unsafe ZLibNative.ErrorCode DeflateEnd(ZLibNative.ZStream* stream);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_DeflateEnd")]
internal static unsafe partial ZLibNative.ErrorCode DeflateEnd(ZLibNative.ZStream* stream);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateInit2_")]
internal static extern unsafe ZLibNative.ErrorCode InflateInit2_(ZLibNative.ZStream* stream, int windowBits);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateInit2_")]
internal static unsafe partial ZLibNative.ErrorCode InflateInit2_(ZLibNative.ZStream* stream, int windowBits);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Inflate")]
internal static extern unsafe ZLibNative.ErrorCode Inflate(ZLibNative.ZStream* stream, ZLibNative.FlushCode flush);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Inflate")]
internal static unsafe partial ZLibNative.ErrorCode Inflate(ZLibNative.ZStream* stream, ZLibNative.FlushCode flush);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateReset")]
internal static extern unsafe ZLibNative.ErrorCode InflateReset(ZLibNative.ZStream* stream);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateReset")]
internal static unsafe partial ZLibNative.ErrorCode InflateReset(ZLibNative.ZStream* stream);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateEnd")]
internal static extern unsafe ZLibNative.ErrorCode InflateEnd(ZLibNative.ZStream* stream);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateEnd")]
internal static unsafe partial ZLibNative.ErrorCode InflateEnd(ZLibNative.ZStream* stream);

[DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Crc32")]
internal static extern unsafe uint crc32(uint crc, byte* buffer, int len);
[GeneratedDllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Crc32")]
internal static unsafe partial uint crc32(uint crc, byte* buffer, int len);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<Reference Include="System.Net.Primitives" />
<Reference Include="System.Numerics.Vectors" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Security.Cryptography.Algorithms" />
Expand Down