1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
--- mpg123.c.orig Tue Aug 21 19:48:17 2001
+++ mpg123.c Tue Aug 21 19:49:02 2001
@@ -27,6 +27,10 @@
#include <sched.h>
#endif
+#ifdef __FreeBSD__
+#include <ieeefp.h>
+#endif
+
#include "mpg123.h"
#include "getlopt.h"
#include "buffer.h"
@@ -223,7 +227,7 @@
{
int loop, rannum;
- srand(time(NULL));
+ srandomdev();
if(shuffleord)
free(shuffleord);
shuffleord = (int *) malloc((numfiles + 1) * sizeof(int));
@@ -239,7 +243,7 @@
/* now shuffle them */
if(numfiles >= 2) {
for (loop = 0; loop < numfiles; loop++) {
- rannum = (rand() % (numfiles * 4 - 4)) / 4;
+ rannum = (random() % (numfiles * 4 - 4)) / 4;
rannum += (rannum >= loop);
shuffleord[loop] ^= shuffleord[rannum];
shuffleord[rannum] ^= shuffleord[loop];
@@ -381,7 +385,7 @@
curfile++;
}
else {
- newfile = shufflist[ rand() % shuffle_listsize ];
+ newfile = shufflist[ random() % shuffle_listsize ];
}
return newfile;
@@ -784,6 +788,10 @@
_wildcard(&argc,&argv);
#endif
+#ifdef __FreeBSD__
+ fpsetmask(0);
+#endif
+
if(sizeof(short) != 2) {
fprintf(stderr,"Ouch SHORT has size of %d bytes (required: '2')\n",(int)sizeof(short));
exit(1);
|