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

victor.stinner python-checkins at python.org
Wed Jun 5 00:25:15 CEST 2013


http://hg.python.org/cpython/rev/5dcbd5d8d004
changeset:   84029:5dcbd5d8d004
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Jun 05 00:21:31 2013 +0200
summary:
  Issue #9566: Fix compiler warning on Windows 64-bit

files:
  Objects/unicodeobject.c |  8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -6725,7 +6725,8 @@
     /* each step cannot decode more than 1 character, but a character can be
        represented as a surrogate pair */
     wchar_t buffer[2], *startout, *out;
-    int insize, outsize;
+    int insize;
+    Py_ssize_t outsize;
     PyObject *errorHandler = NULL;
     PyObject *exc = NULL;
     PyObject *encoding_obj = NULL;
@@ -6995,10 +6996,11 @@
         Py_DECREF(substring);
         return -1;
     }
+    assert(size <= INT_MAX);
 
     /* First get the size of the result */
     outsize = WideCharToMultiByte(code_page, flags,
-                                  p, size,
+                                  p, (int)size,
                                   NULL, 0,
                                   NULL, pusedDefaultChar);
     if (outsize <= 0)
@@ -7035,7 +7037,7 @@
 
     /* Do the conversion */
     outsize = WideCharToMultiByte(code_page, flags,
-                                  p, size,
+                                  p, (int)size,
                                   out, outsize,
                                   NULL, pusedDefaultChar);
     Py_CLEAR(substring);

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


More information about the Python-checkins mailing list