[Asterisk-cvs] asterisk file.c,1.59,1.60

markster at lists.digium.com markster at lists.digium.com
Thu Apr 7 14:33:21 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv24413

Modified Files:
	file.c 
Log Message:
Match special case of wav49 behavior (bug #3975)


Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- file.c	31 Mar 2005 03:25:55 -0000	1.59
+++ file.c	7 Apr 2005 19:25:52 -0000	1.60
@@ -280,22 +280,28 @@
 
 static char *build_filename(const char *filename, const char *ext)
 {
-	char *fn;
+	char *fn, type[16];
 	int fnsize = 0;
 
+	if (!strcmp(ext, "wav49")) {
+		strncpy(type, "WAV", sizeof(type) - 1);
+	} else {
+		strncpy(type, ext, sizeof(type) - 1);
+	}
+
 	if (filename[0] == '/') {
-		fnsize = strlen(filename) + strlen(ext) + 2;
+		fnsize = strlen(filename) + strlen(type) + 2;
 		fn = malloc(fnsize);
 		if (fn)
-			snprintf(fn, fnsize, "%s.%s", filename, ext);
+			snprintf(fn, fnsize, "%s.%s", filename, type);
 	} else {
 		char tmp[AST_CONFIG_MAX_PATH] = "";
 
 		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_VAR_DIR, "sounds");
-		fnsize = strlen(tmp) + strlen(filename) + strlen(ext) + 3;
+		fnsize = strlen(tmp) + strlen(filename) + strlen(type) + 3;
 		fn = malloc(fnsize);
 		if (fn)
-			snprintf(fn, fnsize, "%s/%s.%s", tmp, filename, ext);
+			snprintf(fn, fnsize, "%s/%s.%s", tmp, filename, type);
 	}
 
 	return fn;
@@ -355,9 +361,6 @@
 			/* Try each kind of extension */
 			stringp=exts;
 			ext = strsep(&stringp, "|");
-			if (!strcmp(ext,"wav49")) {
-				ext = "WAV";
-			}
 			do {
 				fn = build_filename(filename, ext);
 				if (fn) {




More information about the svn-commits mailing list