|
|
@ -351,7 +351,7 @@ static int ast_filehelper(const char *filename, const char *filename2, const cha
|
|
|
|
while(f) {
|
|
|
|
while(f) {
|
|
|
|
if (!fmt || exts_compare(f->exts, fmt)) {
|
|
|
|
if (!fmt || exts_compare(f->exts, fmt)) {
|
|
|
|
char *stringp=NULL;
|
|
|
|
char *stringp=NULL;
|
|
|
|
exts = strdup(f->exts);
|
|
|
|
exts = ast_strdupa(f->exts);
|
|
|
|
/* Try each kind of extension */
|
|
|
|
/* Try each kind of extension */
|
|
|
|
stringp=exts;
|
|
|
|
stringp=exts;
|
|
|
|
ext = strsep(&stringp, "|");
|
|
|
|
ext = strsep(&stringp, "|");
|
|
|
@ -426,7 +426,7 @@ static int ast_filehelper(const char *filename, const char *filename2, const cha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ext = strsep(&stringp, "|");
|
|
|
|
ext = strsep(&stringp, "|");
|
|
|
|
} while(ext);
|
|
|
|
} while(ext);
|
|
|
|
free(exts);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f = f->next;
|
|
|
|
f = f->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -797,7 +797,6 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
|
|
|
|
struct ast_format *f;
|
|
|
|
struct ast_format *f;
|
|
|
|
struct ast_filestream *fs=NULL;
|
|
|
|
struct ast_filestream *fs=NULL;
|
|
|
|
char *fn;
|
|
|
|
char *fn;
|
|
|
|
char *ext;
|
|
|
|
|
|
|
|
if (ast_mutex_lock(&formatlock)) {
|
|
|
|
if (ast_mutex_lock(&formatlock)) {
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
|
|
|
ast_log(LOG_WARNING, "Unable to lock format list\n");
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
@ -805,12 +804,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
|
|
|
|
f = formats;
|
|
|
|
f = formats;
|
|
|
|
while(f) {
|
|
|
|
while(f) {
|
|
|
|
if (exts_compare(f->exts, type)) {
|
|
|
|
if (exts_compare(f->exts, type)) {
|
|
|
|
char *stringp=NULL;
|
|
|
|
fn = build_filename(filename, type);
|
|
|
|
/* XXX Implement check XXX */
|
|
|
|
|
|
|
|
ext = strdup(f->exts);
|
|
|
|
|
|
|
|
stringp=ext;
|
|
|
|
|
|
|
|
ext = strsep(&stringp, "|");
|
|
|
|
|
|
|
|
fn = build_filename(filename, ext);
|
|
|
|
|
|
|
|
fd = open(fn, flags | myflags);
|
|
|
|
fd = open(fn, flags | myflags);
|
|
|
|
if (fd >= 0) {
|
|
|
|
if (fd >= 0) {
|
|
|
|
errno = 0;
|
|
|
|
errno = 0;
|
|
|
@ -829,7 +823,6 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
|
|
|
|
} else if (errno != EEXIST)
|
|
|
|
} else if (errno != EEXIST)
|
|
|
|
ast_log(LOG_WARNING, "Unable to open file %s: %s\n", fn, strerror(errno));
|
|
|
|
ast_log(LOG_WARNING, "Unable to open file %s: %s\n", fn, strerror(errno));
|
|
|
|
free(fn);
|
|
|
|
free(fn);
|
|
|
|
free(ext);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f = f->next;
|
|
|
|
f = f->next;
|
|
|
@ -846,7 +839,6 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
|
|
|
|
struct ast_format *f;
|
|
|
|
struct ast_format *f;
|
|
|
|
struct ast_filestream *fs=NULL;
|
|
|
|
struct ast_filestream *fs=NULL;
|
|
|
|
char *fn,*orig_fn=NULL;
|
|
|
|
char *fn,*orig_fn=NULL;
|
|
|
|
char *ext;
|
|
|
|
|
|
|
|
char *buf=NULL;
|
|
|
|
char *buf=NULL;
|
|
|
|
size_t size = 0;
|
|
|
|
size_t size = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -867,14 +859,9 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
|
|
|
|
f = formats;
|
|
|
|
f = formats;
|
|
|
|
while(f) {
|
|
|
|
while(f) {
|
|
|
|
if (exts_compare(f->exts, type)) {
|
|
|
|
if (exts_compare(f->exts, type)) {
|
|
|
|
char *stringp=NULL;
|
|
|
|
fn = build_filename(filename, type);
|
|
|
|
/* XXX Implement check XXX */
|
|
|
|
|
|
|
|
ext = ast_strdupa(f->exts);
|
|
|
|
|
|
|
|
stringp=ext;
|
|
|
|
|
|
|
|
ext = strsep(&stringp, "|");
|
|
|
|
|
|
|
|
fn = build_filename(filename, ext);
|
|
|
|
|
|
|
|
fd = open(fn, flags | myflags, mode);
|
|
|
|
fd = open(fn, flags | myflags, mode);
|
|
|
|
|
|
|
|
|
|
|
|
if (option_cache_record_files && fd >= 0) {
|
|
|
|
if (option_cache_record_files && fd >= 0) {
|
|
|
|
close(fd);
|
|
|
|
close(fd);
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -903,7 +890,7 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
|
|
|
|
fs->flags = flags;
|
|
|
|
fs->flags = flags;
|
|
|
|
fs->mode = mode;
|
|
|
|
fs->mode = mode;
|
|
|
|
if (option_cache_record_files) {
|
|
|
|
if (option_cache_record_files) {
|
|
|
|
fs->realfilename = build_filename(filename, ext);
|
|
|
|
fs->realfilename = build_filename(filename, type);
|
|
|
|
fs->filename = strdup(fn);
|
|
|
|
fs->filename = strdup(fn);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
fs->realfilename = NULL;
|
|
|
|
fs->realfilename = NULL;
|
|
|
|