[Python-checkins] cpython: Fix some warnings from MSVC

steve.dower python-checkins at python.org
Tue Sep 6 22:09:38 EDT 2016


https://hg.python.org/cpython/rev/68effb84fa6a
changeset:   103196:68effb84fa6a
user:        Steve Dower <steve.dower at microsoft.com>
date:        Tue Sep 06 19:09:15 2016 -0700
summary:
  Fix some warnings from MSVC

files:
  Modules/_ctypes/_ctypes.c            |  2 +-
  Modules/_decimal/libmpdec/vccompat.h |  4 ----
  Modules/audioop.c                    |  3 ++-
  Programs/_freeze_importlib.c         |  2 +-
  4 files changed, 4 insertions(+), 7 deletions(-)


diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -3067,7 +3067,7 @@
 };
 
 #ifdef MS_WIN32
-static PPROC FindAddress(void *handle, char *name, PyObject *type)
+static PPROC FindAddress(void *handle, const char *name, PyObject *type)
 {
 #ifdef MS_WIN64
     /* win64 has no stdcall calling conv, so it should
diff --git a/Modules/_decimal/libmpdec/vccompat.h b/Modules/_decimal/libmpdec/vccompat.h
--- a/Modules/_decimal/libmpdec/vccompat.h
+++ b/Modules/_decimal/libmpdec/vccompat.h
@@ -48,10 +48,6 @@
   #undef strtoll
   #define strtoll _strtoi64
   #define strdup _strdup
-  #define PRIi64 "I64i"
-  #define PRIu64 "I64u"
-  #define PRIi32 "I32i"
-  #define PRIu32 "I32u"
 #endif
 
 
diff --git a/Modules/audioop.c b/Modules/audioop.c
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -4,6 +4,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include <inttypes.h>
 
 typedef short PyInt16;
 
@@ -448,7 +449,7 @@
         int val = GETRAWSAMPLE(width, fragment->buf, i);
         /* Cast to unsigned before negating. Unsigned overflow is well-
         defined, but signed overflow is not. */
-        if (val < 0) absval = -(unsigned int)val;
+        if (val < 0) absval = (unsigned int)-(int64_t)val;
         else absval = val;
         if (absval > max) max = absval;
     }
diff --git a/Programs/_freeze_importlib.c b/Programs/_freeze_importlib.c
--- a/Programs/_freeze_importlib.c
+++ b/Programs/_freeze_importlib.c
@@ -58,7 +58,7 @@
         fprintf(stderr, "cannot fstat '%s'\n", inpath);
         goto error;
     }
-    text_size = status.st_size;
+    text_size = (size_t)status.st_size;
     text = (char *) malloc(text_size + 1);
     if (text == NULL) {
         fprintf(stderr, "could not allocate %ld bytes\n", (long) text_size);

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


More information about the Python-checkins mailing list