pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/audio/xmp Fix a lot of horrible Spaghetti code which p...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e1139c3c3686
branches: trunk
changeset: 515292:e1139c3c3686
user: tron <tron%pkgsrc.org@localhost>
date: Fri Jun 30 12:54:37 2006 +0000
description:
Fix a lot of horrible Spaghetti code which prevented this package from
building with GCC 4.1.x. While doing this fix some of the portability
problems for big endian system.
This package needs a lot of work before it will work with either
big-endian or LP64. It should probably be removed because it seesm
to be unmaintained since 2001.
diffstat:
audio/xmp/distinfo | 6 +-
audio/xmp/patches/patch-ak | 13 +++
audio/xmp/patches/patch-al | 13 +++
audio/xmp/patches/patch-am | 155 +++++++++++++++++++++++++++++++++++++++++++
audio/xmp/patches/patch-an | 159 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 345 insertions(+), 1 deletions(-)
diffs (truncated from 373 to 300 lines):
diff -r 2fab6dc1cdbb -r e1139c3c3686 audio/xmp/distinfo
--- a/audio/xmp/distinfo Fri Jun 30 12:46:30 2006 +0000
+++ b/audio/xmp/distinfo Fri Jun 30 12:54:37 2006 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.8 2005/12/11 20:20:34 joerg Exp $
+$NetBSD: distinfo,v 1.9 2006/06/30 12:54:37 tron Exp $
SHA1 (xmp-2.0.4.tar.bz2) = 35c1578f2f6728aa2ec92f34ada050e328694167
RMD160 (xmp-2.0.4.tar.bz2) = c1c0c3af63d1f3e43fe6b47ca55725e0922fe2f1
@@ -13,3 +13,7 @@
SHA1 (patch-ah) = d6119a1d0ef33bf58bd443b2f18d72cb9ea1956a
SHA1 (patch-ai) = 7882313a892f2043a051fdc2b49161ae209824ba
SHA1 (patch-aj) = 5364b5135e8e2bd60bbf6cbcd00adac99611f2ce
+SHA1 (patch-ak) = 93a9abfc66a526d52bd62ece5b9d8cd727f816e7
+SHA1 (patch-al) = 902a0c5311f560d5bf01e3946d785bca932131d3
+SHA1 (patch-am) = 601b55de29ca76ab4671fc3470181544b5770f1a
+SHA1 (patch-an) = bd021634555751a78cc1f5af61aa83c4d1e3287f
diff -r 2fab6dc1cdbb -r e1139c3c3686 audio/xmp/patches/patch-ak
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/xmp/patches/patch-ak Fri Jun 30 12:54:37 2006 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-ak,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/drivers/file.c.orig 2000-12-29 18:08:07.000000000 +0000
++++ src/drivers/file.c 2006-06-30 11:43:38.000000000 +0100
+@@ -91,7 +91,7 @@
+ while (i) {
+ if ((j = write (audio_fd, b, i)) > 0) {
+ i -= j;
+- (char *)b += j;
++ b = (char *)b + j;
+ } else
+ break;
+ };
diff -r 2fab6dc1cdbb -r e1139c3c3686 audio/xmp/patches/patch-al
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/xmp/patches/patch-al Fri Jun 30 12:54:37 2006 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-al,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/drivers/netbsd.c.orig 2000-12-29 18:08:08.000000000 +0000
++++ src/drivers/netbsd.c 2006-06-30 12:11:46.000000000 +0100
+@@ -182,7 +182,7 @@
+ while (i) {
+ if ((j = write (audio_fd, b, i)) > 0) {
+ i -= j;
+- (char *)b += j;
++ b = (char *)b + j;
+ } else
+ break;
+ };
diff -r 2fab6dc1cdbb -r e1139c3c3686 audio/xmp/patches/patch-am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/xmp/patches/patch-am Fri Jun 30 12:54:37 2006 +0000
@@ -0,0 +1,155 @@
+$NetBSD: patch-am,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/loaders/mdl_load.c.orig 2000-12-29 18:08:33.000000000 +0000
++++ src/loaders/mdl_load.c 2006-06-30 12:57:09.000000000 +0100
+@@ -35,6 +35,35 @@
+ static struct mdl_envelope *v_env;
+ static struct mdl_envelope *p_env;
+
++static void *
++get_uint16_le(void *p, uint16_t *x16)
++{
++ uint8_t *bp;
++
++ bp = p;
++ *x16 = bp[0] | (bp[1] << 8);
++ return bp + sizeof(uint16);
++}
++
++static void *
++get_uint16_le_int(void *p, int *ip)
++{
++ uint8_t *bp;
++
++ bp = p;
++ *ip = bp[0] | (bp[1] << 8);
++ return bp + sizeof(uint16);
++}
++
++static void *
++get_uint32_le_int(void *p, int *ip)
++{
++ uint8_t *bp;
++
++ bp = p;
++ *ip = bp[0] | (bp[1] << 8) | (bp[2] << 16) | (bp[3] << 24);
++ return bp + sizeof(uint32);
++}
+
+ /* Effects 1-6 (note effects) can only be entered in the first effect
+ * column, G-L (volume-effects) only in the second column.
+@@ -130,7 +159,8 @@
+ unsigned int x;
+
+ if (i == 0) {
+- b = *((uint32 *)(*buf))++;
++ (void)memcpy(&b, *buf, sizeof(b));
++ *buf += sizeof(b);
+ n = 32;
+ return 0;
+ }
+@@ -268,8 +298,7 @@
+
+ buffer += 16; /* Skip pattern name */
+ for (j = 0; j < chn; j++) {
+- x16 = *((uint16 *)buffer)++;
+- L_ENDIAN16 (x16);
++ buffer = get_uint16_le(buffer, &x16);
+ xxp[i]->info[j].index = x16;
+ }
+ if (V (0))
+@@ -297,8 +326,7 @@
+ xxp[i]->rows = 64;
+
+ for (j = 0; j < 32; j++) {
+- x16 = *((uint16 *)buffer)++;
+- L_ENDIAN16 (x16);
++ buffer = get_uint16_le(buffer, &x16);
+ if (j < xxh->chn)
+ xxp[i]->info[j].index = x16;
+ }
+@@ -315,7 +343,8 @@
+ int i, j, k, row, len;
+ struct xxm_track *track;
+
+- xxh->trk = *((uint16 *) buffer)++ + 1;
++ buffer = get_uint16_le_int(buffer, &xxh->trk);
++ xxh->trk++;
+
+ if (V (0))
+ report ("Stored tracks : %d ", xxh->trk);
+@@ -330,7 +359,7 @@
+
+ for (i = 1; i < xxh->trk; i++) {
+ /* Length of the track in bytes */
+- len = *((uint16 *) buffer)++;
++ buffer = get_uint16_le_int(buffer, &len);
+
+ memset (track, 0, sizeof (struct xxm_track) +
+ sizeof (struct xxm_event) * 256);
+@@ -449,7 +478,7 @@
+ xxih[i].rls = *(uint16 *)buffer;
+ L_ENDIAN32 (xxih[i].rls);
+ }
+- ((uint16 *)buffer)++;
++ buffer += sizeof(uint16);
+
+ xxi[i][j].vra = *buffer++;
+ xxi[i][j].vde = *buffer++;
+@@ -498,15 +527,12 @@
+ buffer += 32; /* Sample name */
+ buffer += 8; /* Sample filename */
+
+- c2spd[i] = *((uint32 *)buffer)++;
++ (void)memcpy(&c2spd[i], buffer, sizeof(c2spd[i]));
++ buffer += sizeof(c2spd[i]);
+
+- xxs[i].len = *((uint32 *)buffer)++;
+- xxs[i].lps = *((uint32 *)buffer)++;
+- xxs[i].lpe = *((uint32 *)buffer)++;
+-
+- L_ENDIAN32 (xxs[i].len);
+- L_ENDIAN32 (xxs[i].lps);
+- L_ENDIAN32 (xxs[i].lpe);
++ buffer = get_uint32_le_int(buffer, &xxs[i].len);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lps);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lpe);
+
+ xxs[i].flg = xxs[i].lpe > 0 ? WAVE_LOOPING : 0;
+ xxs[i].lpe = xxs[i].lps + xxs[i].lpe;
+@@ -579,16 +605,11 @@
+ buffer += 32; /* Sample name */
+ buffer += 8; /* Sample filename */
+
+- c2spd[i] = *((uint16 *)buffer)++;
+- L_ENDIAN16 (c2spd[i]);
++ buffer = get_uint16_le_int(buffer, &c2spd[i]);
+
+- xxs[i].len = *((uint32 *)buffer)++;
+- xxs[i].lps = *((uint32 *)buffer)++;
+- xxs[i].lpe = *((uint32 *)buffer)++;
+-
+- L_ENDIAN32 (xxs[i].len);
+- L_ENDIAN32 (xxs[i].lps);
+- L_ENDIAN32 (xxs[i].lpe);
++ buffer = get_uint32_le_int(buffer, &xxs[i].len);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lps);
++ buffer = get_uint32_le_int(buffer, &xxs[i].lpe);
+
+ xxs[i].flg = xxs[i].lpe > 0 ? WAVE_LOOPING : 0;
+ xxs[i].lpe = xxs[i].lps + xxs[i].lpe;
+@@ -648,12 +669,12 @@
+ buffer += xxs[i].len;
+ break;
+ case 1:
+- len = *((uint32 *)buffer)++;
++ buffer = get_uint32_le_int(buffer, &len);
+ unpack_sample8 (smpbuf, buffer, xxs[i].len);
+ buffer += len;
+ break;
+ case 2:
+- len = *((uint32 *)buffer)++;
++ buffer = get_uint32_le_int(buffer, &len);
+ unpack_sample16 ((uint16 *)smpbuf, buffer, xxs[i].len >> 1);
+ buffer += len;
+ break;
diff -r 2fab6dc1cdbb -r e1139c3c3686 audio/xmp/patches/patch-an
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/xmp/patches/patch-an Fri Jun 30 12:54:37 2006 +0000
@@ -0,0 +1,159 @@
+$NetBSD: patch-an,v 1.1 2006/06/30 12:54:38 tron Exp $
+
+--- src/loaders/med_load.c.orig 2001-01-13 19:58:02.000000000 +0000
++++ src/loaders/med_load.c 2006-06-30 13:48:59.000000000 +0100
+@@ -31,6 +31,25 @@
+
+ static int bpmon, bpmlen;
+
++static void big_endian_uint16_t(void *p)
++{
++ uint16 *x16p, x16;
++
++ x16p = p;
++ x16 = *x16p;
++ B_ENDIAN16(x16);
++ *x16p = x16;
++}
++
++static void big_endian_uint32_t(void *p)
++{
++ uint32 *x32p, x32;
++
++ x32p = p;
++ x32 = *x32p;
++ B_ENDIAN32(x32);
++ *x32p = x32;
++}
+
+ static void xlat_fx (uint8 *fxt, uint8 *fxp)
+ {
+@@ -136,11 +155,11 @@
+
+ header = (struct MMD0 *)mmd;
+
+- B_ENDIAN32 ((uint32)header->modlen);
+- B_ENDIAN32 ((uint32)header->song);
+- B_ENDIAN32 ((uint32)header->blockarr);
+- B_ENDIAN32 ((uint32)header->smplarr);
+- B_ENDIAN32 ((uint32)header->expdata);
++ big_endian_uint32_t(&header->modlen);
++ big_endian_uint32_t(&header->song);
++ big_endian_uint32_t(&header->blockarr);
++ big_endian_uint32_t(&header->smplarr);
++ big_endian_uint32_t(&header->expdata);
+
+ song = (struct MMD0song *)(mmd + (uint32)header->song);
+ song2 = (struct MMD2song *)(mmd + (uint32)header->song);
+@@ -148,21 +167,21 @@
+ (uint32)header->expdata) : NULL;
+
+ if (expdata) {
+- B_ENDIAN32 ((uint32)expdata->nextmod);
+- B_ENDIAN32 ((uint32)expdata->exp_smp);
+- B_ENDIAN16 ((uint16)expdata->s_ext_entries);
+- B_ENDIAN16 ((uint16)expdata->s_ext_entrsz);
+- B_ENDIAN32 ((uint32)expdata->annotxt);
+- B_ENDIAN32 ((uint32)expdata->annolen);
+- B_ENDIAN32 ((uint32)expdata->iinfo);
+- B_ENDIAN16 ((uint16)expdata->i_ext_entries);
+- B_ENDIAN16 ((uint16)expdata->i_ext_entrsz);
+- B_ENDIAN32 ((uint32)expdata->jumpmask);
+- B_ENDIAN32 ((uint32)expdata->rgbtable);
+- B_ENDIAN32 ((uint32)expdata->n_info);
+- B_ENDIAN32 ((uint32)expdata->songname);
+- B_ENDIAN32 ((uint32)expdata->songnamelen);
+- B_ENDIAN32 ((uint32)expdata->dumps);
++ big_endian_uint32_t(&expdata->nextmod);
++ big_endian_uint32_t(&expdata->exp_smp);
++ big_endian_uint16_t(&expdata->s_ext_entries);
++ big_endian_uint16_t(&expdata->s_ext_entrsz);
++ big_endian_uint32_t(&expdata->annotxt);
++ big_endian_uint32_t(&expdata->annolen);
++ big_endian_uint32_t(&expdata->iinfo);
++ big_endian_uint16_t(&expdata->i_ext_entries);
++ big_endian_uint16_t(&expdata->i_ext_entrsz);
++ big_endian_uint32_t(&expdata->jumpmask);
++ big_endian_uint32_t(&expdata->rgbtable);
++ big_endian_uint32_t(&expdata->n_info);
++ big_endian_uint32_t(&expdata->songname);
++ big_endian_uint32_t(&expdata->songnamelen);
++ big_endian_uint32_t(&expdata->dumps);
+ }
+
+ for (i = 0; i < 63; i++) {
+@@ -198,7 +217,7 @@
+
Home |
Main Index |
Thread Index |
Old Index