qi: Fix 'rootdir' value, include post-install from proper location
[dragora.git] / patches / vorbis-tools / 0017-oggdec-Write-to-stdout-instead-of-.wav-when-reading-.patch
blob62fd3ba60741b7bee29cfb431579b63ac5aef57b
1 From: =?utf-8?q?Martin_Stegh=C3=B6fer?= <martin@steghoefer.eu>
2 Date: Thu, 8 Oct 2015 21:29:45 +0200
3 Subject: oggdec: Write to stdout instead of "-.wav" when reading from stdin
4 and not output file name is given.
6 In bug #263762 it was reported that the behavior of oggdec was inconsistent
7 with its documentation: According to the man page, "oggdec" should write to
8 stdout, when reading its input from stdin and no output file name is given.
9 The "oggdec" executable writes to "-.wav" instead.
11 I adjusted the behavior of "oggdec" instead of adjusting the documentation
12 because it seems more sensible to write to stdout than to write to a file
13 called "-.wav". The code changes themselves are simple enough to be
14 self-explanatory.
16 Bug-Debian: https://bugs.debian.org/263762
17 Forwarded: https://trac.xiph.org/ticket/1678#comment:1
18 ---
19 oggdec/oggdec.c | 27 ++++++++++++++++-----------
20 1 file changed, 16 insertions(+), 11 deletions(-)
22 diff --git a/oggdec/oggdec.c b/oggdec/oggdec.c
23 index 3f2ae7b..84047de 100644
24 --- a/oggdec/oggdec.c
25 +++ b/oggdec/oggdec.c
26 @@ -443,16 +443,21 @@ int main(int argc, char **argv)
27 out = outfilename;
29 else {
30 - char *end = strrchr(argv[i], '.');
31 - end = end?end:(argv[i] + strlen(argv[i]) + 1);
33 - out = malloc(strlen(argv[i]) + 10);
34 - strncpy(out, argv[i], end-argv[i]);
35 - out[end-argv[i]] = 0;
36 - if(raw)
37 - strcat(out, ".raw");
38 - else
39 - strcat(out, ".wav");
40 + if(!strcmp(argv[i], "-")) {
41 + out = NULL;
42 + }
43 + else {
44 + char *end = strrchr(argv[i], '.');
45 + end = end?end:(argv[i] + strlen(argv[i]) + 1);
47 + out = malloc(strlen(argv[i]) + 10);
48 + strncpy(out, argv[i], end-argv[i]);
49 + out[end-argv[i]] = 0;
50 + if(raw)
51 + strcat(out, ".raw");
52 + else
53 + strcat(out, ".wav");
54 + }
57 infile = open_input(in);
58 @@ -469,7 +474,7 @@ int main(int argc, char **argv)
59 return 1;
62 - if(!outfilename)
63 + if(!outfilename && out)
64 free(out);
66 fclose(outfile);