Merge pull request #7050 from radarhere/warning

Fixed compilation warnings
This commit is contained in:
mergify[bot] 2023-03-31 12:23:08 +00:00 committed by GitHub
commit b4419169a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View File

@ -502,12 +502,9 @@ getink(PyObject *color, Imaging im, char *ink) {
be cast to either UINT8 or INT32 */
int rIsInt = 0;
int tupleSize;
if (PyTuple_Check(color)) {
tupleSize = PyTuple_GET_SIZE(color);
if (tupleSize == 1) {
color = PyTuple_GetItem(color, 0);
}
int tupleSize = PyTuple_Check(color) ? PyTuple_GET_SIZE(color) : -1;
if (tupleSize == 1) {
color = PyTuple_GetItem(color, 0);
}
if (im->type == IMAGING_TYPE_UINT8 || im->type == IMAGING_TYPE_INT32 ||
im->type == IMAGING_TYPE_SPECIAL) {
@ -521,7 +518,7 @@ getink(PyObject *color, Imaging im, char *ink) {
PyErr_SetString(
PyExc_TypeError, "color must be int or single-element tuple");
return NULL;
} else if (!PyTuple_Check(color)) {
} else if (tupleSize == -1) {
PyErr_SetString(PyExc_TypeError, "color must be int or tuple");
return NULL;
}

View File

@ -341,7 +341,10 @@ splitlists(
PixelList *l, *r, *c, *n;
int i;
int nRight, nLeft;
int nRight;
#ifndef NO_OUTPUT
int nLeft;
#endif
int splitColourVal;
#ifdef TEST_SPLIT
@ -396,12 +399,17 @@ splitlists(
}
#endif
nCount[0] = nCount[1] = 0;
nLeft = nRight = 0;
nRight = 0;
#ifndef NO_OUTPUT
nLeft = 0;
#endif
for (left = 0, c = h[axis]; c;) {
left = left + c->count;
nCount[0] += c->count;
c->flag = 0;
#ifndef NO_OUTPUT
nLeft++;
#endif
c = c->next[axis];
if (left * 2 > pixelCount) {
break;
@ -414,7 +422,9 @@ splitlists(
break;
}
c->flag = 0;
#ifndef NO_OUTPUT
nLeft++;
#endif
nCount[0] += c->count;
}
}
@ -430,7 +440,9 @@ splitlists(
}
c->flag = 1;
nRight++;
#ifndef NO_OUTPUT
nLeft--;
#endif
nCount[0] -= c->count;
nCount[1] += c->count;
}