]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - dpvsimpledecode.c
changed demo playback csqc mismatch error to a warning
[xonotic/darkplaces.git] / dpvsimpledecode.c
index d17ced77d5f4ddbb3601e29810ab606c8e54f08b..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)
 {
@@ -392,13 +368,16 @@ void *dpvsimpledecode_open(char *filename, char **errorstring)
                                                        s->videopixels = (unsigned int *)Z_Malloc(s->info_imagewidth * s->info_imageheight * sizeof(*s->videopixels));
                                                        if (s->videopixels != NULL)
                                                        {
-                                                               wavename = (char *)Z_Malloc(strlen(filename) + 10);
+                                                               size_t namelen;
+                                                               
+                                                               namelen = strlen(filename) + 10;
+                                                               wavename = (char *)Z_Malloc(namelen);
                                                                if (wavename)
                                                                {
                                                                        sfx_t* sfx;
 
-                                                                       StripExtension(filename, wavename);
-                                                                       strcat(wavename, ".wav");
+                                                                       FS_StripExtension(filename, wavename, namelen);
+                                                                       strlcat(wavename, ".wav", namelen);
                                                                        sfx = S_PrecacheSound (wavename, false, false);
                                                                        if (sfx != NULL)
                                                                                s->sndchan = S_StartSound (-1, 0, sfx, vec3_origin, 1.0f, 0);