Commit 1e94f1e6 authored by Martin Steghöfer's avatar Martin Steghöfer Committed by Thomas Daede

oggdec: Write to stdout instead of "-.wav" when reading from stdin and not...

oggdec: Write to stdout instead of "-.wav" when reading from stdin and not output file name is given.

In bug #263762 it was reported that the behavior of oggdec was inconsistent
with its documentation: According to the man page, "oggdec" should write to
stdout, when reading its input from stdin and no output file name is given.
The "oggdec" executable writes to "-.wav" instead.

I adjusted the behavior of "oggdec" instead of adjusting the documentation
because it seems more sensible to write to stdout than to write to a file
called "-.wav". The code changes themselves are simple enough to be
self-explanatory.

Bug-Debian: https://bugs.debian.org/263762
Forwarded: https://trac.xiph.org/ticket/1678#comment:1
parent 3bbabc06
......@@ -443,16 +443,21 @@ int main(int argc, char **argv)
out = outfilename;
}
else {
char *end = strrchr(argv[i], '.');
end = end?end:(argv[i] + strlen(argv[i]) + 1);
out = malloc(strlen(argv[i]) + 10);
strncpy(out, argv[i], end-argv[i]);
out[end-argv[i]] = 0;
if(raw)
strcat(out, ".raw");
else
strcat(out, ".wav");
if(!strcmp(argv[i], "-")) {
out = NULL;
}
else {
char *end = strrchr(argv[i], '.');
end = end?end:(argv[i] + strlen(argv[i]) + 1);
out = malloc(strlen(argv[i]) + 10);
strncpy(out, argv[i], end-argv[i]);
out[end-argv[i]] = 0;
if(raw)
strcat(out, ".raw");
else
strcat(out, ".wav");
}
}
infile = open_input(in);
......@@ -472,7 +477,7 @@ int main(int argc, char **argv)
return 1;
}
if(!outfilename)
if(!outfilename && out)
free(out);
fclose(outfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment