diff options
author | eustas <eustas.ru@gmail.com> | 2016-01-25 12:07:39 +0100 |
---|---|---|
committer | eustas <eustas.ru@gmail.com> | 2016-01-25 12:07:39 +0100 |
commit | c49918e1eec2c1206ff9e9bce545c4bb27ce590b (patch) | |
tree | 5f45b75a4975e429e429f2b60fb1ab71448e9fdc /python | |
parent | ca0ae4cbc01aa290495c84082d5358bf49045c1d (diff) | |
download | brotli-c49918e1eec2c1206ff9e9bce545c4bb27ce590b.zip brotli-c49918e1eec2c1206ff9e9bce545c4bb27ce590b.tar.gz brotli-c49918e1eec2c1206ff9e9bce545c4bb27ce590b.tar.bz2 |
Update brotlimodule.cc
Diffstat (limited to 'python')
-rw-r--r-- | python/brotlimodule.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/python/brotlimodule.cc b/python/brotlimodule.cc index 7994713..0f5e27c 100644 --- a/python/brotlimodule.cc +++ b/python/brotlimodule.cc @@ -29,10 +29,15 @@ static int mode_convertor(PyObject *o, BrotliParams::Mode *mode) { return 0; } - if (!as_uint8(o, mode) || - (*mode != BrotliParams::MODE_GENERIC && - *mode != BrotliParams::MODE_TEXT && - *mode != BrotliParams::MODE_FONT)) { + int mode_value = -1; + if (!as_uint8(o, mode_value)) { + PyErr_SetString(BrotliError, "Invalid mode"); + return 0; + } + *mode = (BrotliParams) mode_value; + if (*mode != BrotliParams::MODE_GENERIC && + *mode != BrotliParams::MODE_TEXT && + *mode != BrotliParams::MODE_FONT) { PyErr_SetString(BrotliError, "Invalid mode"); return 0; } |