cache1d: Bikeshed some formatting in kopen_internal().

git-svn-id: https://svn.eduke32.com/eduke32@5442 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-11-25 12:07:57 +00:00
parent 4d9b61c085
commit 9f2911e773

View file

@ -990,10 +990,7 @@ static int32_t check_filename_mismatch(const char * const filename, int ofs)
static int32_t kopen_internal(const char *filename, char **lastpfn, char searchfirst, char checkcase, char tryzip, int32_t newhandle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) static int32_t kopen_internal(const char *filename, char **lastpfn, char searchfirst, char checkcase, char tryzip, int32_t newhandle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{ {
int32_t j, k, fil; int32_t fil;
char bad, *gfileptr;
intptr_t i;
if (searchfirst == 0 && (fil = openfrompath_internal(filename, lastpfn, BO_BINARY|BO_RDONLY, BS_IREAD)) >= 0) if (searchfirst == 0 && (fil = openfrompath_internal(filename, lastpfn, BO_BINARY|BO_RDONLY, BS_IREAD)) >= 0)
{ {
#ifdef FILENAME_CASE_CHECK #ifdef FILENAME_CASE_CHECK
@ -1040,6 +1037,7 @@ static int32_t kopen_internal(const char *filename, char **lastpfn, char searchf
#ifdef WITHKPLIB #ifdef WITHKPLIB
if (tryzip) if (tryzip)
{ {
intptr_t i;
if ((kzcurhand != newhandle) && (kztell() >= 0)) if ((kzcurhand != newhandle) && (kztell() >= 0))
{ {
if (kzcurhand >= 0) arraypos[kzcurhand] = kztell(); if (kzcurhand >= 0) arraypos[kzcurhand] = kztell();
@ -1059,34 +1057,31 @@ static int32_t kopen_internal(const char *filename, char **lastpfn, char searchf
UNREFERENCED_PARAMETER(tryzip); UNREFERENCED_PARAMETER(tryzip);
#endif #endif
for (k=numgroupfiles-1; k>=0; k--) for (int32_t k = searchfirst != 1 ? numgroupfiles-1 : 0; k >= 0; --k)
{ {
if (searchfirst == 1) k = 0; if (groupfil[k] < 0)
if (groupfil[k] >= 0) continue;
for (int32_t i = gnumfiles[k]-1; i >= 0; --i)
{ {
for (i=gnumfiles[k]-1; i>=0; i--) char const * const gfileptr = (char *)&gfilelist[k][i<<4];
unsigned int j;
for (j = 0; j < 13; ++j)
{ {
gfileptr = (char *)&gfilelist[k][i<<4]; if (!filename[j]) break;
if (toupperlookup[filename[j]] != toupperlookup[gfileptr[j]])
bad = 0; goto gnumfiles_continue;
for (j=0; j<13; j++)
{
if (!filename[j]) break;
if (toupperlookup[filename[j]] != toupperlookup[gfileptr[j]])
{
bad = 1;
break;
}
}
if (bad) continue;
if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1
if (j==13 && filename[j]) continue; // JBF: long file name
arraygrp[newhandle] = k;
arrayhan[newhandle] = i;
arraypos[newhandle] = 0;
return newhandle;
} }
if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1
if (j==13 && filename[j]) continue; // JBF: long file name
arraygrp[newhandle] = k;
arrayhan[newhandle] = i;
arraypos[newhandle] = 0;
return newhandle;
gnumfiles_continue: ;
} }
} }