Issue #22156: Fix some "comparison between signed and unsigned integers"

compiler warnings in the Modules/ subdirectory.
This commit is contained in:
Victor Stinner 2014-08-16 01:03:39 +02:00
parent 12174a5dca
commit 706768c687
13 changed files with 24 additions and 21 deletions

View file

@ -1263,7 +1263,8 @@ prepare_s(PyStructObject *self)
const char *s;
const char *fmt;
char c;
Py_ssize_t size, len, ncodes, num, itemsize;
Py_ssize_t size, len, num, itemsize;
size_t ncodes;
fmt = PyBytes_AS_STRING(self->s_format);
@ -1319,7 +1320,7 @@ prepare_s(PyStructObject *self)
}
/* check for overflow */
if ((ncodes + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) {
if ((ncodes + 1) > ((size_t)PY_SSIZE_T_MAX / sizeof(formatcode))) {
PyErr_NoMemory();
return -1;
}