Fix warnings

This commit is contained in:
Jaime Passos 2020-01-06 18:31:08 -03:00
parent a1af6b9134
commit 4407eb0c0a

View file

@ -106,7 +106,7 @@ void *Picture_PatchConvert(
INT16 inwidth, INT16 inheight, INT16 inleftoffset, INT16 intopoffset, INT16 inwidth, INT16 inheight, INT16 inleftoffset, INT16 intopoffset,
pictureflags_t flags) pictureflags_t flags)
{ {
UINT32 x, y; INT16 x, y;
UINT8 *img; UINT8 *img;
UINT8 *imgptr = imgbuf; UINT8 *imgptr = imgbuf;
UINT8 *colpointers, *startofspan; UINT8 *colpointers, *startofspan;
@ -114,14 +114,14 @@ void *Picture_PatchConvert(
patch_t *inpatch = NULL; patch_t *inpatch = NULL;
INT32 inbpp = Picture_FormatBPP(informat); INT32 inbpp = Picture_FormatBPP(informat);
(void)insize; // ignore
if (informat == outformat) if (informat == outformat)
I_Error("Picture_PatchConvert: input and output formats are the same!"); I_Error("Picture_PatchConvert: input and output formats are the same!");
if (!inbpp) if (!inbpp)
I_Error("Picture_PatchConvert: unknown input bits per pixel?!"); I_Error("Picture_PatchConvert: unknown input bits per pixel?!");
(void)insize; // ignore
// If it's a patch, you can just figure out // If it's a patch, you can just figure out
// the dimensions from the header. // the dimensions from the header.
if (Picture_IsPatchFormat(informat)) if (Picture_IsPatchFormat(informat))
@ -168,13 +168,13 @@ void *Picture_PatchConvert(
switch (informat) switch (informat)
{ {
case PICFMT_FLAT32: case PICFMT_FLAT32:
input = picture + (offs * 4); input = (UINT32 *)picture + offs;
break; break;
case PICFMT_FLAT16: case PICFMT_FLAT16:
input = picture + (offs * 2); input = (UINT16 *)picture + offs;
break; break;
case PICFMT_FLAT: case PICFMT_FLAT:
input = picture + offs; input = (UINT8 *)picture + offs;
break; break;
default: default:
I_Error("Picture_PatchConvert: unsupported flat input format!"); I_Error("Picture_PatchConvert: unsupported flat input format!");
@ -355,6 +355,10 @@ void *Picture_FlatConvert(
INT32 x, y; INT32 x, y;
size_t size; size_t size;
(void)insize; // ignore
(void)inleftoffset; // ignore
(void)intopoffset; // ignore
if (informat == outformat) if (informat == outformat)
I_Error("Picture_FlatConvert: input and output formats are the same!"); I_Error("Picture_FlatConvert: input and output formats are the same!");
@ -370,8 +374,6 @@ void *Picture_FlatConvert(
inpatch = (patch_t *)picture; inpatch = (patch_t *)picture;
inwidth = SHORT(inpatch->width); inwidth = SHORT(inpatch->width);
inheight = SHORT(inpatch->height); inheight = SHORT(inpatch->height);
inleftoffset = SHORT(inpatch->leftoffset);
intopoffset = SHORT(inpatch->topoffset);
} }
size = (inwidth * inheight) * (outbpp / 8); size = (inwidth * inheight) * (outbpp / 8);
@ -393,7 +395,7 @@ void *Picture_FlatConvert(
if (Picture_IsPatchFormat(informat)) if (Picture_IsPatchFormat(informat))
input = Picture_GetPatchPixel(inpatch, informat, x, y, flags); input = Picture_GetPatchPixel(inpatch, informat, x, y, flags);
else if (Picture_IsFlatFormat(informat)) else if (Picture_IsFlatFormat(informat))
input = picture + (offs * (inbpp / 8)); input = (UINT8 *)picture + (offs * (inbpp / 8));
else else
I_Error("Picture_FlatConvert: unsupported input format!"); I_Error("Picture_FlatConvert: unsupported input format!");
@ -489,15 +491,15 @@ void *Picture_GetPatchPixel(
if (x >= 0 && x < SHORT(patch->width)) if (x >= 0 && x < SHORT(patch->width))
{ {
INT32 topdelta, prevdelta = -1; INT32 topdelta, prevdelta = -1;
INT32 columnofs = 0; INT32 colofs = 0;
if (flags & PICFLAGS_XFLIP) if (flags & PICFLAGS_XFLIP)
columnofs = LONG(patch->columnofs[(SHORT(patch->width)-1)-x]); colofs = LONG(patch->columnofs[(SHORT(patch->width)-1)-x]);
else else
columnofs = LONG(patch->columnofs[x]); colofs = LONG(patch->columnofs[x]);
// Column offsets are pointers so no casting required // Column offsets are pointers so no casting required
column = (column_t *)((UINT8 *)patch + columnofs); column = (column_t *)((UINT8 *)patch + colofs);
while (column->topdelta != 0xff) while (column->topdelta != 0xff)
{ {