mirror of
https://github.com/google/brotli.git
synced 2025-01-13 18:00:07 +00:00
Update brotlimodule.cc
This commit is contained in:
parent
ca0ae4cbc0
commit
c49918e1ee
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user