[Python-checkins] cpython: Issue #9566: Fix compiler warning on Windows 64-bit in _bz2module.c

victor.stinner python-checkins at python.org
Tue Jun 4 23:57:56 CEST 2013


http://hg.python.org/cpython/rev/46401ce03547
changeset:   84025:46401ce03547
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jun 04 23:18:48 2013 +0200
summary:
  Issue #9566: Fix compiler warning on Windows 64-bit in _bz2module.c

files:
  Modules/_bz2module.c |  14 +++++++-------
  1 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -147,7 +147,7 @@
     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 @@
         /* 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 @@
                 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 @@
     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 @@
         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 @@
                 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))

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list