diff options
author | dholland <dholland@pkgsrc.org> | 2011-08-28 22:30:17 +0000 |
---|---|---|
committer | dholland <dholland@pkgsrc.org> | 2011-08-28 22:30:17 +0000 |
commit | df15b2056c8df7e59021feea017a4abdcb1f6b51 (patch) | |
tree | 30138813dd8084f14e93bc4a5ebdc4e5ebd66e52 /audio/cddbd | |
parent | 70b9b84ebfa99123659b65923b8d1f1fc426dac8 (diff) | |
download | pkgsrc-df15b2056c8df7e59021feea017a4abdcb1f6b51.tar.gz |
Fix void main. While here:
- add various LP64 fixes;
- use stdlib.h as needed instead of casting the return value of malloc;
- fix fake-varargs printf code and use stdarg.h;
- use system snprintf instead of included custom one;
- tidy up symbol name conflict with log();
- add patch comments;
- remove some pkglint;
- add LICENSE.
PKGREVISION -> 2.
Diffstat (limited to 'audio/cddbd')
-rw-r--r-- | audio/cddbd/Makefile | 17 | ||||
-rw-r--r-- | audio/cddbd/distinfo | 13 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-aa | 5 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-ab | 235 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-ac | 48 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-ad | 4 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-db_c | 153 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-fuzzy_c | 77 | ||||
-rw-r--r-- | audio/cddbd/patches/patch-xmit_c | 39 |
9 files changed, 567 insertions, 24 deletions
diff --git a/audio/cddbd/Makefile b/audio/cddbd/Makefile index 341266b5e2a..47a5f26ddb2 100644 --- a/audio/cddbd/Makefile +++ b/audio/cddbd/Makefile @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.14 2010/02/01 01:38:42 joerg Exp $ +# $NetBSD: Makefile,v 1.15 2011/08/28 22:30:17 dholland Exp $ # DISTNAME= cddbd-1.3.1 PKGNAME= cddbd-1.3.1p1 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= audio net MASTER_SITES= ${MASTER_SITE_XCONTRIB:=applications/cddbd-1.3.1/} @@ -13,6 +13,7 @@ PATCHFILES= cddbd-1.3.1.patch1.gz MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://www.freedb.org/en/download__server_software.4.html COMMENT= Internet CD Database Server +LICENSE= gnu-gpl-v2 PKG_DESTDIR_SUPPORT= user-destdir @@ -21,14 +22,14 @@ MAKE_FILE= makefile INSTALLATION_DIRS+= bin do-configure: - cd ${WRKSRC}; \ - ${SETENV} BASEDIR=${PREFIX:Q}/share ${SH} config.sh + cd ${WRKSRC} && \ + ${SETENV} BASEDIR=${PREFIX}/share ${SH} config.sh do-install: - cd ${WRKSRC}; \ + cd ${WRKSRC} && \ ${SETENV} INSTALL=${INSTALL:Q} DESTDIR=${DESTDIR} \ - BINDIR=${DESTDIR}${PREFIX}/bin \ - BINPERM=${BINMODE:Q} BINOWNER=${BINOWN:Q} \ - BINGROUP=${BINGRP:Q} ${SH} install.sh + BINDIR=${DESTDIR}${PREFIX}/bin \ + BINPERM=${BINMODE} BINOWNER=${BINOWN} \ + BINGROUP=${BINGRP} ${SH} install.sh .include "../../mk/bsd.pkg.mk" diff --git a/audio/cddbd/distinfo b/audio/cddbd/distinfo index e924c09aa4e..68da8fa1b43 100644 --- a/audio/cddbd/distinfo +++ b/audio/cddbd/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.7 2010/02/03 14:43:57 joerg Exp $ +$NetBSD: distinfo,v 1.8 2011/08/28 22:30:17 dholland Exp $ SHA1 (cddbd-1.3.1.tar.gz) = 2e8ab932750e54e6058edbcc6107835c9be7840c RMD160 (cddbd-1.3.1.tar.gz) = a2b666407db9d6415f430a9df8ef4a96fa24572c @@ -6,7 +6,10 @@ Size (cddbd-1.3.1.tar.gz) = 93959 bytes SHA1 (cddbd-1.3.1.patch1.gz) = 08a96dac6c95cf6c289922215be6e6c99cd9f49e RMD160 (cddbd-1.3.1.patch1.gz) = 6e0343ded77336cec190682581ad8b9ee78f46d8 Size (cddbd-1.3.1.patch1.gz) = 416 bytes -SHA1 (patch-aa) = 0bff9d9ab0e2dae540be423325840ec382e520a3 -SHA1 (patch-ab) = 6a84d5d1c9c811dc6d5faf8e806b065bc79e0959 -SHA1 (patch-ac) = 3701b82b47444eb8196069580e46f31d1d800160 -SHA1 (patch-ad) = afca1d372bf7e7bf4fc47b9100a914d6f16e431b +SHA1 (patch-aa) = 2402782d37dbe92c1ff8a1a7106b5ca04146292e +SHA1 (patch-ab) = defcebf777b5eae603074dc56afe597c456cc211 +SHA1 (patch-ac) = b15d149593298a6859d67ba81ec13a2e653a12cf +SHA1 (patch-ad) = d9237c9e3e7f5544921d6597440d9785629cb7af +SHA1 (patch-db_c) = dccbe329d38efd228d5b1f9570aa2173c6b54af1 +SHA1 (patch-fuzzy_c) = 89411630846df342ff22197eba94cc7b0670be7a +SHA1 (patch-xmit_c) = fd69e714d230fa04d4a3a7760d49ea9212ef2047 diff --git a/audio/cddbd/patches/patch-aa b/audio/cddbd/patches/patch-aa index d75364dfd8b..b23f6001027 100644 --- a/audio/cddbd/patches/patch-aa +++ b/audio/cddbd/patches/patch-aa @@ -1,4 +1,7 @@ -$NetBSD: patch-aa,v 1.5 2010/02/03 14:43:57 joerg Exp $ +$NetBSD: patch-aa,v 1.6 2011/08/28 22:30:17 dholland Exp $ + +- avoid interactive install +- configure for pkgsrc --- install.sh.orig 1996-12-22 03:49:54.000000000 +0000 +++ install.sh diff --git a/audio/cddbd/patches/patch-ab b/audio/cddbd/patches/patch-ab index 23ebf41ae40..99b690030bb 100644 --- a/audio/cddbd/patches/patch-ab +++ b/audio/cddbd/patches/patch-ab @@ -1,8 +1,36 @@ -$NetBSD: patch-ab,v 1.3 2005/05/23 08:42:39 rillig Exp $ +$NetBSD: patch-ab,v 1.4 2011/08/28 22:30:17 dholland Exp $ ---- cddbd.c.orig Sun Jun 14 06:42:12 1998 -+++ cddbd.c Sun Jun 14 06:42:50 1998 -@@ -191,14 +191,14 @@ +- needs stdlib.h instead of casting return value of malloc +- other LP64 fixes +- add const to silence qsort type warnings +- fix printf follies, use stdarg.h +- don't use included custom snprintf +- avoid symbol name conflict with standard log(), which is a gcc builtin +- void main + +--- cddbd.c.orig 1996-12-22 03:49:54.000000000 +0000 ++++ cddbd.c +@@ -43,6 +43,8 @@ static char *_cddbd_c_ident_ = "@(#)$Id: + #include <time.h> + #include <sys/time.h> + #include <stdio.h> ++#include <stdlib.h> ++#include <stdarg.h> + #include "patchlevel.h" + #include "access.h" + #include "list.h" +@@ -87,7 +89,7 @@ int cddbd_locked(clck_t *); + int cddbd_nus(int); + int cddbd_parse_access(arg_t *, int); + int cddbd_strcasecmp(char *, char *); +-int comp_client(void *, void *); ++int comp_client(const void *, const void *); + int comp_user(void *, void *); + int cvt_date(char *, char *); + int get_conv(char **, char *); +@@ -189,18 +191,18 @@ lhead_t *lock_head; /* Lock list head. + + /* Access file fields. */ access_t acctab[] = { - "logfile", logfile, AC_PATH, 0, (int)TMPDIR"/log", - "motdfile", motdfile, AC_PATH, 0, (int)"", @@ -28,3 +56,202 @@ $NetBSD: patch-ab,v 1.3 2005/05/23 08:42:39 rillig Exp $ - "bounce_email", bounce_email, AC_STRING, 0, (int)"", + "bounce_email", bounce_email, AC_STRING, 0, (long)"", "xmit_time", &xmit_time, AC_NUMERIC, AF_ZERO, DEF_XMIT_TO, + "transmits", &max_xmits, AC_NUMERIC, AF_ZERO, DEF_MAX_XMITS, + "post_lines", &max_lines, AC_NUMERIC, AF_ZERO, DEF_MAX_LINES, +@@ -230,7 +232,7 @@ proto_t proto_flags[MAX_PROTO_LEVEL + 1] + + + /* Log flags. */ +-log_t log[] = { ++static log_t logs[] = { + { LOG_NONE, 0, 0, "none", 0, }, + { LOG_INPUT, 0, 0, "input", 0, }, + { LOG_INFO, 0, 0, "info", 0, }, +@@ -339,7 +341,7 @@ char *day[] = { "Sun", "Mon", "Tue", "We + + + /* ARGSUSED */ +-void ++int + main(int argc, char **argv) + { + int i; +@@ -1126,7 +1128,7 @@ cddbd_check_access(void) + log_flags = 0; + + for(i = 1; i < args.nargs; i++) { +- for(lp = log; lp->name; lp++) { ++ for(lp = logs; lp->name; lp++) { + if(!cddbd_strcasecmp(args.arg[i], + lp->name)) { + if(lp->flag) +@@ -1460,7 +1462,7 @@ cddbd_db_init(void) + if(dp->d_name[0] == '.') + continue; + +- p = (char *)malloc(strlen(dp->d_name) + 1); ++ p = malloc(strlen(dp->d_name) + 1); + if(p == NULL) { + cddbd_log(LOG_ERR, "Malloc failed."); + quit(QUIT_ERR); +@@ -2407,8 +2409,8 @@ do_log(arg_t *args) + last[0] = '\0'; + } + +- for(i = 0; log[i].name; i++) +- log[i].cnt = 0; ++ for(i = 0; logs[i].name; i++) ++ logs[i].cnt = 0; + + lines = 0; + nclient = 0; +@@ -2452,9 +2454,9 @@ do_log(arg_t *args) + lines++; + + /* Log the message if it's acceptable. */ +- for(i = 0; log[i].name; i++) { +- if((log[i].flag & flag) && incl) +- log[i].cnt++; ++ for(i = 0; logs[i].name; i++) { ++ if((logs[i].flag & flag) && incl) ++ logs[i].cnt++; + } + + /* Count clients. */ +@@ -2515,10 +2517,10 @@ do_log(arg_t *args) + printf("Log status between: %s and %s\r\n", start, end); + } + +- for(i = 0; log[i].name; i++) +- if(log[i].banr != 0 && !((log[i].dflag & L_NOSHOW) && +- log[i].cnt == 0)) +- printf("%s: %d\r\n", log[i].banr, log[i].cnt); ++ for(i = 0; logs[i].name; i++) ++ if(logs[i].banr != 0 && !((logs[i].dflag & L_NOSHOW) && ++ logs[i].cnt == 0)) ++ printf("%s: %d\r\n", logs[i].banr, logs[i].cnt); + + if(nclient > 0) { + for(i = 0; i < nclient; i++) +@@ -2541,7 +2543,7 @@ do_log(arg_t *args) + + printf("Total messages: %d\r\n", lines); + if(sbuf.st_size != 0) +- printf("Log size: %d bytes\r\n", sbuf.st_size); ++ printf("Log size: %lld bytes\r\n", (long long)sbuf.st_size); + + printf(".\r\n"); + } +@@ -2562,15 +2564,15 @@ comp_user(void *u1, void *u2) + + + int +-comp_client(void *c1, void *c2) ++comp_client(const void *c1, const void *c2) + { + int x; + +- x = client_cnt[*(int *)c2] - client_cnt[*(int *)c1]; ++ x = client_cnt[*(const int *)c2] - client_cnt[*(const int *)c1]; + if(x != 0) + return(x); + +- return(cddbd_strcasecmp(client[*(int *)c1], client[*(int *)c2])); ++ return(cddbd_strcasecmp(client[*(const int *)c1], client[*(const int *)c2])); + } + + +@@ -2895,7 +2897,7 @@ cddbd_lock_alloc(char *name) + quit(QUIT_ERR); + } + +- if((lk = (clck_t *)malloc(sizeof(clck_t))) == NULL) { ++ if((lk = malloc(sizeof(clck_t))) == NULL) { + cddbd_log(LOG_ERR | LOG_LOCK, "Can't allocate %s lock memory.", + name); + quit(QUIT_ERR); +@@ -3179,15 +3181,15 @@ trunc_log(void) + } + + /* Get a buffer for the file. */ +- if((buf = (char *)malloc(len)) == 0) { ++ if((buf = malloc(len)) == 0) { + cddbd_log(LOG_ERR, "Can't malloc %d bytes for logfile (%d).", +- (void *)len, errno); ++ len, errno); + return; + } + + if((fd = open(logfile, O_RDONLY)) < 0) { + cddbd_log(LOG_ERR, "Can't open logfile %s for reading (%d).", +- logfile, (void *)errno); ++ logfile, errno); + free(buf); + return; + } +@@ -3195,7 +3197,7 @@ trunc_log(void) + /* Read in the whole log file. */ + if(read(fd, buf, len) != len) { + cddbd_log(LOG_ERR, "Can't read logfile: %s (%d).", logfile, +- (void *)errno); ++ errno); + close(fd); + free(buf); + return; +@@ -3219,7 +3221,7 @@ trunc_log(void) + + if((fd = open(logfile, O_TRUNC | O_WRONLY)) < 0) { + cddbd_log(LOG_ERR, "Can't open logfile %s for writing (%d).", +- logfile, (void *)errno); ++ logfile, errno); + free(buf); + return; + } +@@ -3227,7 +3229,7 @@ trunc_log(void) + /* Write out the truncated file. */ + if(write(fd, p, len) != len) { + cddbd_log(LOG_ERR, "Can't write logfile: %s (%d).", +- logfile, (void *)errno); ++ logfile, errno); + } + + close(fd); +@@ -3236,7 +3238,7 @@ trunc_log(void) + return; + } + +- ++#if 0 + #define SCOPY(p, buf) if(cc < (CDDBBUFSIZ-1)) {(buf)[cc] = **(p),(*(p))++,cc++;} + #define SASGN(c, buf) if(cc < (CDDBBUFSIZ-1)) {(buf)[cc] = c, cc++;} + #define SPUT(c, buf) (buf)[cc] = c, cc++ +@@ -3408,15 +3412,15 @@ cddbd_snprintf(char *buf, int size, char + if(!logging) + cddbd_log(LOG_ERR, "Buf overflow in snprintf: \"%s\"", buf); + } +- ++#endif + + /* This should be the last function in the file, to avoid compile errors. */ + void +-cddbd_log(unsigned int flags, char *fmt, void *a1, void *a2, void *a3, +- void *a4, void *a5, void *a6) ++cddbd_log(unsigned int flags, const char *fmt, ...) + { + FILE *fp; + char buf[CDDBBUFSIZ]; ++ va_list ap; + + if((!(log_flags & (short)flags) && !debug) || quiet) + return; +@@ -3455,7 +3459,9 @@ cddbd_log(unsigned int flags, char *fmt, + strip_crlf(buf); + + /* Print the log message. */ +- fprintf(fp, buf, a1, a2, a3, a4, a5, a6); ++ va_start(ap, fmt); ++ vfprintf(fp, buf, ap); ++ va_end(ap); + fputc('\n', fp); + + if(fp != stderr && fp != stdout) { diff --git a/audio/cddbd/patches/patch-ac b/audio/cddbd/patches/patch-ac index 852c6c36ba4..c1145e7b49b 100644 --- a/audio/cddbd/patches/patch-ac +++ b/audio/cddbd/patches/patch-ac @@ -1,9 +1,47 @@ -$NetBSD: patch-ac,v 1.3 2005/05/23 08:42:39 rillig Exp $ +$NetBSD: patch-ac,v 1.4 2011/08/28 22:30:17 dholland Exp $ ---- cddbd.h.orig Sun Jun 14 06:41:32 1998 -+++ cddbd.h Sun Jun 14 06:42:05 1998 -@@ -261,3 +261,3 @@ +- LP64 fixes +- fix printf follies +- don't use included custom snprintf + +--- cddbd.h.orig 1996-12-22 03:49:54.000000000 +0000 ++++ cddbd.h +@@ -26,4 +26,7 @@ static char *_cddbd_h_ident_ = "@(#)$Id: + #endif + ++#include <stddef.h> ++#include <stdint.h> ++ + + /* Preprocessor definitions. */ +@@ -260,5 +263,5 @@ typedef struct access { + int at_type; /* Field type. */ int at_flags; /* Access flags. */ - int at_def; /* Default value. */ -+ long at_def; /* Default value. */ ++ uintptr_t at_def; /* Default value. */ } access_t; + +@@ -364,4 +367,11 @@ typedef struct encode { + } encode_t; + ++#ifdef __GNUC__ ++#define PRINTFLIKE(a, b) __attribute__((__format__(__printf__, a, b))) ++#else ++#define PRINTFLIKE(a, b) ++#endif ++ ++#define cddbd_snprintf snprintf + + /* External prototypes. */ +@@ -371,10 +381,9 @@ void cddbd_build_fuzzy(void); + void cddbd_check_db(int, int); + void cddbd_lock_free(clck_t *); +-void cddbd_log(); ++void cddbd_log(unsigned, const char *fmt, ...) PRINTFLIKE(2, 3); + void cddbd_mail(void); + void cddbd_parse_args(arg_t *, int); + void cddbd_rmt_op(int, char *, char *); + void cddbd_serve(void); +-void cddbd_snprintf(); + void cddbd_stand(int); + void cddbd_unlock(clck_t *); diff --git a/audio/cddbd/patches/patch-ad b/audio/cddbd/patches/patch-ad index a3ff82c99bb..ee9336ff945 100644 --- a/audio/cddbd/patches/patch-ad +++ b/audio/cddbd/patches/patch-ad @@ -1,4 +1,6 @@ -$NetBSD: patch-ad,v 1.1 2007/08/30 14:12:38 joerg Exp $ +$NetBSD: patch-ad,v 1.2 2011/08/28 22:30:17 dholland Exp $ + +- avoid interactive configure --- config.sh.orig 2007-08-30 13:38:11.000000000 +0000 +++ config.sh diff --git a/audio/cddbd/patches/patch-db_c b/audio/cddbd/patches/patch-db_c new file mode 100644 index 00000000000..03cfc541cc7 --- /dev/null +++ b/audio/cddbd/patches/patch-db_c @@ -0,0 +1,153 @@ +$NetBSD: patch-db_c,v 1.1 2011/08/28 22:30:17 dholland Exp $ + +- needs stdlib.h instead of casting return value of malloc +- other LP64 fixes + +--- db.c.orig 2011-08-28 21:43:47.000000000 +0000 ++++ db.c +@@ -31,6 +31,8 @@ static char *_db_c_ident_ = "@(#)$Id: db + #include <errno.h> + #include <dirent.h> + #include <time.h> ++#include <stdlib.h> ++#include <string.h> + #include "list.h" + #include "cddbd.h" + #include "patchlevel.h" +@@ -109,7 +111,7 @@ list_init(void *data, int (*comp_func)(v + { + lhead_t *lh; + +- lh = (lhead_t *)malloc(sizeof(lhead_t)); ++ lh = malloc(sizeof(lhead_t)); + if(lh == 0) + return 0; + +@@ -159,9 +161,9 @@ list_find(lhead_t *lh, void *data) + else if(cmp > 0) + return 0; + } +- else if((unsigned int)lp->l_data == (unsigned int)data) ++ else if((uintptr_t)lp->l_data == (uintptr_t)data) + return lp; +- else if((unsigned int)lp->l_data > (unsigned int)data) ++ else if((uintptr_t)lp->l_data > (uintptr_t)data) + return 0; + } + +@@ -704,14 +706,14 @@ cddbd_check_db(int level, int fix) + islink = 0; + + if(sbuf.st_nlink > 1) { +- if(list_find(lh, (void *)(int)sbuf.st_ino) ++ if(list_find(lh, (void *)(uintptr_t)sbuf.st_ino) + != 0) { + links++; + islink++; + continue; + } + else if(list_add_cur(lh, +- (void *)(int)sbuf.st_ino) == 0) { ++ (void *)(uintptr_t)sbuf.st_ino) == 0) { + cddbd_log(LOG_ERR, + "Can't malloc linked list entry."); + quit(QUIT_ERR); +@@ -803,11 +805,11 @@ cddbd_check_db(int level, int fix) + post = 0; + + if(!list_find(db->db_phase[DP_DISCID], +- (void *)discid)) { ++ (void *)(uintptr_t)discid)) { + /* Add the discid to the entry. */ + if(!list_add_cur( + db->db_phase[DP_DISCID], +- (void *)discid)) { ++ (void *)(uintptr_t)discid)) { + cddbd_log(LOG_ERR, + "Can't malloc list entry"); + +@@ -857,7 +859,7 @@ cddbd_check_db(int level, int fix) + else { + /* Make sure discid is in the DB entry. */ + if(!list_find(db->db_phase[DP_DISCID], +- (void *)discid)) { ++ (void *)(uintptr_t)discid)) { + cddbd_log(LOG_ERR, + "Warning: DB entry %s missing %s", + parstab[DP_DISCID].dp_name, +@@ -1232,7 +1234,7 @@ db_read(FILE *fp, char *errstr, int flag + return 0; + } + +- if(list_find(lh, (void *)discid) != 0) { ++ if(list_find(lh, (void *)(uintptr_t)discid) != 0) { + cddbd_snprintf(errstr, CDDBBUFSIZ, + "duplicate disc ID on line %d", + line); +@@ -1241,7 +1243,7 @@ db_read(FILE *fp, char *errstr, int flag + return 0; + } + +- if(list_add_cur(lh, (void *)discid) == 0) { ++ if(list_add_cur(lh, (void *)(uintptr_t)discid) == 0) { + cddbd_snprintf(errstr, CDDBBUFSIZ, + "can't malloc list entry"); + +@@ -1642,7 +1644,7 @@ db_read(FILE *fp, char *errstr, int flag + /* Ensure the discid is in the DB entry. */ + discid = db_gen_discid(db); + +- if(list_find(db->db_phase[DP_DISCID], (void *)discid) == 0) { ++ if(list_find(db->db_phase[DP_DISCID], (void *)(uintptr_t)discid) == 0) { + cddbd_snprintf(errstr, CDDBBUFSIZ, + "disc ID generated from track offsets (%08x) not found " + "in %s", discid, parstab[DP_DISCID].dp_name); +@@ -1659,7 +1661,7 @@ db_read(FILE *fp, char *errstr, int flag + + for(; !list_rewound(lh); list_forw(lh)) { + lp = list_cur(lh); +- discid = (unsigned int)lp->l_data; ++ discid = (unsigned int)(uintptr_t)lp->l_data; + + if((discid & 0xFF) != db->db_trks) { + cddbd_snprintf(errstr, CDDBBUFSIZ, +@@ -1738,7 +1740,7 @@ db_write_num(FILE *fp, lhead_t *lh, db_p + if(!(i % n) && fputs(dp->dp_pstr, fp) == EOF) + return 0; + +- if(fprintf(fp, "%08x", (unsigned int)lp->l_data) == EOF) ++ if(fprintf(fp, "%08lx", (unsigned long)(uintptr_t)lp->l_data) == EOF) + return 0; + + if(i == (list_count(lh) - 1) || !((i + 1) % n)) +@@ -1783,7 +1785,7 @@ db_post(db_t *db, char *dir, unsigned in + cddbd_snprintf(name, sizeof(name), "%08x", discid); + + /* Make sure discid is in the DB entry. */ +- if(!list_find(db->db_phase[DP_DISCID], (void *)discid)) { ++ if(!list_find(db->db_phase[DP_DISCID], (void *)(uintptr_t)discid)) { + cddbd_snprintf(errstr, CDDBBUFSIZ, + "discid %s is not in the DB entry", name); + +@@ -2124,8 +2126,8 @@ db_unlink(char *dir, char *name) + list_forw(lh)) { + lp = list_cur(lh); + +- cddbd_snprintf(buf, sizeof(buf), "%s/%08x", +- dir, (unsigned int)lp->l_data); ++ cddbd_snprintf(buf, sizeof(buf), "%s/%08lx", ++ dir, (unsigned long)(uintptr_t)lp->l_data); + + unlink(buf); + } +@@ -2157,8 +2159,8 @@ db_link(db_t *db, char *dir, char *name, + for(list_rewind(lh), list_forw(lh); !list_rewound(lh); list_forw(lh)) { + lp = list_cur(lh); + +- cddbd_snprintf(dblink, sizeof(dblink), "%s/%08x", dir, +- (unsigned int)lp->l_data); ++ cddbd_snprintf(dblink, sizeof(dblink), "%s/%08lx", dir, ++ (unsigned long)(uintptr_t)lp->l_data); + + /* This should already exist. */ + if(!strcmp(dbname, dblink)) diff --git a/audio/cddbd/patches/patch-fuzzy_c b/audio/cddbd/patches/patch-fuzzy_c new file mode 100644 index 00000000000..7181139ac5c --- /dev/null +++ b/audio/cddbd/patches/patch-fuzzy_c @@ -0,0 +1,77 @@ +$NetBSD: patch-fuzzy_c,v 1.1 2011/08/28 22:30:17 dholland Exp $ + +- needs stdlib.h instead of casting return value of malloc +- other LP64 fixes +- add const to silence qsort type warnings + +--- fuzzy.c.orig 1996-12-22 03:49:54.000000000 +0000 ++++ fuzzy.c +@@ -34,6 +34,7 @@ static char *_fuzzy_c_ident_ = "@(#)$Id: + #include <unistd.h> + #include <dirent.h> + #include <stdio.h> ++#include <stdlib.h> + #include <time.h> + #include "access.h" + #include "list.h" +@@ -81,7 +82,7 @@ flist_t *flist; + + /* Prototypes. */ + +-int comp_fhash(void *, void *); ++int comp_fhash(const void *, const void *); + db_errno_t read_db_fuzzy(char *, fhash_t *, int *, char *, char *); + + +@@ -355,12 +356,12 @@ cddbd_build_fuzzy(void) + } + + if(sbuf.st_nlink > 1 && list_find(lh, +- (void *)(int)sbuf.st_ino) != 0) { ++ (void *)(uintptr_t)sbuf.st_ino) != 0) { + links++; + continue; + } + +- fl = (flist_t *)malloc(sizeof(flist_t)); ++ fl = malloc(sizeof(flist_t)); + if(fl == 0) { + cddbd_log(LOG_ERR | LOG_HASH, + "Can't malloc hash list entry (%d).", +@@ -409,7 +410,7 @@ cddbd_build_fuzzy(void) + } + + if(sbuf.st_nlink > 1 && +- list_add_cur(lh, (void *)(int)sbuf.st_ino) == 0) { ++ list_add_cur(lh, (void *)(uintptr_t)sbuf.st_ino) == 0) { + cddbd_log(LOG_ERR | LOG_HASH, + "Can't malloc linked list entry."); + quit(QUIT_ERR); +@@ -425,7 +426,7 @@ cddbd_build_fuzzy(void) + quit(QUIT_ERR); + } + +- ftab = (fhash_t **)malloc(sizeof(fhash_t *) * fhdr.count); ++ ftab = malloc(sizeof(fhash_t *) * fhdr.count); + if(ftab == NULL) { + cddbd_log(LOG_ERR | LOG_HASH, + "Can't malloc hash table (%d).", errno); +@@ -506,13 +507,13 @@ cddbd_build_fuzzy(void) + + + int +-comp_fhash(void *c1, void *c2) ++comp_fhash(const void *c1, const void *c2) + { +- fhash_t *h1; +- fhash_t *h2; ++ const fhash_t *h1; ++ const fhash_t *h2; + +- h1 = *(fhash_t **)c1; +- h2 = *(fhash_t **)c2; ++ h1 = *(const fhash_t **)c1; ++ h2 = *(const fhash_t **)c2; + + if(h1->trks != h2->trks) + return (h1->trks - h2->trks); diff --git a/audio/cddbd/patches/patch-xmit_c b/audio/cddbd/patches/patch-xmit_c new file mode 100644 index 00000000000..04f444e3929 --- /dev/null +++ b/audio/cddbd/patches/patch-xmit_c @@ -0,0 +1,39 @@ +$NetBSD: patch-xmit_c,v 1.1 2011/08/28 22:30:17 dholland Exp $ + +- needs stdlib.h instead of casting return value of malloc +- other LP64 fixes + +--- xmit.c~ 1996-12-22 03:49:54.000000000 +0000 ++++ xmit.c +@@ -30,6 +30,7 @@ static char *_sites_c_ident_ = "@(#)$Id: + #include <string.h> + #include <fcntl.h> + #include <stdio.h> ++#include <stdlib.h> + #include <errno.h> + #include <dirent.h> + #include <time.h> +@@ -571,12 +572,12 @@ cddbd_do_transmit(site_t *sp) + } + + /* Don't transmit the same file twice. */ +- if(list_find(li, (void *)(int)sbuf.st_ino) != 0) { ++ if(list_find(li, (void *)(uintptr_t)sbuf.st_ino) != 0) { + files--; + continue; + } + +- if(list_add_cur(li, (void *)(int)sbuf.st_ino) == 0) { ++ if(list_add_cur(li, (void *)(uintptr_t)sbuf.st_ino) == 0) { + cddbd_log(LOG_ERR, "Can't malloc linked list entry."); + + if(!cddbd_close_history()) { +@@ -1112,7 +1113,7 @@ cddbd_write_history(char *dir, unsigned + { + tfile_t *tf; + +- if((tf = (tfile_t *)malloc(sizeof(tfile_t))) == NULL) { ++ if((tf = malloc(sizeof(tfile_t))) == NULL) { + cddbd_log(LOG_ERR | LOG_XMIT, + "Can't malloc transmit list entry."); + quit(QUIT_ERR); |