protected DeflateStream(Stream baseStream, ZLibDecompressOptions decompOpts, Format format) { ZLibInit.Manager.EnsureLoaded(); BaseStream = baseStream ?? throw new ArgumentNullException(nameof(baseStream)); _mode = Mode.Decompress; _disposed = false; // Check and set decompress options _leaveOpen = decompOpts.LeaveOpen; _bufferSize = CheckBufferSize(decompOpts.BufferSize); _workBuf = new byte[_bufferSize]; int windowBits = CheckFormatWindowBits(decompOpts.WindowBits, _mode, format); // Prepare and init ZStream switch (ZLibInit.Lib.PlatformLongSize) { case PlatformLongSize.Long32: { _zs32 = new ZStreamL32(); _zsPin = GCHandle.Alloc(_zs32, GCHandleType.Pinned); ZLibRet ret = ZLibInit.Lib.L32.InflateInit(_zs32, windowBits); ZLibException.CheckReturnValue(ret, _zs32); break; } case PlatformLongSize.Long64: { _zs64 = new ZStreamL64(); _zsPin = GCHandle.Alloc(_zs64, GCHandleType.Pinned); ZLibRet ret = ZLibInit.Lib.L64.InflateInit(_zs64, windowBits); ZLibException.CheckReturnValue(ret, _zs64); break; } default: throw new PlatformNotSupportedException(); } }
internal ZLibRet InflateInit(ZStreamL64 strm, int windowBits) { string zlibVer = Lib.ZLibVersion(); return(InflateInit2(strm, windowBits, zlibVer, Marshal.SizeOf <ZStreamL64>())); }