Clean up the FS_FIX_PATHS code a bit - should by faster now, too.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 Jan 2008 01:09:00 +0000 (01:09 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 Jan 2008 01:09:00 +0000 (01:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8029 d7cf8633-e32d-0410-b094-e92efae38249

fs.c

diff --git a/fs.c b/fs.c
index 8571aed..d824e07 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1821,14 +1821,12 @@ qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboole
 {
 #ifdef FS_FIX_PATHS
        char fixedFileName[MAX_QPATH];
-       char *d = fixedFileName;
+       char *d;
+       strlcpy( fixedFileName, filepath, MAX_QPATH );
        // try to fix common mistakes (\ instead of /)
-       for( ; *filepath ; filepath++, d++ )
-               if( *filepath != '\\' )
-                       *d = *filepath;
-               else
+       for( d = fixedFileName ; *d ; d++ )
+               if( *d == '\\' )
                        *d = '/';
-       *d = '\0';
        filepath = fixedFileName;
 #endif