[Python-checkins] cpython: Fix compiler warnings

victor.stinner python-checkins at python.org
Tue Nov 22 03:25:39 CET 2011


http://hg.python.org/cpython/rev/0212e83e7c41
changeset:   73684:0212e83e7c41
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Tue Nov 22 02:30:47 2011 +0100
summary:
  Fix compiler warnings

files:
  Modules/_io/textio.c    |  2 +-
  Modules/posixmodule.c   |  2 +-
  Objects/unicodeobject.c |  3 ++-
  3 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1431,7 +1431,7 @@
 
     /* Read a chunk, decode it, and put the result in self._decoded_chars. */
     if (size_hint > 0) {
-        size_hint = Py_MAX(self->b2cratio, 1.0) * size_hint;
+        size_hint = (Py_ssize_t)(Py_MAX(self->b2cratio, 1.0) * size_hint);
     }
     chunk_size = PyLong_FromSsize_t(Py_MAX(self->chunk_size, size_hint));
     if (chunk_size == NULL)
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7756,9 +7756,9 @@
     PyObject *os1, *os2;
     char *s1, *s2;
     char *newenv;
+    size_t len;
 #endif
     PyObject *newstr = NULL;
-    size_t len;
 
 #ifdef MS_WINDOWS
     if (!PyArg_ParseTuple(args,
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4330,7 +4330,8 @@
 refit_partial_string(PyObject **unicode, int kind, void *data, Py_ssize_t n)
 {
     PyObject *tmp;
-    Py_ssize_t k, maxchar;
+    Py_ssize_t k;
+    Py_UCS4 maxchar;
     for (k = 0, maxchar = 0; k < n; k++)
         maxchar = Py_MAX(maxchar, PyUnicode_READ(kind, data, k));
     tmp = PyUnicode_New(PyUnicode_GET_LENGTH(*unicode), maxchar);

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


More information about the Python-checkins mailing list