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

markster at lists.digium.com markster at lists.digium.com
Wed Mar 30 21:32:22 CST 2005


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

Modified Files:
	file.c 
Log Message:
Use requested extension (bug #3894)


Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- file.c	22 Mar 2005 20:34:04 -0000	1.58
+++ file.c	31 Mar 2005 03:25:55 -0000	1.59
@@ -351,7 +351,7 @@
 	while(f) {
 		if (!fmt || exts_compare(f->exts, fmt)) {
 			char *stringp=NULL;
-			exts = strdup(f->exts);
+			exts = ast_strdupa(f->exts);
 			/* Try each kind of extension */
 			stringp=exts;
 			ext = strsep(&stringp, "|");
@@ -426,7 +426,7 @@
 				}
 				ext = strsep(&stringp, "|");
 			} while(ext);
-			free(exts);
+			
 		}
 		f = f->next;
 	}
@@ -797,7 +797,6 @@
 	struct ast_format *f;
 	struct ast_filestream *fs=NULL;
 	char *fn;
-	char *ext;
 	if (ast_mutex_lock(&formatlock)) {
 		ast_log(LOG_WARNING, "Unable to lock format list\n");
 		return NULL;
@@ -805,12 +804,7 @@
 	f = formats;
 	while(f) {
 		if (exts_compare(f->exts, type)) {
-			char *stringp=NULL;
-			/* XXX Implement check XXX */
-			ext = strdup(f->exts);
-			stringp=ext;
-			ext = strsep(&stringp, "|");
-			fn = build_filename(filename, ext);
+			fn = build_filename(filename, type);
 			fd = open(fn, flags | myflags);
 			if (fd >= 0) {
 				errno = 0;
@@ -829,7 +823,6 @@
 			} else if (errno != EEXIST)
 				ast_log(LOG_WARNING, "Unable to open file %s: %s\n", fn, strerror(errno));
 			free(fn);
-			free(ext);
 			break;
 		}
 		f = f->next;
@@ -846,7 +839,6 @@
 	struct ast_format *f;
 	struct ast_filestream *fs=NULL;
 	char *fn,*orig_fn=NULL;
-	char *ext;
 	char *buf=NULL;
 	size_t size = 0;
 
@@ -867,14 +859,9 @@
 	f = formats;
 	while(f) {
 		if (exts_compare(f->exts, type)) {
-			char *stringp=NULL;
-			/* XXX Implement check XXX */
-			ext = ast_strdupa(f->exts);
-			stringp=ext;
-			ext = strsep(&stringp, "|");
-			fn = build_filename(filename, ext);
+			fn = build_filename(filename, type);
 			fd = open(fn, flags | myflags, mode);
-
+			
 			if (option_cache_record_files && fd >= 0) {
 				close(fd);
 				/*
@@ -903,7 +890,7 @@
 					fs->flags = flags;
 					fs->mode = mode;
 					if (option_cache_record_files) {
-						fs->realfilename = build_filename(filename, ext);
+						fs->realfilename = build_filename(filename, type);
 						fs->filename = strdup(fn);
 					} else {
 						fs->realfilename = NULL;




More information about the svn-commits mailing list