This commit is contained in:
BruceChen 2022-08-28 14:57:44 +08:00
parent 4757c4be53
commit d10ad138f1
14 changed files with 110 additions and 56 deletions

View file

@ -63,6 +63,8 @@
using System;
using System.Runtime.CompilerServices;
namespace Ionic.Zlib
{
sealed class InflateBlocks
@ -140,6 +142,7 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Process(int r)
{
int t; // temporary storage
@ -673,6 +676,7 @@ namespace Ionic.Zlib
}
// copy as much as possible from the sliding window to the output area
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Flush(int r)
{
int nBytes;
@ -799,6 +803,7 @@ namespace Ionic.Zlib
tree = null;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Process(InflateBlocks blocks, int r)
{
int j; // temporary storage
@ -1160,6 +1165,7 @@ namespace Ionic.Zlib
// (the maximum string length) and number of input bytes available
// at least ten. The ten bytes are six bytes for the longest length/
// distance pair plus four bytes for overloading the bit buffer.
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int InflateFast(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index, InflateBlocks s, ZlibCodec z)
{
@ -1509,6 +1515,7 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
internal int Inflate(FlushType flush)
{
int b;

View file

@ -89,6 +89,7 @@
using System;
using System.Runtime.CompilerServices;
using Interop=System.Runtime.InteropServices;
namespace Ionic.Zlib
@ -491,6 +492,7 @@ namespace Ionic.Zlib
/// adler = Adler.Adler32(adler, buffer, index, length);
/// </code>
/// </example>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static uint Adler32(uint adler, byte[] buf, int index, int len)
{
if (buf == null)

View file

@ -26,6 +26,7 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;
namespace Ionic.Zlib
{
@ -170,6 +171,7 @@ namespace Ionic.Zlib
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private void finish()
{
if (_z == null) return;
@ -299,6 +301,7 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public override void Close()
{
if (_stream == null) return;
@ -413,7 +416,7 @@ namespace Ionic.Zlib
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public override System.Int32 Read(System.Byte[] buffer, System.Int32 offset, System.Int32 count)
{
// According to MS documentation, any implementation of the IO.Stream.Read function must:

View file

@ -65,6 +65,7 @@
using System;
using System.Runtime.CompilerServices;
using Interop=System.Runtime.InteropServices;
namespace Ionic.Zlib
@ -351,6 +352,7 @@ namespace Ionic.Zlib
/// </example>
/// <param name="flush">The flush to use when inflating.</param>
/// <returns>Z_OK if everything goes well.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public int Inflate(FlushType flush)
{
if (istate == null)

View file

@ -27,6 +27,7 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;
namespace Ionic.Zlib
{
@ -409,6 +410,7 @@ namespace Ionic.Zlib
/// <param name="disposing">
/// indicates whether the Dispose method was invoked by user code.
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
protected override void Dispose(bool disposing)
{
try
@ -543,6 +545,7 @@ namespace Ionic.Zlib
/// <param name="count">the number of bytes to read.</param>
///
/// <returns>the number of bytes read</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public override int Read(byte[] buffer, int offset, int count)
{
if (_disposed) throw new ObjectDisposedException("ZlibStream");