summaryrefslogtreecommitdiffstats
path: root/Modules/audioop.c
diff options
context:
space:
mode:
authorTim Golden <mail@timgolden.me.uk>2013-10-31 10:25:47 (GMT)
committerTim Golden <mail@timgolden.me.uk>2013-10-31 10:25:47 (GMT)
commitfa6ab0fa5b62043d62d45c7d8503bbce58a1684d (patch)
tree7ff0a410e324a5c80651b394d00490e35fac2676 /Modules/audioop.c
parent472805df59d4f046d5bc8a10253914e2729428df (diff)
downloadcpython-fa6ab0fa5b62043d62d45c7d8503bbce58a1684d.zip
cpython-fa6ab0fa5b62043d62d45c7d8503bbce58a1684d.tar.gz
cpython-fa6ab0fa5b62043d62d45c7d8503bbce58a1684d.tar.bz2
Issue #19418 Fix some warnings on Win64
Diffstat (limited to 'Modules/audioop.c')
-rw-r--r--Modules/audioop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 5e1de1b..342f262 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -15,7 +15,8 @@ typedef short PyInt16;
#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
@@ -434,7 +435,9 @@ audioop_minmax(PyObject *self, PyObject *args)
signed char *cp;
Py_ssize_t len, i;
int size;
- 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;