]> granicus.if.org Git - python/commitdiff
Fix some warnings from MSVC
authorSteve Dower <steve.dower@microsoft.com>
Wed, 7 Sep 2016 02:09:15 +0000 (19:09 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Wed, 7 Sep 2016 02:09:15 +0000 (19:09 -0700)
Modules/_ctypes/_ctypes.c
Modules/_decimal/libmpdec/vccompat.h
Modules/audioop.c
Programs/_freeze_importlib.c

index 98433e12f5088719e07857febc65586cfb3f7592..f8407298fed8eb057a643f7eed1de410af1b0115 100644 (file)
@@ -3067,7 +3067,7 @@ static PyGetSetDef PyCFuncPtr_getsets[] = {
 };
 
 #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
index 564eaa8140d274d6cd5851bd5af0eece7e24d283..dd131d8da2645c66fa241e55ca55d126f1447dfc 100644 (file)
   #undef strtoll
   #define strtoll _strtoi64
   #define strdup _strdup
-  #define PRIi64 "I64i"
-  #define PRIu64 "I64u"
-  #define PRIi32 "I32i"
-  #define PRIu32 "I32u"
 #endif
 
 
index c11506c4c10ae838b7f6d4717c42223a0091bcb5..d715783d52ad4ea58bb9fbcacdd3125f687e8fd2 100644 (file)
@@ -4,6 +4,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
+#include <inttypes.h>
 
 typedef short PyInt16;
 
@@ -448,7 +449,7 @@ audioop_max_impl(PyObject *module, Py_buffer *fragment, int width)
         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;
     }
index 0793984800452e62a0ea9deebcf07cb13eda4517..1069966a1876ed61a195aa2fefaa56340a483d95 100644 (file)
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
         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);