Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Inflate() [2/2]

static unsafe int System.Net.WebSockets.Compression.WebSocketInflater.Inflate ( ZLibNative::ZLibStreamHandle stream,
Span< byte > destination,
ZLibNative::FlushCode flushCode )
inlinestaticprivate

Definition at line 178 of file WebSocketInflater.cs.

179 {
180 ZLibNative.ErrorCode errorCode;
181 fixed (byte* ptr = destination)
182 {
183 stream.NextOut = (IntPtr)ptr;
184 stream.AvailOut = (uint)destination.Length;
185 errorCode = stream.Inflate(flushCode);
186 if (errorCode == ZLibNative.ErrorCode.Ok || errorCode == ZLibNative.ErrorCode.StreamEnd || errorCode == ZLibNative.ErrorCode.BufError)
187 {
188 return destination.Length - (int)stream.AvailOut;
189 }
190 }
191 throw new WebSocketException(errorCode switch
192 {
193 ZLibNative.ErrorCode.MemError => System.SR.ZLibErrorNotEnoughMemory,
194 ZLibNative.ErrorCode.DataError => System.SR.ZLibUnsupportedCompression,
195 ZLibNative.ErrorCode.StreamError => System.SR.ZLibErrorInconsistentStream,
196 _ => string.Format(System.SR.ZLibErrorUnexpected, (int)errorCode),
197 });
198 }
static string ZLibErrorNotEnoughMemory
Definition SR.cs:46
static string ZLibUnsupportedCompression
Definition SR.cs:78
static string ZLibErrorInconsistentStream
Definition SR.cs:42
static string ZLibErrorUnexpected
Definition SR.cs:50
Definition SR.cs:7

References System.destination, System.stream, System.SR.ZLibErrorInconsistentStream, System.SR.ZLibErrorNotEnoughMemory, System.SR.ZLibErrorUnexpected, and System.SR.ZLibUnsupportedCompression.