[Python-checkins] r84070 - in python/branches/py3k/Objects: bytearrayobject.c bytesobject.c

antoine.pitrou python-checkins at python.org
Sun Aug 15 19:12:55 CEST 2010


Author: antoine.pitrou
Date: Sun Aug 15 19:12:55 2010
New Revision: 84070

Log:
Fix some compilation warnings under 64-bit Windows (issue #9566).
Some of these are genuine bugs with objects bigger than 2GB, but
my system doesn't allow me to write tests for it.



Modified:
   python/branches/py3k/Objects/bytearrayobject.c
   python/branches/py3k/Objects/bytesobject.c

Modified: python/branches/py3k/Objects/bytearrayobject.c
==============================================================================
--- python/branches/py3k/Objects/bytearrayobject.c	(original)
+++ python/branches/py3k/Objects/bytearrayobject.c	Sun Aug 15 19:12:55 2010
@@ -1214,7 +1214,7 @@
     Py_ssize_t ival = PyNumber_AsSsize_t(arg, PyExc_ValueError);
     if (ival == -1 && PyErr_Occurred()) {
         Py_buffer varg;
-        int pos;
+        Py_ssize_t pos;
         PyErr_Clear();
         if (_getbuffer(arg, &varg) < 0)
             return -1;
@@ -1228,7 +1228,7 @@
         return -1;
     }
 
-    return memchr(PyByteArray_AS_STRING(self), ival, Py_SIZE(self)) != NULL;
+    return memchr(PyByteArray_AS_STRING(self), (int) ival, Py_SIZE(self)) != NULL;
 }
 
 

Modified: python/branches/py3k/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k/Objects/bytesobject.c	(original)
+++ python/branches/py3k/Objects/bytesobject.c	Sun Aug 15 19:12:55 2010
@@ -770,7 +770,7 @@
     Py_ssize_t ival = PyNumber_AsSsize_t(arg, PyExc_ValueError);
     if (ival == -1 && PyErr_Occurred()) {
         Py_buffer varg;
-        int pos;
+        Py_ssize_t pos;
         PyErr_Clear();
         if (_getbuffer(arg, &varg) < 0)
             return -1;
@@ -784,7 +784,7 @@
         return -1;
     }
 
-    return memchr(PyBytes_AS_STRING(self), ival, Py_SIZE(self)) != NULL;
+    return memchr(PyBytes_AS_STRING(self), (int) ival, Py_SIZE(self)) != NULL;
 }
 
 static PyObject *
@@ -1654,7 +1654,7 @@
 }
 
 Py_LOCAL_INLINE(Py_ssize_t)
-countchar(const char *target, int target_len, char c, Py_ssize_t maxcount)
+countchar(const char *target, Py_ssize_t target_len, char c, Py_ssize_t maxcount)
 {
     Py_ssize_t count=0;
     const char *start=target;
@@ -2609,7 +2609,7 @@
                 Py_DECREF(new);
                 return NULL;
             }
-            ((PyBytesObject *)new)->ob_sval[i] = value;
+            ((PyBytesObject *)new)->ob_sval[i] = (char) value;
         }
         return new;
     }
@@ -2630,7 +2630,7 @@
                 Py_DECREF(new);
                 return NULL;
             }
-            ((PyBytesObject *)new)->ob_sval[i] = value;
+            ((PyBytesObject *)new)->ob_sval[i] = (char) value;
         }
         return new;
     }
@@ -2685,7 +2685,7 @@
             if (_PyBytes_Resize(&new, size) < 0)
                 goto error;
         }
-        ((PyBytesObject *)new)->ob_sval[i] = value;
+        ((PyBytesObject *)new)->ob_sval[i] = (char) value;
     }
     _PyBytes_Resize(&new, i);
 


More information about the Python-checkins mailing list