Skip to content

Commit

Permalink
Fix compiler warnings for unused local variables
Browse files Browse the repository at this point in the history
Instead of assigning the return value to an otherwise unused variable
(which also raises a compiler warning), use a cast to void to explicitly
indicate that the return value is intentionally ignored.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jan 24, 2024
1 parent a58a745 commit 0de3544
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/colormap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ PIXCMAP *cmap;
PIXCMAP *
pixcmapReadStream(FILE *fp)
{
l_int32 rval, gval, bval, aval, ignore;
l_int32 rval, gval, bval, aval;
l_int32 i, index, ret, depth, ncolors;
PIXCMAP *cmap;

Expand All @@ -1800,8 +1800,8 @@ PIXCMAP *cmap;
(depth != 1 && depth != 2 && depth != 4 && depth != 8) ||
(ncolors < 2 || ncolors > 256))
return (PIXCMAP *)ERROR_PTR("invalid cmap size", __func__, NULL);
ignore = fscanf(fp, "Color R-val G-val B-val Alpha\n");
ignore = fscanf(fp, "----------------------------------------\n");
(void)fscanf(fp, "Color R-val G-val B-val Alpha\n");
(void)fscanf(fp, "----------------------------------------\n");

if ((cmap = pixcmapCreate(depth)) == NULL)
return (PIXCMAP *)ERROR_PTR("cmap not made", __func__, NULL);
Expand Down
8 changes: 4 additions & 4 deletions src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ L_KERNEL *kel;
L_KERNEL *
kernelReadStream(FILE *fp)
{
l_int32 sy, sx, cy, cx, i, j, ret, version, ignore;
l_int32 sy, sx, cy, cx, i, j, ret, version;
L_KERNEL *kel;

if (!fp)
Expand All @@ -562,10 +562,10 @@ L_KERNEL *kel;

for (i = 0; i < sy; i++) {
for (j = 0; j < sx; j++)
ignore = fscanf(fp, "%15f", &kel->data[i][j]);
ignore = fscanf(fp, "\n");
(void)fscanf(fp, "%15f", &kel->data[i][j]);
(void)fscanf(fp, "\n");
}
ignore = fscanf(fp, "\n");
(void)fscanf(fp, "\n");

return kel;
}
Expand Down
2 changes: 0 additions & 2 deletions src/pnmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,8 +1327,6 @@ static l_int32
pnmReadNextAsciiValue(FILE *fp,
l_int32 *pval)
{
l_int32 ignore;

if (!pval)
return ERROR_INT("&val not defined", __func__, 1);
*pval = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/sarray1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ SARRAY *
sarrayReadStream(FILE *fp)
{
char *stringbuf;
l_int32 i, n, size, index, bufsize, version, ignore, success;
l_int32 i, n, size, index, bufsize, version, success;
SARRAY *sa;

if (!fp)
Expand Down Expand Up @@ -1435,7 +1435,7 @@ SARRAY *sa;
/* Copy it in, skipping the 2 leading spaces */
sarrayAddString(sa, stringbuf + 2, L_COPY);
}
ignore = fscanf(fp, "\n");
(void)fscanf(fp, "\n");

cleanup:
LEPT_FREE(stringbuf);
Expand Down
10 changes: 5 additions & 5 deletions src/sel1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ selReadStream(FILE *fp)
{
char selname[256];
char linebuf[256];
l_int32 sy, sx, cy, cx, i, j, version, ignore;
l_int32 sy, sx, cy, cx, i, j, version;
SEL *sel;

if (!fp)
Expand All @@ -1375,12 +1375,12 @@ SEL *sel;
selSetOrigin(sel, cy, cx);

for (i = 0; i < sy; i++) {
ignore = fscanf(fp, " ");
(void)fscanf(fp, " ");
for (j = 0; j < sx; j++)
ignore = fscanf(fp, "%1d", &sel->data[i][j]);
ignore = fscanf(fp, "\n");
(void)fscanf(fp, "%1d", &sel->data[i][j]);
(void)fscanf(fp, "\n");
}
ignore = fscanf(fp, "\n");
(void)fscanf(fp, "\n");

return sel;
}
Expand Down

0 comments on commit 0de3544

Please sign in to comment.