lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
#   Compresses the source buffer into the destination buffer. The level
# parameter has the same meaning as in deflateInit.  sourceLen is the byte
# length of the source buffer. Upon entry, destLen is the total size of the
# destination buffer, which must be at least 0.1% larger than sourceLen plus
# 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
#
#   compress2 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,
# Z_STREAM_ERROR if the level parameter is invalid.
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit.  sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least 0.1% larger than sourceLen plus
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.

compress2 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,
Z_STREAM_ERROR if the level parameter is invalid.
Compresses the source buffer into the destination buffer . The level parameter has the same meaning as in deflateInit . sourceLen is the byte length of the source buffer . Upon entry destLen is the total size of the destination buffer which must be at least 0 . 1% larger than sourceLen plus 12 bytes . Upon exit destLen is the actual size of the compressed buffer . compress2 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 Z_STREAM_ERROR if the level parameter is invalid .
def compress2(dest,destLen,source,sourceLen,level)
    stream = Z_stream.new
    stream.next_in = Bytef.new(source)
    stream.avail_in = sourceLen
    stream.next_out = Bytef.new(dest)
    stream.avail_out = destLen
    if (stream.avail_out != destLen)
      return [Z_BUF_ERROR,destLen]
    end
    err = deflateInit(stream, level)
    if (err != Z_OK)
      return [err,destLen]
    end
    err = deflate(stream, Z_FINISH)
    if (err != Z_STREAM_END)
      deflateEnd(stream)
      if err == Z_OK
        return [Z_BUF_ERROR,destLen]
      else
        return [err,destLen]
      end
    end
    destLen = stream.total_out
    err = deflateEnd(stream)
    return [err,destLen]
  end
def compress2 ( dest , destLen , source , sourceLen , level ) stream = Z_stream . new stream . next_in = Bytef . new ( source ) stream . avail_in = sourceLen stream . next_out = Bytef . new ( dest ) stream . avail_out = destLen if ( stream . avail_out != destLen ) return [ Z_BUF_ERROR , destLen ] end err = deflateInit ( stream , level ) if ( err != Z_OK ) return [ err , destLen ] end err = deflate ( stream , Z_FINISH ) if ( err != Z_STREAM_END ) deflateEnd ( stream ) if err == Z_OK return [ Z_BUF_ERROR , destLen ] else return [ err , destLen ] end end destLen = stream . total_out err = deflateEnd ( stream ) return [ err , destLen ] end
Compresses the source buffer into the destination buffer.
Compresses the source buffer into the destination buffer .
dest
<not_specific>
destLen
<not_specific>
source
<not_specific>
sourceLen
<not_specific>
level
<not_specific>