Browse Source

filesystem: unify prototypes of archive opening functions

pull/2/head
Alibek Omarov 1 year ago
parent
commit
653eb00cc6
  1. 4
      filesystem/filesystem.c
  2. 6
      filesystem/filesystem_internal.h
  3. 8
      filesystem/pak.c
  4. 8
      filesystem/wad.c
  5. 9
      filesystem/zip.c

4
filesystem/filesystem.c

@ -285,7 +285,7 @@ void FS_CreatePath( char *path ) @@ -285,7 +285,7 @@ void FS_CreatePath( char *path )
FS_AddArchive_Fullpath
================
*/
static qboolean FS_AddArchive_Fullpath( const char *file, qboolean *already_loaded, int flags )
static searchpath_t *FS_AddArchive_Fullpath( const char *file, qboolean *already_loaded, int flags )
{
const char *ext = COM_FileExtension( file );
@ -295,7 +295,7 @@ static qboolean FS_AddArchive_Fullpath( const char *file, qboolean *already_load @@ -295,7 +295,7 @@ static qboolean FS_AddArchive_Fullpath( const char *file, qboolean *already_load
return FS_AddPak_Fullpath( file, already_loaded, flags );
// skip wads, this function only meant to be used for extras
return false;
return NULL;
}
/*

6
filesystem/filesystem_internal.h

@ -193,17 +193,17 @@ searchpath_t *FS_FindFile( const char *name, int *index, char *fixedname, size_t @@ -193,17 +193,17 @@ searchpath_t *FS_FindFile( const char *name, int *index, char *fixedname, size_t
//
// pak.c
//
qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int flags );
searchpath_t *FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int flags );
//
// wad.c
//
qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int flags );
searchpath_t *FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int flags );
//
// zip.c
//
qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int flags );
searchpath_t *FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int flags );
//
// dir.c

8
filesystem/pak.c

@ -330,7 +330,7 @@ If keep_plain_dirs is set, the pack will be added AFTER the first sequence of @@ -330,7 +330,7 @@ If keep_plain_dirs is set, the pack will be added AFTER the first sequence of
plain directories.
================
*/
qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int flags )
searchpath_t *FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int flags )
{
searchpath_t *search;
pack_t *pak = NULL;
@ -342,7 +342,7 @@ qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int @@ -342,7 +342,7 @@ qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int
if( search->type == SEARCHPATH_PAK && !Q_stricmp( search->filename, pakfile ))
{
if( already_loaded ) *already_loaded = true;
return true; // already loaded
return search; // already loaded
}
}
@ -384,12 +384,12 @@ qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int @@ -384,12 +384,12 @@ qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loaded, int
}
}
return true;
return search;
}
else
{
if( errorcode != PAK_LOAD_NO_FILES )
Con_Reportf( S_ERROR "FS_AddPak_Fullpath: unable to load pak \"%s\"\n", pakfile );
return false;
return NULL;
}
}

8
filesystem/wad.c

@ -635,7 +635,7 @@ static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, f @@ -635,7 +635,7 @@ static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, f
FS_AddWad_Fullpath
====================
*/
qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int flags )
searchpath_t *FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int flags )
{
searchpath_t *search;
wfile_t *wad = NULL;
@ -647,7 +647,7 @@ qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int @@ -647,7 +647,7 @@ qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int
if( search->type == SEARCHPATH_WAD && !Q_stricmp( search->filename, wadfile ))
{
if( already_loaded ) *already_loaded = true;
return true; // already loaded
return search; // already loaded
}
}
@ -677,10 +677,10 @@ qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int @@ -677,10 +677,10 @@ qboolean FS_AddWad_Fullpath( const char *wadfile, qboolean *already_loaded, int
fs_searchpaths = search;
Con_Reportf( "Adding wadfile: %s (%i files)\n", wadfile, wad->numlumps );
return true;
return search;
}
if( errorcode != WAD_LOAD_NO_FILES )
Con_Reportf( S_ERROR "FS_AddWad_Fullpath: unable to load wad \"%s\"\n", wadfile );
return false;
return NULL;
}

9
filesystem/zip.c

@ -664,7 +664,7 @@ FS_AddZip_Fullpath @@ -664,7 +664,7 @@ FS_AddZip_Fullpath
===========
*/
qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int flags )
searchpath_t *FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int flags )
{
searchpath_t *search;
zip_t *zip = NULL;
@ -676,7 +676,7 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int @@ -676,7 +676,7 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int
if( search->type == SEARCHPATH_ZIP && !Q_stricmp( search->filename, zipfile ))
{
if( already_loaded ) *already_loaded = true;
return true; // already loaded
return search; // already loaded
}
}
@ -718,13 +718,14 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int @@ -718,13 +718,14 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int
FS_AddWad_Fullpath( fullpath, NULL, flags );
}
}
return true;
return search;
}
else
{
if( errorcode != ZIP_LOAD_NO_FILES )
Con_Reportf( S_ERROR "FS_AddZip_Fullpath: unable to load zip \"%s\"\n", zipfile );
return false;
return NULL;
}
}

Loading…
Cancel
Save