Fix screwed up whitespace in files.c

Apologies to anyone merging this :(
This commit is contained in:
Tim Angus 2013-01-13 22:17:10 +00:00
parent 5fd456ff7c
commit 70b165ee33

View file

@ -450,9 +450,9 @@ long FS_filelength(fileHandle_t f)
h = FS_FileForHandle(f);
if(h == NULL)
return -1;
else
return FS_fplength(h);
return -1;
else
return FS_fplength(h);
}
/*
@ -986,7 +986,7 @@ Ignore case and seprator char distinctions
*/
qboolean FS_FilenameCompare( const char *s1, const char *s2 ) {
int c1, c2;
do {
c1 = *s1++;
c2 = *s2++;
@ -1004,12 +1004,12 @@ qboolean FS_FilenameCompare( const char *s1, const char *s2 ) {
if ( c2 == '\\' || c2 == ':' ) {
c2 = '/';
}
if (c1 != c2) {
return qtrue; // strings not equal
}
} while (c1);
return qfalse; // strings are equal
}
@ -1057,8 +1057,8 @@ qboolean FS_IsDemoExt(const char *filename, int namelen)
return qtrue;
#ifdef LEGACY_PROTOCOL
if(protocol == com_legacyprotocol->integer)
return qtrue;
if(protocol == com_legacyprotocol->integer)
return qtrue;
#endif
for(index = 0; demo_protocols[index]; index++)
@ -1103,19 +1103,19 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
// be prepended, so we don't need to worry about "c:" or "//limbo"
if(strstr(filename, ".." ) || strstr(filename, "::"))
{
if(file == NULL)
return qfalse;
if(file == NULL)
return qfalse;
*file = 0;
return -1;
}
// make sure the q3key file is only readable by the quake3.exe at initialization
// any other time the key should only be accessed in memory using the provided functions
if(com_fullyInitialized && strstr(filename, "q3key"))
{
if(file == NULL)
return qfalse;
if(file == NULL)
return qfalse;
*file = 0;
return -1;
@ -1129,9 +1129,9 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if(search->pack)
{
hash = FS_HashFileName(filename, search->pack->hashSize);
if(search->pack->hashTable[hash])
{
if(search->pack->hashTable[hash])
{
// look through all the pak file elements
pak = search->pack;
pakFile = pak->hashTable[hash];
@ -1143,14 +1143,14 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
{
// found it!
if(pakFile->len)
return pakFile->len;
else
{
// It's not nice, but legacy code depends
// on positive value if file exists no matter
// what size
return 1;
}
return pakFile->len;
else
{
// It's not nice, but legacy code depends
// on positive value if file exists no matter
// what size
return 1;
}
}
pakFile = pakFile->next;
@ -1160,28 +1160,28 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
else if(search->dir)
{
dir = search->dir;
netpath = FS_BuildOSPath(dir->path, dir->gamedir, filename);
filep = fopen (netpath, "rb");
if(filep)
{
len = FS_fplength(filep);
len = FS_fplength(filep);
fclose(filep);
if(len)
return len;
else
return 1;
return len;
else
return 1;
}
}
return 0;
}
*file = FS_HandleForFile();
fsh[*file].handleFiles.unique = uniqueFILE;
// is the element a pak file?
if(search->pack)
{
@ -1199,7 +1199,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
// look through all the pak file elements
pak = search->pack;
pakFile = pak->hashTable[hash];
do
{
// case and separator insensitive comparisons
@ -1238,7 +1238,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
{
// open a new file on the pakfile
fsh[*file].handleFiles.file.z = unzOpen(pak->pakFilename);
if(fsh[*file].handleFiles.file.z == NULL)
Com_Error(ERR_FATAL, "Couldn't open %s", pak->pakFilename);
}
@ -1247,7 +1247,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name));
fsh[*file].zipFile = qtrue;
// set the file position in the zip file (also sets the current file info)
unzSetOffset(fsh[*file].handleFiles.file.z, pakFile->pos);
@ -1258,12 +1258,12 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if(fs_debug->integer)
{
Com_Printf("FS_FOpenFileRead: %s (found in '%s')\n",
filename, pak->pakFilename);
filename, pak->pakFilename);
}
return pakFile->len;
}
pakFile = pakFile->next;
} while(pakFile != NULL);
}
@ -1301,16 +1301,16 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if (filep == NULL)
{
*file = 0;
return -1;
return -1;
}
Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name));
fsh[*file].zipFile = qfalse;
if(fs_debug->integer)
{
Com_Printf("FS_FOpenFileRead: %s (found in '%s/%s')\n", filename,
dir->path, dir->gamedir);
dir->path, dir->gamedir);
}
fsh[*file].handleFiles.file.o = filep;
@ -1340,19 +1340,19 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF
for(search = fs_searchpaths; search; search = search->next)
{
len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse);
if(file == NULL)
{
if(len > 0)
return len;
}
else
{
if(len >= 0 && *file)
return len;
}
len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse);
if(file == NULL)
{
if(len > 0)
return len;
}
else
{
if(len >= 0 && *file)
return len;
}
}
#ifdef FS_MISSING
@ -1403,7 +1403,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
if(enableDll)
Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name);
Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name);
lastSearch = *startSearch;
@ -1411,7 +1411,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
search = fs_searchpaths;
else
search = lastSearch->next;
while(search)
{
if(search->dir && !fs_numServerPaks)
@ -1426,7 +1426,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
{
Q_strncpyz(found, netpath, foundlen);
*startSearch = search;
return VMI_NATIVE;
}
}
@ -1441,17 +1441,17 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
{
pack = search->pack;
if(lastSearch && lastSearch->pack)
{
// make sure we only try loading one VM file per game dir
// i.e. if VM from pak7.pk3 fails we won't try one from pak6.pk3
if(!FS_FilenameCompare(lastSearch->pack->pakPathname, pack->pakPathname))
{
search = search->next;
continue;
}
}
if(lastSearch && lastSearch->pack)
{
// make sure we only try loading one VM file per game dir
// i.e. if VM from pak7.pk3 fails we won't try one from pak6.pk3
if(!FS_FilenameCompare(lastSearch->pack->pakPathname, pack->pakPathname))
{
search = search->next;
continue;
}
}
if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0)
{
@ -1460,7 +1460,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
return VMI_COMPILED;
}
}
search = search->next;
}
@ -1621,7 +1621,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
if (fsh[f].streamed) {
fsh[f].streamed = qfalse;
FS_Seek( f, offset, origin );
FS_Seek( f, offset, origin );
fsh[f].streamed = qtrue;
}
@ -1827,7 +1827,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void *
{
// look for it in the filesystem or pack files
len = FS_FOpenFileRead(qpath, &h, qfalse);
}
}
else
{
// look for it in a specific search path only
@ -1847,7 +1847,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void *
}
return -1;
}
if ( !buffer ) {
if ( isConfig && com_journal && com_journal->integer == 1 ) {
Com_DPrintf( "Writing len for %s to journal file.\n", qpath );
@ -2088,21 +2088,21 @@ qboolean FS_CompareZipChecksum(const char *zipfile)
{
pack_t *thepak;
int index, checksum;
thepak = FS_LoadZipFile(zipfile, "");
if(!thepak)
return qfalse;
checksum = thepak->checksum;
FS_FreePak(thepak);
for(index = 0; index < fs_numServerReferencedPaks; index++)
{
if(checksum == fs_serverReferencedPaks[index])
return qtrue;
}
return qfalse;
}
@ -2253,7 +2253,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
temp = pathLength;
if (pathLength) {
temp++; // include the '/'
temp++; // include the '/'
}
nfiles = FS_AddFileToList( name + temp, list, nfiles );
}
@ -2266,8 +2266,8 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
// don't scan directories for files if we are pure or restricted
if ( fs_numServerPaks && !allowNonPureFilesOnDisk ) {
continue;
} else {
continue;
} else {
netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path );
sysFiles = Sys_ListFiles( netpath, extension, filter, &numSysFiles, qfalse );
for ( i = 0 ; i < numSysFiles ; i++ ) {
@ -2277,7 +2277,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
}
Sys_FreeFileList( sysFiles );
}
}
}
}
// return a copy of the list
@ -2842,7 +2842,7 @@ void FS_AddGameDirectory( const char *path, const char *dir ) {
return; // we've already got this one
}
}
Q_strncpyz( fs_gamedir, dir, sizeof( fs_gamedir ) );
// find all pak files in this directory
@ -2861,7 +2861,7 @@ void FS_AddGameDirectory( const char *path, const char *dir ) {
Q_strncpyz(pak->pakPathname, curpath, sizeof(pak->pakPathname));
// store the game name for downloading
Q_strncpyz(pak->pakGamename, dir, sizeof(pak->pakGamename));
fs_packFiles += pak->numfiles;
search = Z_Malloc (sizeof(searchpath_t));
@ -2969,9 +2969,9 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
// never autodownload any of the id paks
if(FS_idPak(fs_serverReferencedPakNames[i], BASEGAME, NUM_ID_PAKS)
#ifndef STANDALONE
|| FS_idPak(fs_serverReferencedPakNames[i], BASETA, NUM_TA_PAKS)
|| FS_idPak(fs_serverReferencedPakNames[i], BASETA, NUM_TA_PAKS)
#endif
)
)
{
continue;
}
@ -3171,14 +3171,14 @@ static void FS_Startup( const char *gameName )
FS_AddGameDirectory( fs_basepath->string, gameName );
}
// fs_homepath is somewhat particular to *nix systems, only add if relevant
#ifdef MACOS_X
#ifdef MACOS_X
fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT|CVAR_PROTECTED );
// Make MacOSX also include the base path included with the .app bundle
if (fs_apppath->string[0])
FS_AddGameDirectory(fs_apppath->string, gameName);
#endif
#endif
// NOTE: same filtering below for mods and basegame
if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
FS_CreatePath ( fs_homepath->string );
@ -3270,80 +3270,80 @@ static void FS_CheckPak0( void )
if(!path->pack)
continue;
curpack = path->pack;
if(!Q_stricmpn( curpack->pakGamename, "demoq3", MAX_OSPATH )
&& !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH ))
&& !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH ))
{
if(curpack->checksum == DEMO_PAK0_CHECKSUM)
founddemo = qtrue;
}
else if(!Q_stricmpn( curpack->pakGamename, BASEGAME, MAX_OSPATH )
&& strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 )
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_ID_PAKS - 1)
&& strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 )
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_ID_PAKS - 1)
{
if( curpack->checksum != pak_checksums[pakBasename[3]-'0'] )
{
if(pakBasename[3] == '0')
{
Com_Printf("\n\n"
"**************************************************\n"
"WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-copy pak0.pk3 from your\n"
"legitimate Q3 CDROM.\n"
"**************************************************\n\n\n",
curpack->checksum );
"**************************************************\n"
"WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-copy pak0.pk3 from your\n"
"legitimate Q3 CDROM.\n"
"**************************************************\n\n\n",
curpack->checksum );
}
else
{
Com_Printf("\n\n"
"**************************************************\n"
"WARNING: " BASEGAME "/pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install the point release\n"
"**************************************************\n\n\n",
pakBasename[3]-'0', curpack->checksum );
"**************************************************\n"
"WARNING: " BASEGAME "/pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install the point release\n"
"**************************************************\n\n\n",
pakBasename[3]-'0', curpack->checksum );
}
}
foundPak |= 1<<(pakBasename[3]-'0');
}
else if(!Q_stricmpn(curpack->pakGamename, BASETA, MAX_OSPATH)
&& strlen(pakBasename) == 4 && !Q_stricmpn(pakBasename, "pak", 3)
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_TA_PAKS - 1)
&& strlen(pakBasename) == 4 && !Q_stricmpn(pakBasename, "pak", 3)
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_TA_PAKS - 1)
{
if(curpack->checksum != missionpak_checksums[pakBasename[3]-'0'])
{
Com_Printf("\n\n"
"**************************************************\n"
"WARNING: " BASETA "/pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install Team Arena\n"
"**************************************************\n\n\n",
pakBasename[3]-'0', curpack->checksum );
"**************************************************\n"
"WARNING: " BASETA "/pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install Team Arena\n"
"**************************************************\n\n\n",
pakBasename[3]-'0', curpack->checksum );
}
foundTA |= 1 << (pakBasename[3]-'0');
}
else
{
int index;
// Finally check whether this pak's checksum is listed because the user tried
// to trick us by renaming the file, and set foundPak's highest bit to indicate this case.
for(index = 0; index < ARRAY_LEN(pak_checksums); index++)
{
if(curpack->checksum == pak_checksums[index])
{
Com_Printf("\n\n"
"**************************************************\n"
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
"Running in standalone mode won't work\n"
"Please rename, or remove this file\n"
"**************************************************\n\n\n",
curpack->pakFilename, BASEGAME, PATH_SEP, index);
"**************************************************\n"
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
"Running in standalone mode won't work\n"
"Please rename, or remove this file\n"
"**************************************************\n\n\n",
curpack->pakFilename, BASEGAME, PATH_SEP, index);
foundPak |= 0x80000000;
@ -3355,12 +3355,12 @@ static void FS_CheckPak0( void )
if(curpack->checksum == missionpak_checksums[index])
{
Com_Printf("\n\n"
"**************************************************\n"
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
"Running in standalone mode won't work\n"
"Please rename, or remove this file\n"
"**************************************************\n\n\n",
curpack->pakFilename, BASETA, PATH_SEP, index);
"**************************************************\n"
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
"Running in standalone mode won't work\n"
"Please rename, or remove this file\n"
"**************************************************\n\n\n",
curpack->pakFilename, BASETA, PATH_SEP, index);
foundTA |= 0x80000000;
}
@ -3387,7 +3387,7 @@ static void FS_CheckPak0( void )
"from the demo. This may work fine, but it is not\n"
"guaranteed or supported.\n"
"**************************************************\n\n\n" );
foundPak |= 0x01;
}
}
@ -3401,25 +3401,25 @@ static void FS_CheckPak0( void )
if((foundPak & 0x01) != 0x01)
{
Q_strcat(errorText, sizeof(errorText),
"\"pak0.pk3\" is missing. Please copy it "
"from your legitimate Q3 CDROM. ");
"\"pak0.pk3\" is missing. Please copy it "
"from your legitimate Q3 CDROM. ");
}
if((foundPak & 0x1fe) != 0x1fe)
{
Q_strcat(errorText, sizeof(errorText),
"Point Release files are missing. Please "
"re-install the 1.32 point release. ");
"Point Release files are missing. Please "
"re-install the 1.32 point release. ");
}
Q_strcat(errorText, sizeof(errorText),
va("Also check that your ioq3 executable is in "
"the correct place and that every file "
"in the \"%s\" directory is present and readable", BASEGAME));
va("Also check that your ioq3 executable is in "
"the correct place and that every file "
"in the \"%s\" directory is present and readable", BASEGAME));
Com_Error(ERR_FATAL, "%s", errorText);
}
if(!com_standalone->integer && foundTA && (foundTA & 0x0f) != 0x0f)
{
char errorText[MAX_STRING_CHARS] = "";
@ -3427,15 +3427,15 @@ static void FS_CheckPak0( void )
if((foundTA & 0x01) != 0x01)
{
Com_sprintf(errorText, sizeof(errorText),
"\"" BASETA "%cpak0.pk3\" is missing. Please copy it "
"from your legitimate Quake 3 Team Arena CDROM. ", PATH_SEP);
"\"" BASETA "%cpak0.pk3\" is missing. Please copy it "
"from your legitimate Quake 3 Team Arena CDROM. ", PATH_SEP);
}
if((foundTA & 0x0e) != 0x0e)
{
Q_strcat(errorText, sizeof(errorText),
"Team Arena Point Release files are missing. Please "
"re-install the latest Team Arena point release.");
"Team Arena Point Release files are missing. Please "
"re-install the latest Team Arena point release.");
}
Com_Error(ERR_FATAL, "%s", errorText);
@ -3756,11 +3756,11 @@ void FS_PureServerSetReferencedPaks( const char *pakSums, const char *pakNames )
fs_serverReferencedPakNames[i] = CopyString( Cmd_Argv( i ) );
}
}
// ensure that there are as many checksums as there are pak names.
if(d < c)
c = d;
fs_numServerReferencedPaks = c;
}
@ -3870,8 +3870,8 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
if(fs_gamedirvar->modified)
{
if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) &&
(*lastValidGame || FS_FilenameCompare(fs_gamedirvar->string, com_basegame->string)) &&
(*fs_gamedirvar->string || FS_FilenameCompare(lastValidGame, com_basegame->string)))
(*lastValidGame || FS_FilenameCompare(fs_gamedirvar->string, com_basegame->string)) &&
(*fs_gamedirvar->string || FS_FilenameCompare(lastValidGame, com_basegame->string)))
{
Com_GameRestart(checksumFeed, disconnect);
return qtrue;
@ -3879,12 +3879,12 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
else
fs_gamedirvar->modified = qfalse;
}
if(checksumFeed != fs_checksumFeed)
FS_Restart(checksumFeed);
else if(fs_numServerPaks && !fs_reordered)
FS_ReorderPurePaks();
return qfalse;
}
@ -3903,28 +3903,28 @@ int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
sync = qfalse;
switch( mode ) {
case FS_READ:
r = FS_FOpenFileRead( qpath, f, qtrue );
break;
case FS_WRITE:
*f = FS_FOpenFileWrite( qpath );
r = 0;
if (*f == 0) {
r = -1;
}
break;
case FS_APPEND_SYNC:
sync = qtrue;
case FS_APPEND:
*f = FS_FOpenFileAppend( qpath );
r = 0;
if (*f == 0) {
r = -1;
}
break;
default:
Com_Error( ERR_FATAL, "FS_FOpenFileByMode: bad mode" );
return -1;
case FS_READ:
r = FS_FOpenFileRead( qpath, f, qtrue );
break;
case FS_WRITE:
*f = FS_FOpenFileWrite( qpath );
r = 0;
if (*f == 0) {
r = -1;
}
break;
case FS_APPEND_SYNC:
sync = qtrue;
case FS_APPEND:
*f = FS_FOpenFileAppend( qpath );
r = 0;
if (*f == 0) {
r = -1;
}
break;
default:
Com_Error( ERR_FATAL, "FS_FOpenFileByMode: bad mode" );
return -1;
}
if (!f) {