mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 08:50:55 +00:00
Hoist strlen() outside loop in kzopen()
git-svn-id: https://svn.eduke32.com/eduke32@7025 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a677b18b2d
commit
eeba7847eb
1 changed files with 5 additions and 2 deletions
|
@ -2632,11 +2632,14 @@ intptr_t kzopen(const char *filnam)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Finally, check mounted dirs
|
//Finally, check mounted dirs
|
||||||
|
|
||||||
|
int const namlen = strlen(filnam);
|
||||||
|
|
||||||
for (i=kzdirnamhead; i>=0; i=B_UNBUF32(&kzhashbuf[i]))
|
for (i=kzdirnamhead; i>=0; i=B_UNBUF32(&kzhashbuf[i]))
|
||||||
{
|
{
|
||||||
strcpy(tempbuf,&kzhashbuf[i+4]);
|
strcpy(tempbuf,&kzhashbuf[i+4]);
|
||||||
j = strlen(tempbuf);
|
uint32_t const j = strlen(tempbuf);
|
||||||
if (strlen(filnam)+1+j >= sizeof(tempbuf)) continue; //don't allow int32_t filenames to buffer overrun
|
if (namlen+1+j >= sizeof(tempbuf)) continue; //don't allow int32_t filenames to buffer overrun
|
||||||
if ((j) && (tempbuf[j-1] != '/') && (tempbuf[j-1] != '\\') && (filnam[0] != '/') && (filnam[0] != '\\'))
|
if ((j) && (tempbuf[j-1] != '/') && (tempbuf[j-1] != '\\') && (filnam[0] != '/') && (filnam[0] != '\\'))
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
strcat(tempbuf,"\\");
|
strcat(tempbuf,"\\");
|
||||||
|
|
Loading…
Reference in a new issue