From 71a3cedba80cb610404f19e37210900f77d4ef9f Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 26 Apr 2023 04:58:51 +0300 Subject: [PATCH] filesystem: add size argument to COM_Default/ReplaceExtension calls --- filesystem/filesystem.c | 4 ++-- filesystem/wad.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 4bb0d46e..9c574cac 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -655,7 +655,7 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool { pfile = COM_ParseFile( pfile, GameInfo->iconpath, sizeof( GameInfo->iconpath )); COM_FixSlashes( GameInfo->iconpath ); - COM_DefaultExtension( GameInfo->iconpath, ".ico" ); + COM_DefaultExtension( GameInfo->iconpath, ".ico", sizeof( GameInfo->iconpath )); } else if( !Q_stricmp( token, "type" )) { @@ -1229,7 +1229,7 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll } dllInfo->shortPath[i] = '\0'; - COM_DefaultExtension( dllInfo->shortPath, "."OS_LIB_EXT ); // apply ext if forget + COM_DefaultExtension( dllInfo->shortPath, "."OS_LIB_EXT, sizeof( dllInfo->shortPath )); // apply ext if forget search = FS_FindFile( dllInfo->shortPath, &index, NULL, 0, false ); diff --git a/filesystem/wad.c b/filesystem/wad.c index cab30875..7095108c 100644 --- a/filesystem/wad.c +++ b/filesystem/wad.c @@ -467,13 +467,12 @@ static int FS_FindFile_WAD( searchpath_t *search, const char *path, char *fixedn Q_strncpy( wadfolder, wadbasename, sizeof( wadfolder )); Q_snprintf( wadname, sizeof( wadname ), "%s.wad", wadbasename ); - anywadname = false; } // make wadname from wad fullpath COM_FileBase( search->filename, shortname, sizeof( shortname )); - COM_DefaultExtension( shortname, ".wad" ); + COM_DefaultExtension( shortname, ".wad", sizeof( shortname )); // quick reject by wadname if( !anywadname && Q_stricmp( wadname, shortname )) @@ -532,7 +531,7 @@ static void FS_Search_WAD( searchpath_t *search, stringlist_t *list, const char // make wadname from wad fullpath COM_FileBase( search->filename, temp2, sizeof( temp2 )); - COM_DefaultExtension( temp2, ".wad" ); + COM_DefaultExtension( temp2, ".wad", sizeof( temp2 )); // quick reject by wadname if( !anywadname && Q_stricmp( wadname, temp2 )) @@ -562,7 +561,7 @@ static void FS_Search_WAD( searchpath_t *search, stringlist_t *list, const char // build path: wadname/lumpname.ext Q_snprintf( temp2, sizeof( temp2 ), "%s/%s", wadfolder, temp ); Q_snprintf( buf, sizeof( buf ), ".%s", W_ExtFromType( search->wad->lumps[i].type )); - COM_DefaultExtension( temp2, buf ); + COM_DefaultExtension( temp2, buf, sizeof( temp2 )); stringlistappend( list, temp2 ); } }