]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix warnings on 64-bit platforms about casts from pointers to ints.
authorGuido van Rossum <guido@python.org>
Thu, 12 Sep 2002 14:43:41 +0000 (14:43 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 12 Sep 2002 14:43:41 +0000 (14:43 +0000)
Two of these were real bugs.

Objects/obmalloc.c
Objects/stringobject.c
Objects/unicodeobject.c

index 95c0e87f9c35dce5a2acbfbee7e058ecfe718d4e..753b2ccfbcab7b8594c27b3bb2c5aa0003fb2bfb 100644 (file)
@@ -437,7 +437,7 @@ new_arena(void)
        arenabase = bp;
        nfreepools = ARENA_SIZE / POOL_SIZE;
        assert(POOL_SIZE * nfreepools == ARENA_SIZE);
-       excess = (uint)bp & POOL_SIZE_MASK;
+       excess = (uint) ((Py_uintptr_t)bp & POOL_SIZE_MASK);
        if (excess != 0) {
                --nfreepools;
                arenabase += POOL_SIZE - excess;
index c090e9b2d6a12b521b5b1c9cb4241a7e74ef13b4..92adb490ccccb1b7584df661349206abb959a202 100644 (file)
@@ -3883,7 +3883,8 @@ PyString_Format(PyObject *format, PyObject *args)
                                PyErr_Format(PyExc_ValueError,
                                  "unsupported format character '%c' (0x%x) "
                                  "at index %i",
-                                 c, c, fmt - 1 - PyString_AsString(format));
+                                 c, c,
+                                 (int)(fmt - 1 - PyString_AsString(format)));
                                goto error;
                        }
                        if (sign) {
index dab3a75ab6433657dabc56cea35291653910ef61..dde6b4704aa46db5a764039a46bf7df0328078bf 100644 (file)
@@ -6465,7 +6465,8 @@ PyObject *PyUnicode_Format(PyObject *format,
                             "unsupported format character '%c' (0x%x) "
                             "at index %i",
                             (31<=c && c<=126) ? c : '?', 
-                             c, fmt -1 - PyUnicode_AS_UNICODE(uformat));
+                             c,
+                            (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat)));
                goto onError;
            }
            if (sign) {