aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorCosimo Lupo <cosimo.lupo@daltonmaag.com>2015-05-11 11:09:36 +0100
committerCosimo Lupo <cosimo.lupo@daltonmaag.com>2015-05-11 11:09:36 +0100
commitaa6f7d8f0cc71ca35b8adb310caadfa51dd740d5 (patch)
tree3121a0f4e2d06ecc2cd075611fcbc8c645de95f5 /python
parentb7e8291788513ffb7fcb0c2eb7be2e238cbc1f93 (diff)
downloadbrotli-aa6f7d8f0cc71ca35b8adb310caadfa51dd740d5.zip
brotli-aa6f7d8f0cc71ca35b8adb310caadfa51dd740d5.tar.gz
brotli-aa6f7d8f0cc71ca35b8adb310caadfa51dd740d5.tar.bz2
[brotlimodule] add MODE_GENERIC constant
Diffstat (limited to 'python')
-rw-r--r--python/brotlimodule.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/brotlimodule.cc b/python/brotlimodule.cc
index 5be424e..b122b1f 100644
--- a/python/brotlimodule.cc
+++ b/python/brotlimodule.cc
@@ -20,7 +20,8 @@ static int mode_convertor(PyObject *o, BrotliParams::Mode *mode) {
}
*mode = (BrotliParams::Mode) PyInt_AsLong(o);
- if (*mode != BrotliParams::Mode::MODE_TEXT &&
+ if (*mode != BrotliParams::Mode::MODE_GENERIC &&
+ *mode != BrotliParams::Mode::MODE_TEXT &&
*mode != BrotliParams::Mode::MODE_FONT) {
PyErr_SetString(BrotliError, "Invalid mode");
return 0;
@@ -78,14 +79,14 @@ PyDoc_STRVAR(compress__doc__,
"Compress a byte string.\n"
"\n"
"Signature:\n"
-" compress(string, mode=MODE_TEXT, quality=11, lgwin=22, lgblock=0,\n"
+" compress(string, mode=MODE_GENERIC, quality=11, lgwin=22, lgblock=0,\n"
" enable_dictionary=True, enable_transforms=False\n"
" greedy_block_split=False, enable_context_modeling=True)\n"
"\n"
"Args:\n"
" string (bytes): The input data.\n"
-" mode (int, optional): The compression mode can be MODE_TEXT (default) or\n"
-" MODE_FONT.\n"
+" mode (int, optional): The compression mode can be MODE_GENERIC (default),\n"
+" MODE_TEXT (for UTF-8 format text input) or MODE_FONT (for WOFF 2.0). \n"
" quality (int, optional): Controls the compression-speed vs compression-\n"
" density tradeoff. The higher the quality, the slower the compression.\n"
" Range is 0 to 11. Defaults to 11.\n"
@@ -265,6 +266,7 @@ PyMODINIT_FUNC INIT_BROTLI(void) {
PyModule_AddObject(m, "error", BrotliError);
}
+ PyModule_AddIntConstant(m, "MODE_GENERIC", (int) BrotliParams::Mode::MODE_GENERIC);
PyModule_AddIntConstant(m, "MODE_TEXT", (int) BrotliParams::Mode::MODE_TEXT);
PyModule_AddIntConstant(m, "MODE_FONT", (int) BrotliParams::Mode::MODE_FONT);