summaryrefslogtreecommitdiff
path: root/Modules/zlibmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r--Modules/zlibmodule.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index fccb6163e8..cfe7f88dc5 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.
@@ -199,18 +199,18 @@ arrange_output_buffer(z_stream *zst, PyObject **buffer, Py_ssize_t length)
/*[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.
/
+ level: int(c_default="Z_DEFAULT_COMPRESSION") = Z_DEFAULT_COMPRESSION
+ Compression level, in 0-9 or -1.
Returns a bytes object containing compressed data.
[clinic start generated code]*/
static PyObject *
-zlib_compress_impl(PyObject *module, Py_buffer *bytes, int level)
-/*[clinic end generated code: output=ae64c2c3076321a0 input=be3abe9934bda4b3]*/
+zlib_compress_impl(PyObject *module, Py_buffer *data, int level)
+/*[clinic end generated code: output=d80906d73f6294c8 input=638d54b6315dbed3]*/
{
PyObject *RetVal = NULL;
Byte *ibuf;
@@ -218,8 +218,8 @@ zlib_compress_impl(PyObject *module, Py_buffer *bytes, int level)
int err, flush;
z_stream zst;
- ibuf = bytes->buf;
- ibuflen = bytes->len;
+ ibuf = data->buf;
+ ibuflen = data->len;
zst.opaque = NULL;
zst.zalloc = PyZlib_Malloc;
@@ -318,11 +318,11 @@ zlib.decompress
data: Py_buffer
Compressed data.
+ /
wbits: int(c_default="MAX_WBITS") = MAX_WBITS
The window buffer size and container format.
bufsize: ssize_t(c_default="DEF_BUF_SIZE") = DEF_BUF_SIZE
The initial output buffer size.
- /
Returns a bytes object containing the uncompressed data.
[clinic start generated code]*/
@@ -330,7 +330,7 @@ Returns a bytes object containing the uncompressed data.
static PyObject *
zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
Py_ssize_t bufsize)
-/*[clinic end generated code: output=77c7e35111dc8c42 input=c13dd2c5696cd17f]*/
+/*[clinic end generated code: output=77c7e35111dc8c42 input=21960936208e9a5b]*/
{
PyObject *RetVal = NULL;
Byte *ibuf;
@@ -721,9 +721,9 @@ save_unconsumed_input(compobject *self, Py_buffer *data, int err)
new_data = PyBytes_FromStringAndSize(NULL, new_size);
if (new_data == NULL)
return -1;
- Py_MEMCPY(PyBytes_AS_STRING(new_data),
+ memcpy(PyBytes_AS_STRING(new_data),
PyBytes_AS_STRING(self->unused_data), old_size);
- Py_MEMCPY(PyBytes_AS_STRING(new_data) + old_size,
+ memcpy(PyBytes_AS_STRING(new_data) + old_size,
self->zst.next_in, left_size);
Py_SETREF(self->unused_data, new_data);
self->zst.avail_in = 0;
@@ -750,11 +750,11 @@ zlib.Decompress.decompress
data: Py_buffer
The binary data to decompress.
+ /
max_length: ssize_t = 0
The maximum allowable length of the decompressed data.
Unconsumed input data will be stored in
the unconsumed_tail attribute.
- /
Return a bytes object containing the decompressed version of the data.
@@ -766,7 +766,7 @@ Call the flush() method to clear these buffers.
static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
Py_ssize_t max_length)
-/*[clinic end generated code: output=6e5173c74e710352 input=d6de9b53c4566b8a]*/
+/*[clinic end generated code: output=6e5173c74e710352 input=b85a212a012b770a]*/
{
int err = Z_OK;
Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE, hard_limit;
@@ -1333,7 +1333,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"