From 8b96e7ca87a654c5e4472f3b4776cd34859b0ec8 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 26 Apr 2023 04:05:20 +0300 Subject: [PATCH] ref: add size argument to COM_FileBase calls --- ref/gl/gl_alias.c | 2 +- ref/gl/gl_backend.c | 2 +- ref/gl/gl_decals.c | 2 +- ref/gl/gl_image.c | 4 ++-- ref/gl/gl_studio.c | 2 +- ref/soft/r_decals.c | 2 +- ref/soft/r_studio.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ref/gl/gl_alias.c b/ref/gl/gl_alias.c index c96aa14a..538cb16c 100644 --- a/ref/gl/gl_alias.c +++ b/ref/gl/gl_alias.c @@ -443,7 +443,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height ) } } - COM_FileBase( loadmodel->name, name ); + COM_FileBase( loadmodel->name, name, sizeof( name )); // for alias models only player can have remap textures if( mod != NULL && !Q_stricmp( name, "player" )) diff --git a/ref/gl/gl_backend.c b/ref/gl/gl_backend.c index 8f6b8a72..912cd337 100644 --- a/ref/gl/gl_backend.c +++ b/ref/gl/gl_backend.c @@ -689,7 +689,7 @@ rebuild_page: if( FBitSet( image->flags, TF_DEPTHMAP ) && !FBitSet( image->flags, TF_NOCOMPARE )) pglTexParameteri( image->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB ); - COM_FileBase( image->name, shortname ); + COM_FileBase( image->name, shortname, sizeof( shortname )); if( Q_strlen( shortname ) > 18 ) { // cutoff too long names, it looks ugly diff --git a/ref/gl/gl_decals.c b/ref/gl/gl_decals.c index 2b3f82b8..2356a7bf 100644 --- a/ref/gl/gl_decals.c +++ b/ref/gl/gl_decals.c @@ -1188,7 +1188,7 @@ int R_CreateDecalList( decallist_t *pList ) pList[total].scale = decal->scale; R_DecalUnProject( decal, &pList[total] ); - COM_FileBase( R_GetTexture( decal->texture )->name, pList[total].name ); + COM_FileBase( R_GetTexture( decal->texture )->name, pList[total].name, sizeof( pList[total].name )); // check to see if the decal should be added total = DecalListAdd( pList, total ); diff --git a/ref/gl/gl_image.c b/ref/gl/gl_image.c index b1060aa1..d3329771 100644 --- a/ref/gl/gl_image.c +++ b/ref/gl/gl_image.c @@ -1587,7 +1587,7 @@ int GL_LoadTextureArray( const char **names, int flags ) // create complexname from layer names for( i = 0; i < numLayers - 1; i++ ) { - COM_FileBase( names[i], basename ); + COM_FileBase( names[i], basename, sizeof( basename )); ret = Q_snprintf( &name[len], sizeof( name ) - len, "%s|", basename ); if( ret == -1 ) @@ -1596,7 +1596,7 @@ int GL_LoadTextureArray( const char **names, int flags ) len += ret; } - COM_FileBase( names[i], basename ); + COM_FileBase( names[i], basename, sizeof( basename )); ret = Q_snprintf( &name[len], sizeof( name ) - len, "%s[%i]", basename, numLayers ); if( ret == -1 ) diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index e63ca1ec..3618faf7 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -3757,7 +3757,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture } Q_strncpy( mdlname, mod->name, sizeof( mdlname )); - COM_FileBase( ptexture->name, name ); + COM_FileBase( ptexture->name, name, sizeof( name )); COM_StripExtension( mdlname ); if( FBitSet( ptexture->flags, STUDIO_NF_NOMIPS )) diff --git a/ref/soft/r_decals.c b/ref/soft/r_decals.c index e3d4805a..57be64d2 100644 --- a/ref/soft/r_decals.c +++ b/ref/soft/r_decals.c @@ -1200,7 +1200,7 @@ int GAME_EXPORT R_CreateDecalList( decallist_t *pList ) pList[total].scale = decal->scale; R_DecalUnProject( decal, &pList[total] ); - COM_FileBase( R_GetTexture( decal->texture )->name, pList[total].name ); + COM_FileBase( R_GetTexture( decal->texture )->name, pList[total].name, sizeof( pList[total].name )); // check to see if the decal should be added total = DecalListAdd( pList, total ); diff --git a/ref/soft/r_studio.c b/ref/soft/r_studio.c index 336fc647..e3b3b82f 100644 --- a/ref/soft/r_studio.c +++ b/ref/soft/r_studio.c @@ -3537,7 +3537,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture } Q_strncpy( mdlname, mod->name, sizeof( mdlname )); - COM_FileBase( ptexture->name, name ); + COM_FileBase( ptexture->name, name, sizeof( name )); COM_StripExtension( mdlname ); if( FBitSet( ptexture->flags, STUDIO_NF_NOMIPS ))