mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Clean up the #ifdef mess in _QFS_FOpenFile
With proper initialization, only the one chunk of #ifdefs is needed. Now the code is much easier to read.
This commit is contained in:
parent
4d59282641
commit
6910c50a43
1 changed files with 4 additions and 13 deletions
|
@ -871,12 +871,8 @@ _QFS_FOpenFile (const char *filename, QFile **gzfile,
|
||||||
{
|
{
|
||||||
searchpath_t *search;
|
searchpath_t *search;
|
||||||
char *path;
|
char *path;
|
||||||
#ifdef HAVE_VORBIS
|
char *oggfilename = 0;
|
||||||
char *oggfilename;
|
char *gzfilename = 0;
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
char *gzfilename;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// make sure they're not trying to do weird stuff with our private files
|
// make sure they're not trying to do weird stuff with our private files
|
||||||
path = QFS_CompressPath (filename);
|
path = QFS_CompressPath (filename);
|
||||||
|
@ -893,8 +889,6 @@ _QFS_FOpenFile (const char *filename, QFile **gzfile,
|
||||||
QFS_StripExtension (path, oggfilename);
|
QFS_StripExtension (path, oggfilename);
|
||||||
strncat (oggfilename, ".ogg",
|
strncat (oggfilename, ".ogg",
|
||||||
sizeof (oggfilename) - strlen (oggfilename) - 1);
|
sizeof (oggfilename) - strlen (oggfilename) - 1);
|
||||||
} else {
|
|
||||||
oggfilename = 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
|
@ -904,16 +898,13 @@ _QFS_FOpenFile (const char *filename, QFile **gzfile,
|
||||||
|
|
||||||
// search through the path, one element at a time
|
// search through the path, one element at a time
|
||||||
for (search = qfs_searchpaths; search; search = search->next) {
|
for (search = qfs_searchpaths; search; search = search->next) {
|
||||||
#ifdef HAVE_VORBIS
|
|
||||||
//NOTE gzipped oggs not supported
|
//NOTE gzipped oggs not supported
|
||||||
if (oggfilename
|
if (oggfilename
|
||||||
&& open_file (search, oggfilename, gzfile, foundname, false) != -1)
|
&& open_file (search, oggfilename, gzfile, foundname, false) != -1)
|
||||||
goto ok;
|
goto ok;
|
||||||
#endif
|
if (gzfilename
|
||||||
#ifdef HAVE_ZLIB
|
&& open_file (search, gzfilename, gzfile, foundname, zip) != -1)
|
||||||
if (open_file (search, gzfilename, gzfile, foundname, zip) != -1)
|
|
||||||
goto ok;
|
goto ok;
|
||||||
#endif
|
|
||||||
if (open_file (search, path, gzfile, foundname, zip) != -1)
|
if (open_file (search, path, gzfile, foundname, zip) != -1)
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue