Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Modules/audioop.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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
Expand Down Expand Up @@ -393,7 +394,9 @@ audioop_minmax(PyObject *self, PyObject *args)
signed char *cp;
int len, size, val = 0;
int i;
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;
Expand Down