archrelease: copy trunk to extra-x86_64
[arch-packages.git] / audiofile / repos / extra-x86_64 / 02_hurd.patch
blobb5941dcf44e5b45f66114d7b58ec624bc3f7c4d5
1 Description: Remove usage of PATH_MAX in tests to fix FTBFS on Hurd.
2 jcowgill: Removed Changelog changes
3 Author: Pino Toscano <toscano.pino@tiscali.it>
4 Origin: backport, https://github.com/mpruett/audiofile/commit/34c261034f1193a783196618f0052112e00fbcfe
5 Bug: https://github.com/mpruett/audiofile/pull/17
6 Bug-Debian: https://bugs.debian.org/762595
7 ---
8 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
10 --- a/test/TestUtilities.cpp
11 +++ b/test/TestUtilities.cpp
12 @@ -21,8 +21,8 @@
13 #include "TestUtilities.h"
15 #include <limits.h>
16 -#include <stdio.h>
17 #include <stdlib.h>
18 +#include <string.h>
19 #include <unistd.h>
21 bool createTemporaryFile(const std::string &prefix, std::string *path)
22 @@ -35,12 +35,12 @@ bool createTemporaryFile(const std::stri
23 return true;
26 -bool createTemporaryFile(const char *prefix, char *path)
27 +bool createTemporaryFile(const char *prefix, char **path)
29 - snprintf(path, PATH_MAX, "/tmp/%s-XXXXXX", prefix);
30 - int fd = ::mkstemp(path);
31 - if (fd < 0)
32 - return false;
33 - ::close(fd);
34 - return true;
35 + *path = NULL;
36 + std::string pathString;
37 + bool result = createTemporaryFile(prefix, &pathString);
38 + if (result)
39 + *path = ::strdup(pathString.c_str());
40 + return result;
42 --- a/test/TestUtilities.h
43 +++ b/test/TestUtilities.h
44 @@ -53,7 +53,7 @@ extern "C" {
46 #include <stdbool.h>
48 -bool createTemporaryFile(const char *prefix, char *path);
49 +bool createTemporaryFile(const char *prefix, char **path);
51 #ifdef __cplusplus
53 --- a/test/floatto24.c
54 +++ b/test/floatto24.c
55 @@ -86,8 +86,8 @@ int main (int argc, char **argv)
56 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
57 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32);
59 - char testFileName[PATH_MAX];
60 - if (!createTemporaryFile("floatto24", testFileName))
61 + char *testFileName;
62 + if (!createTemporaryFile("floatto24", &testFileName))
64 fprintf(stderr, "Could not create temporary file.\n");
65 exit(EXIT_FAILURE);
66 @@ -182,6 +182,7 @@ int main (int argc, char **argv)
69 unlink(testFileName);
70 + free(testFileName);
72 exit(EXIT_SUCCESS);
74 --- a/test/sixteen-to-eight.c
75 +++ b/test/sixteen-to-eight.c
76 @@ -57,8 +57,8 @@ int main (int argc, char **argv)
77 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_UNSIGNED, 8);
78 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
80 - char testFileName[PATH_MAX];
81 - if (!createTemporaryFile("sixteen-to-eight", testFileName))
82 + char *testFileName;
83 + if (!createTemporaryFile("sixteen-to-eight", &testFileName))
85 fprintf(stderr, "Could not create temporary file.\n");
86 exit(EXIT_FAILURE);
87 @@ -113,6 +113,7 @@ int main (int argc, char **argv)
89 afCloseFile(file);
90 unlink(testFileName);
91 + free(testFileName);
93 exit(EXIT_SUCCESS);
95 --- a/test/testchannelmatrix.c
96 +++ b/test/testchannelmatrix.c
97 @@ -39,7 +39,7 @@
99 #include "TestUtilities.h"
101 -static char sTestFileName[PATH_MAX];
102 +static char *sTestFileName;
104 const short samples[] = {300, -300, 515, -515, 2315, -2315, 9154, -9154};
105 #define SAMPLE_COUNT (sizeof (samples) / sizeof (short))
106 @@ -47,7 +47,11 @@ const short samples[] = {300, -300, 515,
108 void cleanup (void)
110 - unlink(sTestFileName);
111 + if (sTestFileName)
113 + unlink(sTestFileName);
114 + free(sTestFileName);
118 void ensure (int condition, const char *message)
119 @@ -76,7 +80,7 @@ int main (void)
120 afInitFileFormat(setup, AF_FILE_AIFFC);
122 /* Write stereo data to test file. */
123 - ensure(createTemporaryFile("testchannelmatrix", sTestFileName),
124 + ensure(createTemporaryFile("testchannelmatrix", &sTestFileName),
125 "could not create temporary file");
126 file = afOpenFile(sTestFileName, "w", setup);
127 ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing");
128 --- a/test/testdouble.c
129 +++ b/test/testdouble.c
130 @@ -38,7 +38,7 @@
132 #include "TestUtilities.h"
134 -static char sTestFileName[PATH_MAX];
135 +static char *sTestFileName;
137 const double samples[] =
138 {1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4};
139 @@ -48,7 +48,11 @@ void testdouble (int fileFormat);
141 void cleanup (void)
143 - unlink(sTestFileName);
144 + if (sTestFileName)
146 + unlink(sTestFileName);
147 + free(sTestFileName);
151 void ensure (int condition, const char *message)
152 @@ -96,7 +100,7 @@ void testdouble (int fileFormat)
153 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_DOUBLE, 64);
154 afInitChannels(setup, AF_DEFAULT_TRACK, 2);
156 - ensure(createTemporaryFile("testdouble", sTestFileName),
157 + ensure(createTemporaryFile("testdouble", &sTestFileName),
158 "could not create temporary file");
159 file = afOpenFile(sTestFileName, "w", setup);
160 ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing");
161 --- a/test/testfloat.c
162 +++ b/test/testfloat.c
163 @@ -38,7 +38,7 @@
165 #include "TestUtilities.h"
167 -static char sTestFileName[PATH_MAX];
168 +static char *sTestFileName;
170 const float samples[] =
171 {1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4};
172 @@ -48,7 +48,11 @@ void testfloat (int fileFormat);
174 void cleanup (void)
176 - unlink(sTestFileName);
177 + if (sTestFileName)
179 + unlink(sTestFileName);
180 + free(sTestFileName);
184 void ensure (int condition, const char *message)
185 @@ -96,7 +100,7 @@ void testfloat (int fileFormat)
186 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32);
187 afInitChannels(setup, AF_DEFAULT_TRACK, 2);
189 - ensure(createTemporaryFile("testfloat", sTestFileName),
190 + ensure(createTemporaryFile("testfloat", &sTestFileName),
191 "could not create temporary file");
192 file = afOpenFile(sTestFileName, "w", setup);
193 ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing");
194 --- a/test/testmarkers.c
195 +++ b/test/testmarkers.c
196 @@ -32,15 +32,19 @@
198 #include "TestUtilities.h"
200 -static char sTestFileName[PATH_MAX];
201 +static char *sTestFileName;
203 #define FRAME_COUNT 200
205 void cleanup (void)
207 + if (sTestFileName)
209 #ifndef DEBUG
210 - unlink(sTestFileName);
211 + unlink(sTestFileName);
212 #endif
213 + free(sTestFileName);
217 void ensure (int condition, const char *message)
218 @@ -127,7 +131,7 @@ int testmarkers (int fileformat)
220 int main (void)
222 - ensure(createTemporaryFile("testmarkers", sTestFileName),
223 + ensure(createTemporaryFile("testmarkers", &sTestFileName),
224 "could not create temporary file");
226 testmarkers(AF_FILE_AIFF);
227 --- a/test/twentyfour.c
228 +++ b/test/twentyfour.c
229 @@ -71,8 +71,8 @@ int main (int argc, char **argv)
230 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24);
231 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
233 - char testFileName[PATH_MAX];
234 - if (!createTemporaryFile("twentyfour", testFileName))
235 + char *testFileName;
236 + if (!createTemporaryFile("twentyfour", &testFileName))
238 fprintf(stderr, "could not create temporary file\n");
239 exit(EXIT_FAILURE);
240 @@ -239,6 +239,7 @@ int main (int argc, char **argv)
241 exit(EXIT_FAILURE);
243 unlink(testFileName);
244 + free(testFileName);
246 exit(EXIT_SUCCESS);
248 --- a/test/twentyfour2.c
249 +++ b/test/twentyfour2.c
250 @@ -45,15 +45,19 @@
252 #include "TestUtilities.h"
254 -static char sTestFileName[PATH_MAX];
255 +static char *sTestFileName;
257 #define FRAME_COUNT 10000
259 void cleanup (void)
261 + if (sTestFileName)
263 #ifndef DEBUG
264 - unlink(sTestFileName);
265 + unlink(sTestFileName);
266 #endif
267 + free(sTestFileName);
271 void ensure (int condition, const char *message)
272 @@ -78,7 +82,7 @@ int main (void)
273 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
274 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24);
276 - ensure(createTemporaryFile("twentyfour2", sTestFileName),
277 + ensure(createTemporaryFile("twentyfour2", &sTestFileName),
278 "could not create temporary file");
279 file = afOpenFile(sTestFileName, "w", setup);
280 ensure(file != NULL, "could not open test file for writing");
281 --- a/test/writealaw.c
282 +++ b/test/writealaw.c
283 @@ -53,7 +53,7 @@
285 #include "TestUtilities.h"
287 -static char sTestFileName[PATH_MAX];
288 +static char *sTestFileName;
290 #define FRAME_COUNT 16
291 #define SAMPLE_COUNT FRAME_COUNT
292 @@ -62,9 +62,13 @@ void testalaw (int fileFormat);
294 void cleanup (void)
296 + if (sTestFileName)
298 #ifndef DEBUG
299 - unlink(sTestFileName);
300 + unlink(sTestFileName);
301 #endif
302 + free(sTestFileName);
306 void ensure (int condition, const char *message)
307 @@ -113,7 +117,7 @@ void testalaw (int fileFormat)
308 afInitFileFormat(setup, fileFormat);
309 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
311 - ensure(createTemporaryFile("writealaw", sTestFileName),
312 + ensure(createTemporaryFile("writealaw", &sTestFileName),
313 "could not create temporary file");
314 file = afOpenFile(sTestFileName, "w", setup);
315 afFreeFileSetup(setup);
316 --- a/test/writeraw.c
317 +++ b/test/writeraw.c
318 @@ -44,13 +44,17 @@
320 #include "TestUtilities.h"
322 -static char sTestFileName[PATH_MAX];
323 +static char *sTestFileName;
325 void cleanup (void)
327 + if (sTestFileName)
329 #ifndef DEBUG
330 - unlink(sTestFileName);
331 + unlink(sTestFileName);
332 #endif
333 + free(sTestFileName);
337 void ensure (int condition, const char *message)
338 @@ -84,7 +88,7 @@ int main (int argc, char **argv)
339 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
340 afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
342 - ensure(createTemporaryFile("writeraw", sTestFileName),
343 + ensure(createTemporaryFile("writeraw", &sTestFileName),
344 "could not create temporary file");
345 file = afOpenFile(sTestFileName, "w", setup);
346 ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing");
347 --- a/test/writeulaw.c
348 +++ b/test/writeulaw.c
349 @@ -53,7 +53,7 @@
351 #include "TestUtilities.h"
353 -static char sTestFileName[PATH_MAX];
354 +static char *sTestFileName;
356 #define FRAME_COUNT 16
357 #define SAMPLE_COUNT FRAME_COUNT
358 @@ -62,9 +62,13 @@ void testulaw (int fileFormat);
360 void cleanup (void)
362 + if (sTestFileName)
364 #ifndef DEBUG
365 - unlink(sTestFileName);
366 + unlink(sTestFileName);
367 #endif
368 + free(sTestFileName);
372 void ensure (int condition, const char *message)
373 @@ -113,7 +117,7 @@ void testulaw (int fileFormat)
374 afInitFileFormat(setup, fileFormat);
375 afInitChannels(setup, AF_DEFAULT_TRACK, 1);
377 - ensure(createTemporaryFile("writeulaw", sTestFileName),
378 + ensure(createTemporaryFile("writeulaw", &sTestFileName),
379 "could not create temporary file");
380 file = afOpenFile(sTestFileName, "w", setup);
381 afFreeFileSetup(setup);