pkgsrc/audio/xcdplayer/patches/patch-al

69 lines
1.5 KiB
Text

$NetBSD: patch-al,v 1.6 2012/06/02 20:00:50 dholland Exp $
- needs stdlib.h
- needs time.h
- support BSD cdrom interface
- use the right debug on/off flag
- don't use own declarations of standard functions
- use malloc() properly
- call time() correctly
--- shuffle.c.orig 1993-01-12 18:59:38.000000000 +0000
+++ shuffle.c
@@ -15,9 +15,14 @@
# include <X11/Intrinsic.h>
# include <stdio.h>
+# include <stdlib.h>
+# include <time.h>
# include "debug.h"
# include "cdrom_globs.h"
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+# include "cdrom_freebsd.h"
+#endif
#ifdef sun
# include "cdrom_sun.h"
#endif
@@ -29,15 +34,10 @@
static unsigned char *random_tracks;
+extern AppData app_data;
+
void
shuffle_setup() {
- extern char *malloc();
-#ifdef sgi
- extern time_t time(time_t *);
-#else
- extern long time();
-#endif
- extern long random();
unsigned long seed, now;
char state[128];
int try;
@@ -63,12 +63,12 @@ shuffle_setup() {
random_tracks = NULL;
}
- if ((random_tracks = (unsigned char *) malloc(cdi.ntracks)) == NULL) {
+ if ((random_tracks = malloc(cdi.ntracks)) == NULL) {
perror("malloc");
exit(1);
}
- now = time((long *) 0);
+ now = time(NULL);
seed = now & 0xfff;
initstate(seed, state, sizeof(state));
@@ -97,7 +97,7 @@ shuffle_setup() {
random_tracks[i] = try;
}
- if (debug == True) {
+ if (app_data.debug == True) {
debug_printf(1, "shuffle_setup: ");
for (i = 0; i < cdi.ntracks; i++)
debug_printf(1, "%d ", random_tracks[i]);