Browse Source

filesystem: add size argument to COM_Default/ReplaceExtension calls

pull/2/head
Alibek Omarov 2 years ago
parent
commit
71a3cedba8
  1. 4
      filesystem/filesystem.c
  2. 7
      filesystem/wad.c

4
filesystem/filesystem.c

@ -655,7 +655,7 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool @@ -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 @@ -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 );

7
filesystem/wad.c

@ -467,13 +467,12 @@ static int FS_FindFile_WAD( searchpath_t *search, const char *path, char *fixedn @@ -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 @@ -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 @@ -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 );
}
}

Loading…
Cancel
Save