|
5 | 5 |
|
6 | 6 | namespace ZlibSharp.Internal; |
7 | 7 |
|
8 | | -using ZlibSharp.Exceptions; |
9 | | - |
10 | 8 | [ExcludeFromCodeCoverage] |
11 | 9 | internal static unsafe class ZlibHelper |
12 | 10 | { |
13 | 11 | private static bool zlibResolverAdded; |
14 | 12 |
|
15 | | - internal static string ZlibLibFileName |
16 | | - => (OperatingSystem.IsWindows(), OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD() || OperatingSystem.IsAndroid(), OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst(), OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) switch |
17 | | - { |
18 | | - (true, false, false, false) => "ZlibSharp.Native.dll", |
19 | | - (false, true, false, false) => "libZlibSharp.Native.so", |
20 | | - (false, false, true, false) => "libZlibSharp.Native.dylib", |
21 | | - (false, false, false, true) => "__Internal", |
22 | | - _ => throw new PlatformNotSupportedException("Zlib is probably not supported on this platform."), |
23 | | - }; |
| 13 | + // internal static string ZlibLibFileName |
| 14 | + // => (OperatingSystem.IsWindows(), OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD() || OperatingSystem.IsAndroid(), OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst(), OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) switch |
| 15 | + // { |
| 16 | + // (true, false, false, false) => "ZlibSharp.Native.dll", |
| 17 | + // (false, true, false, false) => "libZlibSharp.Native.so", |
| 18 | + // (false, false, true, false) => "libZlibSharp.Native.dylib", |
| 19 | + // (false, false, false, true) => "__Internal", |
| 20 | + // _ => throw new PlatformNotSupportedException("Zlib is probably not supported on this platform."), |
| 21 | + // }; |
| 22 | +#if !TARGET_IOS |
| 23 | + internal const string ZlibLibFileName = "ZlibSharp.Native"; |
| 24 | +#else |
| 25 | + internal const string ZlibLibFileName = "__Internal"; |
| 26 | +#endif |
24 | 27 |
|
25 | 28 | internal static uint Compress(ReadOnlySpan<byte> source, Span<byte> dest, ZlibCompressionLevel compressionLevel, ZlibWindowBits windowBits, ZlibCompressionStrategy strategy, out ZlibStatus status) |
26 | 29 | { |
@@ -122,18 +125,17 @@ internal static uint Decompress(ReadOnlySpan<byte> source, Span<byte> dest, out |
122 | 125 | // } |
123 | 126 | // } |
124 | 127 |
|
125 | | - [MethodImpl(MethodImplOptions.AggressiveInlining)] |
126 | | - internal static ulong GetCrc32(ReadOnlySpan<byte> data) |
127 | | - { |
128 | | - fixed (byte* dataPtr = data) |
129 | | - { |
130 | | - return UnsafeNativeMethods.Crc32_ComputeHash(dataPtr); |
131 | | - // return UnsafeNativeMethods.crc32( |
132 | | - // UnsafeNativeMethods.crc32(0L, null, 0), |
133 | | - // dataPtr, |
134 | | - // (uint)data.Length); |
135 | | - } |
136 | | - } |
| 128 | + // [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| 129 | + // internal static ulong GetCrc32(ReadOnlySpan<byte> data) |
| 130 | + // { |
| 131 | + // fixed (byte* dataPtr = data) |
| 132 | + // { |
| 133 | + // return UnsafeNativeMethods.crc32( |
| 134 | + // UnsafeNativeMethods.crc32(0L, null, 0), |
| 135 | + // dataPtr, |
| 136 | + // (uint)data.Length); |
| 137 | + // } |
| 138 | + // } |
137 | 139 |
|
138 | 140 | private static void PreOperationCheck() |
139 | 141 | { |
|
0 commit comments