params(p1, p2)
public
Changes the parameters of the deflate stream. See zlib.h for
details. The output from the stream by changing the params is preserved in output buffer.
TODO: document better!
Show source
/*
* call-seq: params(level, strategy)
*
* Changes the parameters of the deflate stream. See zlib.h for details. The
* output from the stream by changing the params is preserved in output
* buffer.
*
* TODO: document better!
*/
static VALUE
rb_deflate_params(obj, v_level, v_strategy)
VALUE obj, v_level, v_strategy;
{
struct zstream *z = get_zstream(obj);
int level, strategy;
int err;
level = ARG_LEVEL(v_level);
strategy = ARG_STRATEGY(v_strategy);
zstream_run(z, (Bytef*)"", 0, Z_SYNC_FLUSH);
err = deflateParams(&z->stream, level, strategy);
while (err == Z_BUF_ERROR) {
rb_warning("deflateParams() returned Z_BUF_ERROR");
zstream_expand_buffer(z);
err = deflateParams(&z->stream, level, strategy);
}
if (err != Z_OK) {
raise_zlib_error(err, z->stream.msg);
}
return Qnil;
}