Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compilation warnings #7050

Merged
merged 3 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
16 changes: 14 additions & 2 deletions src/libImaging/Quant.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -414,7 +422,9 @@ splitlists(
break;
}
c->flag = 0;
#ifndef NO_OUTPUT
nLeft++;
#endif
nCount[0] += c->count;
}
}
Expand All @@ -430,7 +440,9 @@ splitlists(
}
c->flag = 1;
nRight++;
#ifndef NO_OUTPUT
nLeft--;
#endif
nCount[0] -= c->count;
nCount[1] += c->count;
}
Expand Down