projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c0a1906
)
[tests] use srand/rand on windows, declare mkstemp and srandom for c99
author
Paul Brossier
<piem@piem.org>
Mon, 17 Dec 2018 01:03:42 +0000
(
02:03
+0100)
committer
Paul Brossier
<piem@piem.org>
Mon, 17 Dec 2018 01:03:42 +0000
(
02:03
+0100)
tests/utils_tests.h
patch
|
blob
|
history
diff --git
a/tests/utils_tests.h
b/tests/utils_tests.h
index
af968b5
..
cf1a446
100644
(file)
--- a/
tests/utils_tests.h
+++ b/
tests/utils_tests.h
@@
-55,21
+55,20
@@
#define RAND_MAX 32767
#endif
#define RAND_MAX 32767
#endif
-// are we on windows ? or are we using -std=c99 ?
-#if defined(HAVE_WIN_HACKS) || defined(__STRICT_ANSI__)
-// http://en.wikipedia.org/wiki/Linear_congruential_generator
-// no srandom/random on win32
+#if defined(HAVE_WIN_HACKS)
-uint_t srandom_seed = 1029;
+// use srand/rand on windows
+#define srandom srand
+#define random rand
-void srandom(uint_t new_seed) {
- srandom_seed = new_seed;
-}
+#elif defined(__STRICT_ANSI__)
+
+// workaround to build with -std=c99 (for instance with older cygwin),
+// assuming libbc is recent enough to supports these functions.
+extern void srandom(unsigned);
+extern int random(void);
+extern char mkstemp(const char *pat);
-uint_t random(void) {
- srandom_seed = 1664525 * srandom_seed + 1013904223;
- return srandom_seed;
-}
#endif
void utils_init_random (void);
#endif
void utils_init_random (void);