Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,17 @@ internal Deflater(CompressionLevel compressionLevel, int windowBits)

ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

ZLibNative.ZLibStreamHandle? zlibStream = null;
ZErrorCode errC;
try
{
errC = ZLibNative.CreateZLibStreamForDeflate(out zlibStream, zlibCompressionLevel,
errC = ZLibNative.CreateZLibStreamForDeflate(out _zlibStream, zlibCompressionLevel,
windowBits, memLevel, strategy);
}
catch (Exception cause)
{
zlibStream?.Dispose();
throw new ZLibException(SR.ZLibErrorDLLLoadError, cause);
}

_zlibStream = zlibStream;

switch (errC)
{
case ZErrorCode.Ok:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,16 @@ public void Dispose()
[MemberNotNull(nameof(_zlibStream))]
private void InflateInit(int windowBits)
{
ZLibNative.ZLibStreamHandle? zlibStream = null;
ZLibNative.ErrorCode error;
try
{
error = ZLibNative.CreateZLibStreamForInflate(out zlibStream, windowBits);
error = ZLibNative.CreateZLibStreamForInflate(out _zlibStream, windowBits);
}
catch (Exception exception) // could not load the ZLib dll
{
zlibStream?.Dispose();
throw new ZLibException(SR.ZLibErrorDLLLoadError, exception);
}

_zlibStream = zlibStream;

switch (error)
{
case ZLibNative.ErrorCode.Ok: // Successful initialization
Expand Down