engine: common: imagelib: get rid of NULL sentinels at the end of arrays

This commit is contained in:
Alibek Omarov 2024-12-22 07:21:06 +03:00
parent 72d0d70587
commit 0c471aecb1

View file

@ -15,6 +15,7 @@ GNU General Public License for more details.
#include <math.h>
#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 ))