diff options
author | Cosimo Lupo <cosimo.lupo@daltonmaag.com> | 2015-05-08 11:47:00 +0100 |
---|---|---|
committer | Cosimo Lupo <cosimo.lupo@daltonmaag.com> | 2015-05-11 10:39:18 +0100 |
commit | 6264bea2e49db2991cc4d5e3eef89c27c19289d5 (patch) | |
tree | d41597143174626d2c1671f4748a3be77009e2b5 /python | |
parent | b2eba122c8b965129ae002791d868898affdccdc (diff) | |
download | brotli-6264bea2e49db2991cc4d5e3eef89c27c19289d5.zip brotli-6264bea2e49db2991cc4d5e3eef89c27c19289d5.tar.gz brotli-6264bea2e49db2991cc4d5e3eef89c27c19289d5.tar.bz2 |
[brotlimodule] add greedy_block_split parameter (defaults to False);
renamed variables: transform -> enable_transforms, dictionary -> enable_dictionary
Diffstat (limited to 'python')
-rw-r--r-- | python/brotlimodule.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/python/brotlimodule.cc b/python/brotlimodule.cc index 515b701..f843d1e 100644 --- a/python/brotlimodule.cc +++ b/python/brotlimodule.cc @@ -40,6 +40,9 @@ PyDoc_STRVAR(compress__doc__, " dictionary. Defaults to True. Respected only if quality > 9.\n" " enable_transforms (bool, optional): Controls whether to enable encoder\n" " transforms. Defaults to False. Respected only if quality > 9.\n" +" greedy_block_split (bool, optional): Controls whether to enable a faster\n" +" but less dense compression mode. Defaults to False. Respected only if\n" +" quality > 9.\n" "\n" "Returns:\n" " The compressed string of bytes.\n" @@ -49,20 +52,23 @@ PyDoc_STRVAR(compress__doc__, static PyObject* brotli_compress(PyObject *self, PyObject *args, PyObject *keywds) { PyObject *ret = NULL; - PyObject* dictionary = NULL; - PyObject* transform = NULL; + PyObject* enable_dictionary = NULL; + PyObject* enable_transforms = NULL; + PyObject* greedy_block_split = NULL; uint8_t *input, *output; size_t length, output_length; BrotliParams::Mode mode = (BrotliParams::Mode) -1; int ok; - static char *kwlist[] = {"data", "mode", "enable_dictionary", "enable_transforms", NULL}; + static char *kwlist[] = {"data", "mode", "enable_dictionary", "enable_transforms", + "greedy_block_split", NULL}; - ok = PyArg_ParseTupleAndKeywords(args, keywds, "s#|O&O!O!:compress", kwlist, + ok = PyArg_ParseTupleAndKeywords(args, keywds, "s#|O&O!O!O!:compress", kwlist, &input, &length, &mode_convertor, &mode, - &PyBool_Type, &dictionary, - &PyBool_Type, &transform); + &PyBool_Type, &enable_dictionary, + &PyBool_Type, &enable_transforms, + &PyBool_Type, &greedy_block_split); if (!ok) return NULL; @@ -73,10 +79,12 @@ static PyObject* brotli_compress(PyObject *self, PyObject *args, PyObject *keywd BrotliParams params; if (mode != -1) params.mode = mode; - if (dictionary) - params.enable_dictionary = PyObject_IsTrue(dictionary); - if (transform) - params.enable_transforms = PyObject_IsTrue(transform); + if (enable_dictionary) + params.enable_dictionary = PyObject_IsTrue(enable_dictionary); + if (enable_transforms) + params.enable_transforms = PyObject_IsTrue(enable_transforms); + if (greedy_block_split) + params.greedy_block_split = PyObject_IsTrue(greedy_block_split); ok = BrotliCompressBuffer(params, length, input, &output_length, output); |