aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-07 19:25:52 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-04-07 19:25:52 +0000
commit83c8ebbbb89285886630a97684da3bff9a4cc71c (patch)
treecd651d6646843f27ade3eb817b1bee2d5c19c1a7 /file.c
parent5e67dfa01f75bb4430163029374ad70566b13f24 (diff)
Match special case of wav49 behavior (bug #3975)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5436 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'file.c')
-rwxr-xr-xfile.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/file.c b/file.c
index 59db9a686..a37b5c507 100755
--- a/file.c
+++ b/file.c
@@ -280,22 +280,28 @@ static int copy(const char *infile, const char *outfile)
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 @@ static int ast_filehelper(const char *filename, const char *filename2, const cha
/* Try each kind of extension */
stringp=exts;
ext = strsep(&stringp, "|");
- if (!strcmp(ext,"wav49")) {
- ext = "WAV";
- }
do {
fn = build_filename(filename, ext);
if (fn) {