summaryrefslogtreecommitdiff
path: root/Modules/zlibmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-04-06 09:50:03 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-04-06 09:50:03 +0300
commit6d080f12a4ea2b60d07541af6cc363e491e5aa34 (patch)
treec22a0f8591e4fb5ea4310c33653830a0c84c3a3c /Modules/zlibmodule.c
parent58455ad4ed5e6f1eda17ceb0dd7f5612a980e48d (diff)
parent850c5fb7f500033305e142b3c47fd744fc6a62e5 (diff)
downloadcpython-6d080f12a4ea2b60d07541af6cc363e491e5aa34.tar.gz
Issue #22570: Renamed Py_SETREF to Py_XSETREF.
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 802e7dbe74..04485eeffc 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -53,7 +53,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.
@@ -137,18 +137,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;
@@ -156,13 +155,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;
@@ -1323,7 +1322,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"