From 2f25102b7990d8c75786ddab3d8d766660886d54 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 3 Sep 2023 13:27:49 -0300 Subject: [PATCH] Make num_posts unsigned size_t was a bit overkill for that. --- src/hardware/hw_cache.c | 4 ++-- src/r_defs.h | 2 +- src/r_picformats.c | 12 ++++++------ src/r_textures.c | 8 ++++---- src/r_things.c | 4 ++-- src/v_video.c | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 4fab09111..3a24d2dd1 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -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; diff --git a/src/r_defs.h b/src/r_defs.h index 46937899f..afd16967c 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -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; diff --git a/src/r_picformats.c b/src/r_picformats.c index 6f644557a..d4623e69a 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -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); diff --git a/src/r_textures.c b/src/r_textures.c index 4c9c40600..705a9af2d 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -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; diff --git a/src/r_things.c b/src/r_things.c index 2ce474363..53927af8b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -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; diff --git a/src/v_video.c b/src/v_video.c index cf68cc39d..accb83d43 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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;