Issue #9566: Fix compiler warning on Windows 64-bit in _bz2module.c

This commit is contained in:
Victor Stinner 2013-06-04 23:18:48 +02:00
parent c97ec8fa69
commit fbf50d43da
1 changed files with 7 additions and 7 deletions

View File

@ -147,7 +147,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
c->bzs.next_in = data; c->bzs.next_in = data;
c->bzs.avail_in = 0; c->bzs.avail_in = 0;
c->bzs.next_out = PyBytes_AS_STRING(result); c->bzs.next_out = PyBytes_AS_STRING(result);
c->bzs.avail_out = PyBytes_GET_SIZE(result); c->bzs.avail_out = SMALLCHUNK;
for (;;) { for (;;) {
char *this_out; char *this_out;
int bzerror; 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). /* 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. */ Do compression in chunks of no more than UINT_MAX bytes each. */
if (c->bzs.avail_in == 0 && len > 0) { 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; 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; c->bzs.next_out = PyBytes_AS_STRING(result) + data_size;
buffer_left = PyBytes_GET_SIZE(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 Py_BEGIN_ALLOW_THREADS
@ -368,10 +368,10 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
d->bzs.next_in = data; d->bzs.next_in = data;
/* On a 64-bit system, len might not fit in avail_in (an unsigned int). /* 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. */ 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; len -= d->bzs.avail_in;
d->bzs.next_out = PyBytes_AS_STRING(result); d->bzs.next_out = PyBytes_AS_STRING(result);
d->bzs.avail_out = PyBytes_GET_SIZE(result); d->bzs.avail_out = SMALLCHUNK;
for (;;) { for (;;) {
char *this_out; char *this_out;
int bzerror; int bzerror;
@ -397,7 +397,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
if (d->bzs.avail_in == 0) { if (d->bzs.avail_in == 0) {
if (len == 0) if (len == 0)
break; 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; len -= d->bzs.avail_in;
} }
if (d->bzs.avail_out == 0) { 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; d->bzs.next_out = PyBytes_AS_STRING(result) + data_size;
buffer_left = PyBytes_GET_SIZE(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)) if (data_size != PyBytes_GET_SIZE(result))