From 7e12e6e20646b5136ce4b283e19c8ffc45a0f159 Mon Sep 17 00:00:00 2001 From: Erhan Atesoglu <47518605+eanova@users.noreply.github.com> Date: Sun, 7 Apr 2019 13:44:07 -0700 Subject: [PATCH] Moved Interop Locations For System.IO.Compression.Brotli (dotnet/corefx#36614) * MovedInteropLocationForBrotli * Combined Brotli Files Commit migrated from https://github.com/dotnet/corefx/commit/e5fddbc1aee5215d988f8044be6d48b273286689 --- .../src/Interop/Interop.Brotli.cs} | 19 ++++++++++- .../src/Interop/Interop.Brotli.Decoder.cs | 32 ------------------- .../src/System.IO.Compression.Brotli.csproj | 3 +- 3 files changed, 19 insertions(+), 35 deletions(-) rename src/libraries/{System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Encoder.cs => Common/src/Interop/Interop.Brotli.cs} (62%) delete mode 100644 src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Decoder.cs diff --git a/src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Encoder.cs b/src/libraries/Common/src/Interop/Interop.Brotli.cs similarity index 62% rename from src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Encoder.cs rename to src/libraries/Common/src/Interop/Interop.Brotli.cs index 64906cebc1782..e6314fc1cf814 100644 --- a/src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Encoder.cs +++ b/src/libraries/Common/src/Interop/Interop.Brotli.cs @@ -10,8 +10,25 @@ internal static partial class Interop { - internal static partial class Brotli + internal static class Brotli { + [DllImport(Libraries.CompressionNative)] + internal static extern SafeBrotliDecoderHandle BrotliDecoderCreateInstance(IntPtr allocFunc, IntPtr freeFunc, IntPtr opaque); + + [DllImport(Libraries.CompressionNative)] + internal static extern unsafe int BrotliDecoderDecompressStream( + SafeBrotliDecoderHandle state, ref size_t availableIn, byte** nextIn, + ref size_t availableOut, byte** nextOut, out size_t totalOut); + + [DllImport(Libraries.CompressionNative)] + internal static extern unsafe bool BrotliDecoderDecompress(size_t availableInput, byte* inBytes, ref size_t availableOutput, byte* outBytes); + + [DllImport(Libraries.CompressionNative)] + internal static extern void BrotliDecoderDestroyInstance(IntPtr state); + + [DllImport(Libraries.CompressionNative)] + internal static extern bool BrotliDecoderIsFinished(SafeBrotliDecoderHandle state); + [DllImport(Libraries.CompressionNative)] internal static extern SafeBrotliEncoderHandle BrotliEncoderCreateInstance(IntPtr allocFunc, IntPtr freeFunc, IntPtr opaque); diff --git a/src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Decoder.cs b/src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Decoder.cs deleted file mode 100644 index 9eeb467e097bc..0000000000000 --- a/src/libraries/System.IO.Compression.Brotli/src/Interop/Interop.Brotli.Decoder.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; -using size_t = System.IntPtr; - -internal static partial class Interop -{ - internal static partial class Brotli - { - [DllImport(Libraries.CompressionNative)] - internal static extern SafeBrotliDecoderHandle BrotliDecoderCreateInstance(IntPtr allocFunc, IntPtr freeFunc, IntPtr opaque); - - [DllImport(Libraries.CompressionNative)] - internal static extern unsafe int BrotliDecoderDecompressStream( - SafeBrotliDecoderHandle state, ref size_t availableIn, byte** nextIn, - ref size_t availableOut, byte** nextOut, out size_t totalOut); - - [DllImport(Libraries.CompressionNative)] - internal static extern unsafe bool BrotliDecoderDecompress(size_t availableInput, byte* inBytes, ref size_t availableOutput, byte* outBytes); - - [DllImport(Libraries.CompressionNative)] - internal static extern void BrotliDecoderDestroyInstance(IntPtr state); - - [DllImport(Libraries.CompressionNative)] - internal static extern bool BrotliDecoderIsFinished(SafeBrotliDecoderHandle state); - } -} - diff --git a/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj b/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj index 4fd831d190072..5416c29dc478c 100644 --- a/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj +++ b/src/libraries/System.IO.Compression.Brotli/src/System.IO.Compression.Brotli.csproj @@ -9,8 +9,7 @@ - - +