mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-22 20:11:40 +00:00
Fix extension name comparison for DLL files
This commit is contained in:
parent
22552c7bab
commit
c4f739b8d0
3 changed files with 26 additions and 1 deletions
|
@ -557,7 +557,7 @@ static void FS_CheckFilenameIsNotExecutable( const char *filename,
|
||||||
const char *function )
|
const char *function )
|
||||||
{
|
{
|
||||||
// Check if the filename ends with the library extension
|
// Check if the filename ends with the library extension
|
||||||
if( !Q_stricmp( COM_GetExtension( filename ), DLL_EXT ) )
|
if(COM_CompareExtension(filename, DLL_EXT))
|
||||||
{
|
{
|
||||||
Com_Error( ERR_FATAL, "%s: Not allowed to manipulate '%s' due "
|
Com_Error( ERR_FATAL, "%s: Not allowed to manipulate '%s' due "
|
||||||
"to %s extension", function, filename, DLL_EXT );
|
"to %s extension", function, filename, DLL_EXT );
|
||||||
|
|
|
@ -82,6 +82,30 @@ void COM_StripExtension( const char *in, char *out, int destsize )
|
||||||
Q_strncpyz(out, in, destsize);
|
Q_strncpyz(out, in, destsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
COM_CompareExtension
|
||||||
|
|
||||||
|
string compare the end of the strings and return qtrue if strings match
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
qboolean COM_CompareExtension(const char *in, const char *ext)
|
||||||
|
{
|
||||||
|
int inlen, extlen;
|
||||||
|
|
||||||
|
inlen = strlen(in);
|
||||||
|
extlen = strlen(ext);
|
||||||
|
|
||||||
|
if(extlen <= inlen)
|
||||||
|
{
|
||||||
|
in += inlen - extlen;
|
||||||
|
|
||||||
|
if(!Q_stricmp(in, ext))
|
||||||
|
return qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
|
|
|
@ -709,6 +709,7 @@ float Com_Clamp( float min, float max, float value );
|
||||||
char *COM_SkipPath( char *pathname );
|
char *COM_SkipPath( char *pathname );
|
||||||
const char *COM_GetExtension( const char *name );
|
const char *COM_GetExtension( const char *name );
|
||||||
void COM_StripExtension(const char *in, char *out, int destsize);
|
void COM_StripExtension(const char *in, char *out, int destsize);
|
||||||
|
qboolean COM_CompareExtension(const char *in, const char *ext);
|
||||||
void COM_DefaultExtension( char *path, int maxSize, const char *extension );
|
void COM_DefaultExtension( char *path, int maxSize, const char *extension );
|
||||||
|
|
||||||
void COM_BeginParseSession( const char *name );
|
void COM_BeginParseSession( const char *name );
|
||||||
|
|
Loading…
Reference in a new issue