[Asterisk-cvs] asterisk file.c,1.36,1.37

citats at lists.digium.com citats at lists.digium.com
Wed Feb 25 17:42:56 CST 2004


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

Modified Files:
	file.c 
Log Message:
Bug #1087.  Fix wav49 format so it can be played.  Make file functions
looking for extension use f->exts instead of f->name.  Fix bug 
where error message didn't print file extension. Fix comments in header file.
Everything is completely backwards compatible



Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- file.c	18 Feb 2004 16:32:49 -0000	1.36
+++ file.c	25 Feb 2004 22:31:50 -0000	1.37
@@ -287,6 +287,22 @@
 	
 }
 
+static int exts_compare(char *exts, char *type)
+{
+	char *stringp = NULL, *ext;
+	char tmp[256];
+
+	strncpy(tmp, exts, sizeof(tmp) - 1);
+	stringp = tmp;
+	while ((ext = strsep(&stringp, "|"))) {
+		if (!strcmp(ext, type)) {
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
 #define ACTION_EXISTS 1
 #define ACTION_DELETE 2
 #define ACTION_RENAME 3
@@ -319,7 +335,7 @@
 	}
 	f = formats;
 	while(f) {
-		if (!fmt || !strcasecmp(f->name, fmt)) {
+		if (!fmt || exts_compare(f->exts, fmt)) {
 			char *stringp=NULL;
 			exts = strdup(f->exts);
 			/* Try each kind of extension */
@@ -376,7 +392,7 @@
 											chan->vstream = s;
 									} else {
 										close(ret);
-										ast_log(LOG_WARNING, "Unable to open fd on %s\n", filename);
+										ast_log(LOG_WARNING, "Unable to open fd on %s\n", fn);
 									}
 								} else
 									ast_log(LOG_WARNING, "Couldn't open file %s\n", fn);
@@ -748,7 +764,7 @@
 	}
 	f = formats;
 	while(f) {
-		if (!strcasecmp(f->name, type)) {
+		if (exts_compare(f->exts, type)) {
 			char *stringp=NULL;
 			/* XXX Implement check XXX */
 			ext = strdup(f->exts);
@@ -803,7 +819,7 @@
 
 	f = formats;
 	while(f) {
-		if (!strcasecmp(f->name, type)) {
+		if (exts_compare(f->exts, type)) {
 			char *stringp=NULL;
 			/* XXX Implement check XXX */
 			ext = strdup(f->exts);




More information about the svn-commits mailing list