Make num_posts unsigned

size_t was a bit overkill for that.
This commit is contained in:
Lactozilla 2023-09-03 13:27:49 -03:00
parent 6ccb1f7ca3
commit 2f25102b79
6 changed files with 17 additions and 17 deletions

View file

@ -67,7 +67,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
if (originPatch) // originPatch can be NULL here, unlike in the software version
originy = originPatch->originy;
for (size_t i = 0; i < patchcol->num_posts; i++)
for (unsigned i = 0; i < patchcol->num_posts; i++)
{
post_t *post = &patchcol->posts[i];
source = patchcol->pixels + post->data_offset;
@ -169,7 +169,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
if (originPatch) // originPatch can be NULL here, unlike in the software version
originy = originPatch->originy;
for (size_t i = 0; i < patchcol->num_posts; i++)
for (unsigned i = 0; i < patchcol->num_posts; i++)
{
post_t *post = &patchcol->posts[i];
source = patchcol->pixels + post->data_offset;

View file

@ -735,7 +735,7 @@ typedef struct
// column_t is a list of 0 or more post_t
typedef struct
{
size_t num_posts;
unsigned num_posts;
post_t *posts;
UINT8 *pixels;
} column_t;

View file

@ -363,7 +363,7 @@ void *Picture_PatchConvert(
out->topoffset = intopoffset;
size_t max_pixels = out->width * out->height;
size_t num_posts = 0;
unsigned num_posts = 0;
out->columns = Z_Calloc(sizeof(column_t) * out->width, PU_PATCH_DATA, NULL);
out->pixels = Z_Calloc(max_pixels * (outbpp / 8), PU_PATCH_DATA, NULL);
@ -371,7 +371,7 @@ void *Picture_PatchConvert(
UINT8 *imgptr = out->pixels;
size_t *column_posts = Z_Calloc(sizeof(size_t) * inwidth, PU_STATIC, NULL);
unsigned *column_posts = Z_Calloc(sizeof(unsigned) * inwidth, PU_STATIC, NULL);
// Write columns
for (INT32 x = 0; x < inwidth; x++)
@ -385,7 +385,7 @@ void *Picture_PatchConvert(
column->posts = NULL;
column->num_posts = 0;
column_posts[x] = (size_t)-1;
column_posts[x] = (unsigned)-1;
// Write pixels
for (INT32 y = 0; y < inheight; y++)
@ -415,7 +415,7 @@ void *Picture_PatchConvert(
post->topdelta = (size_t)y;
post->length = 0;
post->data_offset = post_data_offset;
if (column_posts[x] == (size_t)-1)
if (column_posts[x] == (unsigned)-1)
column_posts[x] = num_posts - 1;
column->num_posts++;
}
@ -673,7 +673,7 @@ void *Picture_GetPatchPixel(
else
{
column_t *column = &patch->columns[colx];
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
@ -882,7 +882,7 @@ void *Picture_TextureToFlat(size_t texnum)
for (size_t col = 0; col < (size_t)texture->width; col++, desttop++)
{
column_t *column = (column_t *)R_GetColumn(texnum, col);
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
dest = desttop + (post->topdelta * texture->width);

View file

@ -87,7 +87,7 @@ static inline void R_DrawColumnInCache(column_t *column, UINT8 *cache, texpatch_
(void)patchheight; // This parameter is unused
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
source = column->pixels + post->data_offset;
@ -120,7 +120,7 @@ static inline void R_DrawFlippedColumnInCache(column_t *column, UINT8 *cache, te
INT32 originy = originPatch->originy;
INT32 topdelta;
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
topdelta = patchheight - post->length - post->topdelta;
@ -159,7 +159,7 @@ static inline void R_DrawBlendColumnInCache(column_t *column, UINT8 *cache, texp
(void)patchheight; // This parameter is unused
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
source = column->pixels + post->data_offset;
@ -197,7 +197,7 @@ static inline void R_DrawBlendFlippedColumnInCache(column_t *column, UINT8 *cach
INT32 originy = originPatch->originy;
INT32 topdelta;
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
topdelta = patchheight - post->length - post->topdelta;

View file

@ -641,7 +641,7 @@ void R_DrawMaskedColumn(column_t *column)
{
fixed_t basetexturemid = dc_texturemid;
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
@ -698,7 +698,7 @@ void R_DrawFlippedMaskedColumn(column_t *column)
fixed_t basetexturemid = dc_texturemid;
UINT8 *d,*s;
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
INT32 topdelta = lengthcol-post->length-post->topdelta;

View file

@ -765,7 +765,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
column = &patch->columns[col>>FRACBITS];
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
source = column->pixels + post->data_offset;
@ -1037,7 +1037,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, IN
column = &patch->columns[col>>FRACBITS];
for (size_t i = 0; i < column->num_posts; i++)
for (unsigned i = 0; i < column->num_posts; i++)
{
post_t *post = &column->posts[i];
INT32 topdelta = post->topdelta;