set_dictionary(p1)
public
Sets the preset dictionary and returns string. This method is
available just only after Zlib::Deflate.new or Zlib::ZStream#reset method was called.
See zlib.h for details.
TODO: document better!
Show source
static VALUE
rb_deflate_set_dictionary(VALUE obj, VALUE dic)
{
struct zstream *z = get_zstream(obj);
VALUE src = dic;
int err;
OBJ_INFECT(obj, dic);
StringValue(src);
err = deflateSetDictionary(&z->stream,
(Bytef*)RSTRING_PTR(src), RSTRING_LEN(src));
if (err != Z_OK) {
raise_zlib_error(err, z->stream.msg);
}
return dic;
}