]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - dpvsimpledecode.c
Removed all calls to strcpy; most of them are now calls to strlcpy or memcpy.
[xonotic/darkplaces.git] / dpvsimpledecode.c
index 28536526448f9b584d50e44e1a8a3de012bc9d86..7519c3f6ecd6dad1cf0cb48a418fbf1bc470849d 100644 (file)
@@ -333,30 +333,6 @@ static int dpvsimpledecode_setpixelformat(dpvsimpledecodestream_t *s, unsigned i
 
 // opening and closing streams
 
-static void StripExtension(char *in, char *out)
-{
-       char *dot, *c;
-       dot = NULL;
-       for (c = in;*c;c++)
-       {
-               if (*c == ':' || *c == '\\' || *c == '/')
-                       dot = NULL;
-               if (*c == '.')
-                       dot = c;
-       }
-       if (dot == NULL)
-       {
-               // nothing to remove
-               strcpy(out, in);
-               return;
-       }
-       else
-       {
-               memcpy(out, in, dot - in);
-               out[dot - in] = 0;
-       }
-}
-
 // opens a stream
 void *dpvsimpledecode_open(char *filename, char **errorstring)
 {
@@ -400,7 +376,7 @@ void *dpvsimpledecode_open(char *filename, char **errorstring)
                                                                {
                                                                        sfx_t* sfx;
 
-                                                                       StripExtension(filename, wavename);
+                                                                       FS_StripExtension(filename, wavename, namelen);
                                                                        strlcat(wavename, ".wav", namelen);
                                                                        sfx = S_PrecacheSound (wavename, false, false);
                                                                        if (sfx != NULL)