]> granicus.if.org Git - python/commitdiff
Fix issues on 32-bit systems introduced by r88460
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 21 Feb 2011 19:05:08 +0000 (19:05 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 21 Feb 2011 19:05:08 +0000 (19:05 +0000)
Modules/zlibmodule.c

index e439c5b964f9cf7b12bb642b13463c78506a6316..0189e77548d5b53fea77bc1be91c94faef011e22 100644 (file)
@@ -951,10 +951,10 @@ PyZlib_adler32(PyObject *self, PyObject *args)
         Py_BEGIN_ALLOW_THREADS
         /* Avoid truncation of length for very large buffers. adler32() takes
            length as an unsigned int, which may be narrower than Py_ssize_t. */
-        while (len > (Py_ssize_t)UINT_MAX) {
+        while (len > (size_t) UINT_MAX) {
             adler32val = adler32(adler32val, buf, UINT_MAX);
-            buf += UINT_MAX;
-            len -= UINT_MAX;
+            buf += (size_t) UINT_MAX;
+            len -= (size_t) UINT_MAX;
         }
         adler32val = adler32(adler32val, buf, len);
         Py_END_ALLOW_THREADS
@@ -989,10 +989,10 @@ PyZlib_crc32(PyObject *self, PyObject *args)
         Py_BEGIN_ALLOW_THREADS
         /* Avoid truncation of length for very large buffers. crc32() takes
            length as an unsigned int, which may be narrower than Py_ssize_t. */
-        while (len > (Py_ssize_t)UINT_MAX) {
+        while (len > (size_t) UINT_MAX) {
             crc32val = crc32(crc32val, buf, UINT_MAX);
-            buf += UINT_MAX;
-            len -= UINT_MAX;
+            buf += (size_t) UINT_MAX;
+            len -= (size_t) UINT_MAX;
         }
         signed_val = crc32(crc32val, buf, len);
         Py_END_ALLOW_THREADS