summaryrefslogtreecommitdiff
path: root/Modules/zlibmodule.c
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-06-05 12:07:48 +0000
committerMartin Panter <vadmium+py@gmail.com>2016-06-05 12:07:48 +0000
commite44f1414a51e0d974ee21c1574401306229f6360 (patch)
treebf7388c54c2f4ff2d81885bd63a11947b1828c90 /Modules/zlibmodule.c
parent788bc4bd493239877e409624542bbc67b7053032 (diff)
parent87e36461ea18d6639e0e8ee6f101ca5d0f4ae0c5 (diff)
downloadcpython-e44f1414a51e0d974ee21c1574401306229f6360.tar.gz
Issue #27164: Merge raw Deflate zdict support from 3.5
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r--Modules/zlibmodule.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 16cc17886b..ad6f28d7bc 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -57,7 +57,7 @@ typedef struct
} compobject;
static void
-zlib_error(z_stream zst, int err, char *msg)
+zlib_error(z_stream zst, int err, const char *msg)
{
const char *zmsg = Z_NULL;
/* In case of a version mismatch, zst.msg won't be initialized.
@@ -141,18 +141,17 @@ PyZlib_Free(voidpf ctx, void *ptr)
/*[clinic input]
zlib.compress
- bytes: Py_buffer
+ data: Py_buffer
Binary data to be compressed.
level: int(c_default="Z_DEFAULT_COMPRESSION") = Z_DEFAULT_COMPRESSION
- Compression level, in 0-9.
- /
+ Compression level, in 0-9 or -1.
Returns a bytes object containing compressed data.
[clinic start generated code]*/
static PyObject *
-zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int level)
-/*[clinic end generated code: output=5d7dd4588788efd3 input=be3abe9934bda4b3]*/
+zlib_compress_impl(PyModuleDef *module, Py_buffer *data, int level)
+/*[clinic end generated code: output=1b97589132b203b4 input=abed30f4fa14e213]*/
{
PyObject *ReturnVal = NULL;
Byte *input, *output = NULL;
@@ -160,13 +159,13 @@ zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int level)
int err;
z_stream zst;
- if ((size_t)bytes->len > UINT_MAX) {
+ if ((size_t)data->len > UINT_MAX) {
PyErr_SetString(PyExc_OverflowError,
"Size does not fit in an unsigned int");
goto error;
}
- input = bytes->buf;
- length = (unsigned int)bytes->len;
+ input = data->buf;
+ length = (unsigned int)data->len;
zst.avail_out = length + length/1000 + 12 + 1;
@@ -1352,7 +1351,7 @@ PyDoc_STRVAR(zlib_module_documentation,
"zlib library, which is based on GNU zip.\n"
"\n"
"adler32(string[, start]) -- Compute an Adler-32 checksum.\n"
-"compress(string[, level]) -- Compress string, with compression level in 0-9.\n"
+"compress(data[, level]) -- Compress data, with compression level 0-9 or -1.\n"
"compressobj([level[, ...]]) -- Return a compressor object.\n"
"crc32(string[, start]) -- Compute a CRC-32 checksum.\n"
"decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n"