/*
* call-seq: Zlib::Deflate.new(level=nil, windowBits=nil, memlevel=nil, strategy=nil)
*
* Creates a new deflate stream for compression. See zlib.h for details of
* each argument. If an argument is nil, the default value of that argument is
* used.
*
* TODO: document better!
*/
static VALUE
rb_deflate_initialize(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
struct zstream *z;
VALUE level, wbits, memlevel, strategy;
int err;
rb_scan_args(argc, argv, "04", &level, &wbits, &memlevel, &strategy);
Data_Get_Struct(obj, struct zstream, z);
err = deflateInit2(&z->stream, ARG_LEVEL(level), Z_DEFLATED,
ARG_WBITS(wbits), ARG_MEMLEVEL(memlevel),
ARG_STRATEGY(strategy));
if (err != Z_OK) {
raise_zlib_error(err, z->stream.msg);
}
ZSTREAM_READY(z);
return obj;
}