From 0c471aecb106e9e378c582157a33d14684a2e17e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 22 Dec 2024 07:21:06 +0300 Subject: [PATCH] engine: common: imagelib: get rid of NULL sentinels at the end of arrays --- engine/common/imagelib/img_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/common/imagelib/img_main.c b/engine/common/imagelib/img_main.c index 7499fb9c..501f6dca 100644 --- a/engine/common/imagelib/img_main.c +++ b/engine/common/imagelib/img_main.c @@ -15,6 +15,7 @@ GNU General Public License for more details. #include #include "imagelib.h" +#include "eiface.h" // ARRAYSIZE // global image variables imglib_t image; @@ -67,7 +68,6 @@ static const cubepack_t load_cubemap[] = { "3Ds Sky1", skybox_qv1 }, { "3Ds Sky2", skybox_qv2 }, { "3Ds Cube", cubemap_v1 }, -{ NULL, NULL }, }; // soul of ImageLib - table of image format constants @@ -297,9 +297,8 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size ) { const char *ext = COM_FileExtension( filename ); string loadname; - int i; + int i, j; const loadpixformat_t *extfmt; - const cubepack_t *cmap; Q_strncpy( loadname, filename, sizeof( loadname )); Image_Reset(); // clear old image @@ -317,8 +316,10 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size ) return ImagePack(); // check all cubemap sides with package suffix - for( cmap = load_cubemap; cmap && cmap->type; cmap++ ) + for( j = 0; j < ARRAYSIZE( load_cubemap ); j++ ) { + const cubepack_t *cmap = &load_cubemap[j]; + for( i = 0; i < 6; i++ ) { if( Image_ProbeLoad( extfmt, loadname, cmap->type[i].suf, cmap->type[i].hint ))