[Python-checkins] cpython (3.3): Issue #19418 Fix some warnings on Win64

tim.golden python-checkins at python.org
Thu Oct 31 18:40:57 CET 2013


http://hg.python.org/cpython/rev/54bf7b5ec3b6
changeset:   86811:54bf7b5ec3b6
branch:      3.3
parent:      86798:e6941225e014
user:        Tim Golden <mail at timgolden.me.uk>
date:        Thu Oct 31 17:38:24 2013 +0000
summary:
  Issue #19418 Fix some warnings on Win64

files:
  Modules/audioop.c |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Modules/audioop.c b/Modules/audioop.c
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -27,7 +27,8 @@
 #endif
 
 static const int maxvals[] = {0, 0x7F, 0x7FFF, 0x7FFFFF, 0x7FFFFFFF};
-static const int minvals[] = {0, -0x80, -0x8000, -0x800000, -0x80000000};
+/* -1 trick is needed on Windows to support -0x80000000 without a warning */
+static const int minvals[] = {0, -0x80, -0x8000, -0x800000, -0x7FFFFFFF-1};
 static const unsigned int masks[] = {0, 0xFF, 0xFFFF, 0xFFFFFF, 0xFFFFFFFF};
 
 static int
@@ -385,7 +386,9 @@
     signed char *cp;
     Py_ssize_t len, i;
     int size, val = 0;
-    int min = 0x7fffffff, max = -0x80000000;
+    /* -1 trick below is needed on Windows to support -0x80000000 without
+    a warning */
+    int min = 0x7fffffff, max = -0x7FFFFFFF-1;
 
     if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size))
         return NULL;

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


More information about the Python-checkins mailing list