diff options
Diffstat (limited to 'Modules/_bz2module.c')
-rw-r--r-- | Modules/_bz2module.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c index 2a9ad69..46da5ab 100644 --- a/Modules/_bz2module.c +++ b/Modules/_bz2module.c @@ -147,7 +147,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action) c->bzs.next_in = data; c->bzs.avail_in = 0; c->bzs.next_out = PyBytes_AS_STRING(result); - c->bzs.avail_out = PyBytes_GET_SIZE(result); + c->bzs.avail_out = SMALLCHUNK; for (;;) { char *this_out; int bzerror; @@ -155,7 +155,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action) /* On a 64-bit system, len might not fit in avail_in (an unsigned int). Do compression in chunks of no more than UINT_MAX bytes each. */ if (c->bzs.avail_in == 0 && len > 0) { - c->bzs.avail_in = Py_MIN(len, UINT_MAX); + c->bzs.avail_in = (unsigned int)Py_MIN(len, UINT_MAX); len -= c->bzs.avail_in; } @@ -171,7 +171,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action) c->bzs.next_out = PyBytes_AS_STRING(result) + data_size; buffer_left = PyBytes_GET_SIZE(result) - data_size; } - c->bzs.avail_out = Py_MIN(buffer_left, UINT_MAX); + c->bzs.avail_out = (unsigned int)Py_MIN(buffer_left, UINT_MAX); } Py_BEGIN_ALLOW_THREADS @@ -368,10 +368,10 @@ decompress(BZ2Decompressor *d, char *data, size_t len) d->bzs.next_in = data; /* On a 64-bit system, len might not fit in avail_in (an unsigned int). Do decompression in chunks of no more than UINT_MAX bytes each. */ - d->bzs.avail_in = Py_MIN(len, UINT_MAX); + d->bzs.avail_in = (unsigned int)Py_MIN(len, UINT_MAX); len -= d->bzs.avail_in; d->bzs.next_out = PyBytes_AS_STRING(result); - d->bzs.avail_out = PyBytes_GET_SIZE(result); + d->bzs.avail_out = SMALLCHUNK; for (;;) { char *this_out; int bzerror; @@ -397,7 +397,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len) if (d->bzs.avail_in == 0) { if (len == 0) break; - d->bzs.avail_in = Py_MIN(len, UINT_MAX); + d->bzs.avail_in = (unsigned int)Py_MIN(len, UINT_MAX); len -= d->bzs.avail_in; } if (d->bzs.avail_out == 0) { @@ -408,7 +408,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len) d->bzs.next_out = PyBytes_AS_STRING(result) + data_size; buffer_left = PyBytes_GET_SIZE(result) - data_size; } - d->bzs.avail_out = Py_MIN(buffer_left, UINT_MAX); + d->bzs.avail_out = (unsigned int)Py_MIN(buffer_left, UINT_MAX); } } if (data_size != PyBytes_GET_SIZE(result)) |