Example #1
0
        /// <summary>
        /// All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output.
        /// </summary>
        /// <returns>
        /// inflateEnd returns <see cref="ZLibResultCode.Z_OK" /> if success, <see cref="ZLibResultCode.Z_STREAM_ERROR" /> if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated).
        /// </returns>
        internal int inflateEnd()
        {
            next_in_index  = 0;
            next_out_index = 0;

            if (_istate == null)
            {
                return((int)ZLibResultCode.Z_STREAM_ERROR);
            }
            int ret = _istate.inflateEnd(this);

            _istate = null;
            return(ret);
        }
Example #2
0
 /// <summary>
 /// This is another version of <see cref="inflateInit()" /> with an extra parameter. The fields <see cref="next_in" />, <see cref="avail_in" /> must be initialized before by the caller. If <see cref="next_in" /> is not <c>null</c> and <see cref="avail_in" /> is large enough (the exact value depends on the compression method), <see cref="inflateInit(int)" /> determines the compression method from the ZLib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of <see cref="inflate" />.
 /// </summary>
 /// <param name="windowBits">The <c>windowBits</c> parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range <c>8..15</c> for this version of the library. The default value is 15 if <see cref="inflateInit(int)" /> is used instead. If a compressed stream with a larger window size is given as input, <see cref="inflate" /> will return with the error code <see cref="ZLibResultCode.Z_DATA_ERROR" /> instead of trying to allocate a larger window.</param>
 /// <returns>
 /// inflateInit returns <see cref="ZLibResultCode.Z_OK" /> if success, <see cref="ZLibResultCode.Z_MEM_ERROR" /> if there was not enough memory, <see cref="ZLibResultCode.Z_STREAM_ERROR" /> if a parameter is invalid (such as a negative memLevel). <see cref="msg" /> is set to null if there is no error message. <see cref="inflateInit(int)" /> does not perform any decompression apart from reading the ZLib header if present: this will be done by <see cref="inflate" />. (So <see cref="next_in" /> and <see cref="avail_in" /> may be modified, but <see cref="next_out" /> and <see cref="avail_out" /> are unchanged.)
 /// </returns>
 internal int inflateInit(int windowBits)
 {
     _istate = new Inflate();
     return(_istate.inflateInit(this, windowBits));
 }