summaryrefslogtreecommitdiff
path: root/src/qcommon
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon')
-rw-r--r--src/qcommon/files.c2
-rw-r--r--src/qcommon/q_shared.c24
-rw-r--r--src/qcommon/q_shared.h1
3 files changed, 26 insertions, 1 deletions
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index 8e32c9ff..72c8cffe 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -535,7 +535,7 @@ static void FS_CheckFilenameIsNotExecutable( const char *filename,
const char *function )
{
// 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 "
"to %s extension", function, filename, DLL_EXT );
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index d8bc7383..b1197a55 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -83,6 +83,30 @@ void COM_StripExtension( const char *in, char *out, int 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;
+}
/*
==================
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 5e701cc6..082a442f 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -756,6 +756,7 @@ float Com_Clamp( float min, float max, float value );
char *COM_SkipPath( char *pathname );
const char *COM_GetExtension( const char *name );
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_BeginParseSession( const char *name );