lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
#   Decompresses the source buffer into the destination buffer.  sourceLen is
# the byte length of the source buffer. Upon entry, destLen is the total
# size of the destination buffer, which must be large enough to hold the
# entire uncompressed data. (The size of the uncompressed data must have
# been saved previously by the compressor and transmitted to the decompressor
# by some mechanism outside the scope of this compression library.)
# Upon exit, destLen is the actual size of the compressed buffer.
#   This function can be used to decompress a whole file at once if the
# input file is mmap'ed.
#
#   uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
# enough memory, Z_BUF_ERROR if there was not enough room in the output
# buffer, or Z_DATA_ERROR if the input data was corrupted.
Decompresses the source buffer into the destination buffer.  sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the
entire uncompressed data. (The size of the uncompressed data must have
been saved previously by the compressor and transmitted to the decompressor
by some mechanism outside the scope of this compression library.)
Upon exit, destLen is the actual size of the compressed buffer.
This function can be used to decompress a whole file at once if the
input file is mmap'ed.

uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
Decompresses the source buffer into the destination buffer . sourceLen is the byte length of the source buffer . Upon entry destLen is the total size of the destination buffer which must be large enough to hold the entire uncompressed data . ( The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library . ) Upon exit destLen is the actual size of the compressed buffer . This function can be used to decompress a whole file at once if the input file is mmap ' ed . uncompress returns Z_OK if success Z_MEM_ERROR if there was not enough memory Z_BUF_ERROR if there was not enough room in the output buffer or Z_DATA_ERROR if the input data was corrupted .
def uncompress(dest,destLen,source,sourceLen)
    stream = Z_stream.new
    stream.next_in = Bytef.new(source)
    stream.avail_in = sourceLen
    return [Z_BUF_ERROR,destLen] if (stream.avail_in != sourceLen)
    stream.next_out = Bytef.new(dest)
    stream.avail_out = destLen
    return [Z_BUF_ERROR,destLen] if (stream.avail_out != destLen)
    err = inflateInit(stream)
    return [err,destLen] if (err != Z_OK)
    err = inflate(stream, Z_FINISH)
    if (err != Z_STREAM_END)
        inflateEnd(stream)
        if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
            return [Z_DATA_ERROR,destLen]
        end
        return [err,destLen]
    end
    destLen = stream.total_out
    err = inflateEnd(stream)
    return [err,destLen]
  end
def uncompress ( dest , destLen , source , sourceLen ) stream = Z_stream . new stream . next_in = Bytef . new ( source ) stream . avail_in = sourceLen return [ Z_BUF_ERROR , destLen ] if ( stream . avail_in != sourceLen ) stream . next_out = Bytef . new ( dest ) stream . avail_out = destLen return [ Z_BUF_ERROR , destLen ] if ( stream . avail_out != destLen ) err = inflateInit ( stream ) return [ err , destLen ] if ( err != Z_OK ) err = inflate ( stream , Z_FINISH ) if ( err != Z_STREAM_END ) inflateEnd ( stream ) if ( err == Z_NEED_DICT || ( err == Z_BUF_ERROR && stream . avail_in == 0 ) ) return [ Z_DATA_ERROR , destLen ] end return [ err , destLen ] end destLen = stream . total_out err = inflateEnd ( stream ) return [ err , destLen ] end
Decompresses the source buffer into the destination buffer.
Decompresses the source buffer into the destination buffer .
dest
<not_specific>
destLen
<not_specific>
source
<not_specific>
sourceLen
<not_specific>