mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2247 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
24
file.c
24
file.c
@@ -287,6 +287,22 @@ static char *build_filename(char *filename, char *ext)
|
||||
|
||||
}
|
||||
|
||||
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 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
||||
}
|
||||
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 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
||||
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 @@ struct ast_filestream *ast_readfile(char *filename, char *type, char *comment, i
|
||||
}
|
||||
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 @@ struct ast_filestream *ast_writefile(char *filename, char *type, char *comment,
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user