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
/*
* call-seq: set_dictionary(string)
*
* 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!
*/
static VALUE
rb_deflate_set_dictionary(obj, dic)
VALUE obj, dic;
{
struct zstream *z = get_zstream(obj);
VALUE src = dic;
int err;
OBJ_INFECT(obj, dic);
StringValue(src);
err = deflateSetDictionary(&z->stream,
RSTRING(src)->ptr, RSTRING(src)->len);
if (err != Z_OK) {
raise_zlib_error(err, z->stream.msg);
}
return dic;
}