summaryrefslogtreecommitdiff
path: root/audio/mpg123
diff options
context:
space:
mode:
authormartin <martin>2010-03-14 14:19:19 +0000
committermartin <martin>2010-03-14 14:19:19 +0000
commit7ed04690526bbc70fb2d7bc81f358ae33f26d03e (patch)
treed842a983d056e53fbe4e950e7ec64aabd722e1d2 /audio/mpg123
parent78073051626c40ff297d7b86bd3fb92a69a00c4b (diff)
downloadpkgsrc-7ed04690526bbc70fb2d7bc81f358ae33f26d03e.tar.gz
Update mpg123 to version 1.10.1.
Thanks to <wiz> for answering lots of stupid questions and general guidance.
Diffstat (limited to 'audio/mpg123')
-rw-r--r--audio/mpg123/Makefile41
-rw-r--r--audio/mpg123/Makefile.common129
-rw-r--r--audio/mpg123/PLIST7
-rw-r--r--audio/mpg123/buildlink3.mk12
-rw-r--r--audio/mpg123/distinfo38
-rw-r--r--audio/mpg123/options.mk41
-rw-r--r--audio/mpg123/patches/patch-aa321
-rw-r--r--audio/mpg123/patches/patch-ab23
-rw-r--r--audio/mpg123/patches/patch-ac31
-rw-r--r--audio/mpg123/patches/patch-ad95
-rw-r--r--audio/mpg123/patches/patch-ae16
-rw-r--r--audio/mpg123/patches/patch-af46
-rw-r--r--audio/mpg123/patches/patch-ag123
-rw-r--r--audio/mpg123/patches/patch-ah31
-rw-r--r--audio/mpg123/patches/patch-ai842
-rw-r--r--audio/mpg123/patches/patch-aj120
-rw-r--r--audio/mpg123/patches/patch-ak40
-rw-r--r--audio/mpg123/patches/patch-al40
-rw-r--r--audio/mpg123/patches/patch-am13
-rw-r--r--audio/mpg123/patches/patch-an19
-rw-r--r--audio/mpg123/patches/patch-ao24
-rw-r--r--audio/mpg123/patches/patch-ap13
-rw-r--r--audio/mpg123/patches/patch-aq91
-rw-r--r--audio/mpg123/patches/patch-ar26
-rw-r--r--audio/mpg123/patches/patch-as13
-rw-r--r--audio/mpg123/patches/patch-at17
-rw-r--r--audio/mpg123/patches/patch-au157
-rw-r--r--audio/mpg123/patches/patch-av29
-rw-r--r--audio/mpg123/patches/patch-aw13
29 files changed, 213 insertions, 2198 deletions
diff --git a/audio/mpg123/Makefile b/audio/mpg123/Makefile
index 6be7cdacb1e..5c9540aaa50 100644
--- a/audio/mpg123/Makefile
+++ b/audio/mpg123/Makefile
@@ -1,13 +1,40 @@
-# $NetBSD: Makefile,v 1.43 2009/05/19 22:16:08 abs Exp $
+# $NetBSD: Makefile,v 1.44 2010/03/14 14:19:19 martin Exp $
-PKGNAME= mpg123-${MPG123_VERSION}
-PKGREVISION= 9
-COMMENT= Command-line player for mpeg layer 1, 2 and 3 audio
+PKGNAME= ${DISTNAME:C/[^[:alnum:]]*//}
+COMMENT= MPEG layer 1, 2, and 3 audio player
-CONFLICTS+= mpg123-nas-[0-9]*
+PKGCONFIG_OVERRIDE+= libmpg123.pc.in
-PKG_DESTDIR_SUPPORT= user-destdir
+MPG123_SUBDIRS= src doc
+MPG123_SUBDIRS.src= output libmpg123
-PKG_OPTIONS_VAR=PKG_OPTIONS.mpg123
+MAKE_ENV+= MPG123_PROGRAM=mpg123
+MAKE_ENV+= EXTRA_INSTALL_TARGETS="install-exec-am install-data-am"
+
+MPG123_BUILDING_BASE= # empty
+
+.include "../../mk/bsd.prefs.mk"
+
+PLIST_VARS+= oss
+PLIST_VARS+= sun
+
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" \
+ || ${OPSYS} == "SunOS" || ${OPSYS} == "DragonFly"
+MPG123_DEFAULT_MODULE= sun
+PLIST.sun = yes
+.else
+MPG123_DEFAULT_MODULE= oss
+PLIST.oss = yes
+.endif
+
+# MPG123_MODULE is not finally set yet, to avoid NOT_FOR_PLATFORM triggers
.include "Makefile.common"
+
+.include "options.mk"
.include "../../mk/bsd.pkg.mk"
+
+# now we can set the default module
+MPG123_MODULE= ${MPG123_DEFAULT_MODULE}
+
+#post-extract:
+# ${RUN} cp ${FILESDIR}/debug.c ${WRKSRC}/src/libmpg123
diff --git a/audio/mpg123/Makefile.common b/audio/mpg123/Makefile.common
index 1f522cc43ac..2dfa52bb153 100644
--- a/audio/mpg123/Makefile.common
+++ b/audio/mpg123/Makefile.common
@@ -1,93 +1,46 @@
-# $NetBSD: Makefile.common,v 1.31 2009/05/19 08:59:04 wiz Exp $
+# $NetBSD: Makefile.common,v 1.32 2010/03/14 14:19:19 martin Exp $
+#
+# used by audio/mpg123-oss/Makefile
+# used by audio/mpg123-sun/Makefile
-DISTNAME= mpg123-0.59r
-MPG123_VERSION= 0.59.18
+DISTNAME= mpg123-1.10.1
+PKGNAME?= ${DISTNAME:C/[[:alnum:]]*/&-${MPG123_MODULE}/}
CATEGORIES= audio
-MASTER_SITES= http://www.mpg123.de/mpg123/ \
- http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/
-
-PATCH_SITES= ftp://ftp.kame.net/pub/kame/misc/
-PATCHFILES= mpg123-059r-v6-20000713b.diff.gz
-
-MAINTAINER?= pkgsrc-users@NetBSD.org
-HOMEPAGE= http://www.mpg123.de/
-LICENSE= mpg123-license
-
-DIST_SUBDIR= mpg123
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=mpg123/}
+EXTRACT_SUFX= .tar.bz2
+DISTINFO_FILE=${.CURDIR}/../../audio/mpg123/distinfo
+LICENSE= gnu-lgpl-v2.1
+
+MAINTAINER= martin@NetBSD.org
+HOMEPAGE= http://www.mpg123.org/
+COMMENT?= Contains the ${MPG123_MODULE} module for mpg123
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+GNU_CONFIGURE?= yes
+USE_LIBTOOL?= yes
+USE_TOOLS+= pkg-config gmake
+
+CONFIGURE_ARGS+= --enable-modules=yes
+MPG123_SUBDIRS?= src
+MPG123_SUBDIRS.src?= output
+
+CONFIGURE_ENV+= BUILD_${MPG123_MODULE:tu}=yes
+CONFIGURE_ENV+= MPG123_MODULE=${MPG123_MODULE:Q}
+MAKE_ENV+= MPG123_SUBDIRS=${MPG123_SUBDIRS:Q}
+MAKE_ENV+= MPG123_SUBDIRS.src=${MPG123_SUBDIRS.src:Q}
+
+.if !defined(MPG123_BUILDING_BASE)
+INSTALLATION_DIRS+= lib/mpg123
+LIBS+= -lmpg123
+BUILD_DIRS= src/output
PATCHDIR= ${.CURDIR}/../../audio/mpg123/patches
-FILESDIR= ${.CURDIR}/../../audio/mpg123/files
-DISTINFO_FILE= ${.CURDIR}/../../audio/mpg123/distinfo
-
-PKG_INSTALLATION_TYPES= overwrite pkgviews
-
-.include "../../mk/bsd.prefs.mk"
-
-TARGET_SUFFIX?=
-
-# PKG_OPTIONS_VAR must be set in the including Makefile
-PKG_SUPPORTED_OPTIONS= inet6 mpg123-arm-fixed64
-PKG_SUGGESTED_OPTIONS= inet6
-PKG_OPTIONS_LEGACY_VARS+= MPG123_ARM_FIXED64:mpg123-arm-fixed64
-.include "../../mk/bsd.options.mk"
-
-###
-### IPv6 support
-###
-.if !empty(PKG_OPTIONS:Minet6)
-CPPFLAGS+= -DINET6
-.endif
-
-.include "../../mk/compiler.mk"
-.if ${OPSYS} == "SunOS"
-. if !empty(PKGSRC_COMPILER:Msunpro)
-BUILD_TARGET= solaris
-. else
-BUILD_TARGET= solaris-gcc${TARGET_SUFFIX}
-. endif
-.elif ${OPSYS} == "IRIX"
-BUILD_TARGET= sgi
-.elif ${OPSYS} == "Linux"
-. if ${TARGET_SUFFIX} == "-nas"
-BUILD_TARGET= linux-nas
-. elif ${MACHINE_ARCH} == "i386"
-BUILD_TARGET= linux
-. elif ${MACHINE_ARCH} == "powerpc"
-BUILD_TARGET= linux-ppc
-. else
-BUILD_TARGET= ${LOWER_OPSYS}-${MACHINE_ARCH}
-. endif
-.elif ${OPSYS} == "NetBSD"
-. if ${MACHINE_ARCH} == "i386"
-. if ${OBJECT_FMT} == "ELF"
-BUILD_TARGET= netbsd-i386-elf${TARGET_SUFFIX}
-. else
-BUILD_TARGET= netbsd-i386${TARGET_SUFFIX}
-. endif # ELF
-. elif ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm32"
-###
-### Optionally enable 64-bit calculations to avoid glitches on ARM.
-###
-. if !empty(PKG_OPTIONS:Mmpg123-arm-fixed64)
-BUILD_TARGET= netbsd-arm-64${TARGET_SUFFIX}
-. else
-BUILD_TARGET= netbsd-arm${TARGET_SUFFIX}
-. endif
-. elif ${MACHINE_ARCH} == "m68k"
-BUILD_TARGET= netbsd-m68k${TARGET_SUFFIX}
-. else
-BUILD_TARGET= netbsd${TARGET_SUFFIX}
-. endif
-.else
-BUILD_TARGET= ${LOWER_OPSYS}${TARGET_SUFFIX}
+do-install:
+ ${LIBTOOL} --mode=install ${INSTALL_LIB} \
+ ${WRKSRC}/src/output/output_${MPG123_MODULE}.la \
+ ${DESTDIR}${PREFIX}/lib/mpg123
.endif
-MAKE_FLAGS+= PREFIX=${PREFIX:Q}
-
-pre-patch:
- ${LN} -s . ${WRKSRC}/mpg123
-
-post-patch:
- ${RM} -f ${WRKSRC}/mpg123
- ${CP} ${FILESDIR}/decode_i586_.s ${WRKSRC}
- cd ${WRKSRC} && ${MV} decode_i586.s decode_i586.s.orig; \
- ${SED} -e 's@^/@#/@g' decode_i586.s.orig > decode_i586.s
+# .include "../../devel/libltdl/convenience.mk"
+.include "../../devel/libltdl/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
diff --git a/audio/mpg123/PLIST b/audio/mpg123/PLIST
index daeb8857cd0..bad9fe10494 100644
--- a/audio/mpg123/PLIST
+++ b/audio/mpg123/PLIST
@@ -1,3 +1,8 @@
-@comment $NetBSD: PLIST,v 1.1 2001/11/01 00:17:31 zuntum Exp $
+@comment $NetBSD: PLIST,v 1.2 2010/03/14 14:19:19 martin Exp $
bin/mpg123
+include/mpg123.h
+lib/libmpg123.la
+lib/pkgconfig/libmpg123.pc
man/man1/mpg123.1
+${PLIST.sun}lib/mpg123/output_sun.la
+${PLIST.oss}lib/mpg123/output_oss.la
diff --git a/audio/mpg123/buildlink3.mk b/audio/mpg123/buildlink3.mk
new file mode 100644
index 00000000000..8dabdc1781c
--- /dev/null
+++ b/audio/mpg123/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD: buildlink3.mk,v 1.1 2010/03/14 14:19:19 martin Exp $
+
+BUILDLINK_TREE+= mpg123
+
+.if !defined(MPG123_BUILDLINK3_MK)
+MPG123_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.mpg123+= mpg123>=1.0.0
+BUILDLINK_PKGSRCDIR.mpg123?= ../../audio/mpg123
+.endif # MPG123_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -mpg123
diff --git a/audio/mpg123/distinfo b/audio/mpg123/distinfo
index df683dec9b1..d5564121fab 100644
--- a/audio/mpg123/distinfo
+++ b/audio/mpg123/distinfo
@@ -1,31 +1,9 @@
-$NetBSD: distinfo,v 1.30 2009/05/19 22:16:08 abs Exp $
+$NetBSD: distinfo,v 1.31 2010/03/14 14:19:19 martin Exp $
-SHA1 (mpg123/mpg123-0.59r.tar.gz) = c32fe242f4506d218bd19a51a4034da9fdc79493
-RMD160 (mpg123/mpg123-0.59r.tar.gz) = 17d47ca04fdcac5e2d71f95ccbd23b61b5ed8b3c
-Size (mpg123/mpg123-0.59r.tar.gz) = 159028 bytes
-SHA1 (mpg123/mpg123-059r-v6-20000713b.diff.gz) = fab11489b6a1ab79d6c29787161f1c05e492dc0b
-RMD160 (mpg123/mpg123-059r-v6-20000713b.diff.gz) = c1942566dcbaf9bd605a1544b5c390e27dc150ca
-Size (mpg123/mpg123-059r-v6-20000713b.diff.gz) = 5600 bytes
-SHA1 (patch-aa) = aef8fed351b2184db901d2832fa23554a9cc062b
-SHA1 (patch-ab) = ffc387d93f0f2832e49796c80be26e908defa3a7
-SHA1 (patch-ac) = 06a5037e27ddd4cc34e5348c09e702f9740173c5
-SHA1 (patch-ad) = e9b2b874a95a67139c7d48e74492eb64dfa815f0
-SHA1 (patch-ae) = 9ac13c978bdf498cbd5e9fa0777a51559fdb2403
-SHA1 (patch-af) = 309075bc6fd4b689b711f0ae84f2e5c829609452
-SHA1 (patch-ag) = c27b6a441573939dc23268a6937905d038d6a66b
-SHA1 (patch-ah) = e1419bc6d25360d0825041028b6b3f485bcf5f43
-SHA1 (patch-ai) = da7debed75a978d096e9f27a157635692a8cd918
-SHA1 (patch-aj) = b828a5e35a03b307d46cd07356624d19b9d56777
-SHA1 (patch-ak) = b30898cff26859eca0d23ea8cfdd461920b978a8
-SHA1 (patch-al) = 88dec640d40e6a3f1828096a4ff7b5a4dbd0a222
-SHA1 (patch-am) = 661c1f95f65145f4e08706eb3f6fe975118a2822
-SHA1 (patch-an) = 08917e1825adcfd870bb2c61ae865339da7c45ef
-SHA1 (patch-ao) = 40961a43cc3dbebf71deee1c240907896d297304
-SHA1 (patch-ap) = b35e7f6739a8b4979412793c7b3f2f7f5a9f15a7
-SHA1 (patch-aq) = 7eb736b995bf35b7ad029ea4d96bdfbaf669e689
-SHA1 (patch-ar) = e81771bf72da97d898f9320fb6c529e5a1151050
-SHA1 (patch-as) = 8765b22c556cdc217f6270f3a5e70b40b36b9229
-SHA1 (patch-at) = 9a64a62f7d1d115e3d36dbb0f08762d4b0eb1e2b
-SHA1 (patch-au) = 02c480cbb6ff8ab904be93eaf319b43f4f02d588
-SHA1 (patch-av) = 4c771cd77091af3e5ade356d7e7230ee4ae1efc0
-SHA1 (patch-aw) = ba937829caf7f3ca042dca87f5b3f83a0cf2611a
+SHA1 (mpg123-1.10.1.tar.bz2) = 81c67a63a8b698f27c80633c6f1eda179cf36f10
+RMD160 (mpg123-1.10.1.tar.bz2) = 14fdd743bf13cdb414f0b8882690ab3a2faf5a59
+Size (mpg123-1.10.1.tar.bz2) = 747089 bytes
+SHA1 (patch-aa) = 9700187dc38af7d4b7f4f3332d76556d2cb7f418
+SHA1 (patch-ad) = 7ea68b64ee8a0e58036f79558ca1484870b0335a
+SHA1 (patch-af) = ed89154abc9e4eea7934e6b11431b4b8f95d36b0
+SHA1 (patch-ah) = 86754993466714cb2208a9291b72e8e03dde19c7
diff --git a/audio/mpg123/options.mk b/audio/mpg123/options.mk
new file mode 100644
index 00000000000..0982a765368
--- /dev/null
+++ b/audio/mpg123/options.mk
@@ -0,0 +1,41 @@
+# $NetBSD: options.mk,v 1.1 2010/03/14 14:19:19 martin Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.mpg123
+PKG_OPTIONS_OPTIONAL_GROUPS= fpu
+PKG_SUPPORTED_OPTIONS= mpg123-fifo
+PKG_SUGGESTED_OPTIONS+= mpg123-fifo
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if (${MACHINE_ARCH} == "i386")
+PKG_OPTIONS_GROUP.fpu= mpg123-x86-dither mpg123-with-fpu
+PKG_SUGGESTED_OPTIONS+= mpg123-x86-dither
+.elif (${MACHINE_ARCH} == "arm") || (${MACHINE_ARCH} == "arm32")
+PKG_OPTIONS_GROUP.fpu= mpg123-with-fpu
+.elif (${MACHINE_ARCH} == "powerpc")
+PKG_OPTIONS_GROUP.fpu= mpg123-altivec mpg123-with-fpu
+PKG_SUGGESTED_OPTIONS+= mpg123-altivec
+.else
+PKG_OPTIONS_GROUP.fpu= mpg123-with-fpu
+PKG_SUGGESTED_OPTIONS+= mpg123-with-fpu
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mmpg123-with-fpu)
+CONFIGURE_ARGS+= --with-cpu=generic_fpu
+.elif !empty(PKG_OPTIONS:Mmpg123-altivec)
+CONFIGURE_ARGS+= --with-cpu=altivec
+.elif !empty(PKG_OPTIONS:Mmpg123-x86-dither)
+CONFIGURE_ARGS+= --with-cpu=x86_dither
+.elif !empty(PKG_OPTIONS:Mmpg123-altivec)
+CONFIGURE_ARGS+= --with-cpu=altivec
+.else
+CONFIGURE_ARGS+= --with-cpu=generic_nofpu
+.endif
+
+.if !empty(PKG_OPTIONS:Mmpg123-fifo)
+CONFIGURE_ARGS+= --enable-fifo=yes
+.else
+CONFIGURE_ARGS+= --enable-fifo=no
+.endif
diff --git a/audio/mpg123/patches/patch-aa b/audio/mpg123/patches/patch-aa
index 1b9c7825db1..29346faa906 100644
--- a/audio/mpg123/patches/patch-aa
+++ b/audio/mpg123/patches/patch-aa
@@ -1,316 +1,13 @@
-$NetBSD: patch-aa,v 1.28 2009/05/19 22:16:08 abs Exp $
+$NetBSD: patch-aa,v 1.29 2010/03/14 14:19:19 martin Exp $
---- Makefile.orig 2009-05-19 23:13:41.000000000 +0100
-+++ Makefile
-@@ -6,7 +6,7 @@
+--- configure.orig 2009-12-05 21:30:40.000000000 +0100
++++ configure 2010-02-05 23:01:19.000000000 +0100
+@@ -14622,7 +14622,7 @@
- PREFIX=/usr/local
- BINDIR=$(PREFIX)/bin
--MANDIR=$(PREFIX)/man
-+MANDIR=$(PREFIX)/$(PKGMANDIR)
- SECTION=1
- # Enable the below line If your plathome support IPv6
-@@ -54,6 +54,23 @@ nothing-specified:
- @echo "make aix-tk3play IBM AIX"
- @echo "make os2 IBM OS/2"
- @echo "make netbsd NetBSD"
-+ @echo "make netbsd-arm NetBSD for strongarm (32bit fixedpoint)"
-+ @echo "make netbsd-arm-64 NetBSD for strongarm (64bit fixedpoint)"
-+ @echo "make netbsd-i386 NetBSD optimized for i386"
-+ @echo "make netbsd-i386-elf NetBSD optimized for i386, ELF format"
-+ @echo "make netbsd-m68k NetBSD optimized for m68k"
-+ @echo "make netbsd-esd NetBSD with EsounD"
-+ @echo "make netbsd-arm-esd NetBSD for strongarm (32bit fixedpoint) with EsounD"
-+ @echo "make netbsd-arm-64-esd NetBSD for strongarm (64bit fixedpoint) with EsounD"
-+ @echo "make netbsd-i386-esd NetBSD optimized for i386 with EsounD"
-+ @echo "make netbsd-i386-elf-esd NetBSD optimized for i386, ELF format with EsounD"
-+ @echo "make netbsd-m68k-esd NetBSD optimized for m68k with EsounD"
-+ @echo "make netbsd-nas NetBSD with NAS"
-+ @echo "make netbsd-arm-nas NetBSD for strongarm (32bit fixedpoint) with NAS"
-+ @echo "make netbsd-arm-64-nas NetBSD for strongarm (64bit fixedpoint) with NAS"
-+ @echo "make netbsd-i386-nas NetBSD optimized for i386 with NAS"
-+ @echo "make netbsd-i386-elf-nas NetBSD optimized for i386, ELF format with NAS"
-+ @echo "make netbsd-m68k-nas NetBSD optimized for m68k with NAS"
- @echo "make bsdos BSDI BSD/OS"
- @echo "make bsdos4 BSDI BSD/OS 4.0"
- @echo "make bsdos-nas BSDI BSD/OS with NAS support"
-@@ -300,7 +317,7 @@ linux-nas:
- #CFLAGS='$(CFLAGS) -DI386_ASSEM -O2 -DREAL_IS_FLOAT -DLINUX -Wall -g'
- #CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2'
+ # The full list of supported modules to check, first come, first serve.
+-check_modules="alsa oss coreaudio sndio sun win32 os2 esd jack portaudio pulse sdl nas arts openal dummy"
++check_modules=${MPG123_MODULE}
+ # The final list.
+ output_modules=
--freebsd:
-+dragonfly freebsd:
- $(MAKE) CC=cc LDFLAGS= \
- OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
- CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
-@@ -309,11 +326,11 @@ freebsd:
- -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS' \
- mpg123-make
-
--freebsd-esd:
-+dragonfly-esd freebsd-esd:
- $(MAKE) CC=cc LDFLAGS= \
-- AUDIO_LIB='-lesd -laudiofile' \
-+ AUDIO_LIB="`esd-config --libs`" \
- OBJECTS='decode_i386.o dct64_i386.o $(GETBITS) audio_esd.o' \
-- CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
- -funroll-all-loops -ffast-math -DROT_I386 \
- -DREAD_MMAP \
- -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
-@@ -321,7 +338,7 @@ freebsd-esd:
- $(CFLAGS)' \
- mpg123-make
-
--freebsd-frontend:
-+dragonfly-frontend freebsd-frontend:
- $(MAKE) CC=cc LDFLAGS= \
- OBJECTS='decode_i386.o dct64_i386.o audio_oss.o \
- control_sajber.o control_tk3play.o' \
-@@ -398,7 +415,7 @@ solaris-x86-gcc-oss:
-
- solaris-gcc-nas:
- $(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
-- AUDIO_LIB='-L/usr/openwin/lib -laudio -lXau'\
-+ AUDIO_LIB='-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -laudio -lXt -lXau'\
- OBJECTS='decode.o dct64.o audio_nas.o' \
- CFLAGS='$(CFLAGS) -O2 -I/usr/openwin/include -Wall \
- -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
-@@ -496,18 +513,194 @@ os2:
-
- netbsd:
- $(MAKE) CC=cc LDFLAGS= \
-- OBJECTS='decode.o dct64.o audio_sun.o' \
-+ OBJECTS='decode.o dct64.o audio_sun.o term.o' \
- CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-- -funroll-all-loops -ffast-math \
-- -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
-+ -funroll-all-loops -ffast-math -DREAD_MMAP \
-+ -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD' \
- mpg123-make
-
- netbsd-i386:
- $(MAKE) CC=cc LDFLAGS= \
-- OBJECTS='decode_i386.o dct64_i386.o audio_sun.o' \
-- CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
-+ OBJECTS='decode_i386.o dct64_i386.o audio_sun.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DROT_I386 -DREAD_MMAP \
-+ -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD' \
-+ mpg123-make
-+
-+netbsd-i386-elf:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
-+ audio_sun.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DROT_I386 \
-+ -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DUSE_MMAP \
-+ -DREAD_MMAP -DNETBSD -DTERM_CONTROL' \
-+ mpg123-make
-+
-+netbsd-m68k:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ OBJECTS='decode.o dct64.o audio_sun.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-+ -ffast-math -DREAL_IS_FLOAT -DREAD_MMAP \
-+ -DUSE_MMAP -DNETBSD -DM68K_ASSEM -DTERM_CONTROL' \
-+ mpg123-make
-+
-+netbsd-arm:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ OBJECTS='decode.o dct64.o audio_sun.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
-+ -funroll-all-loops -finline-functions -ffast-math \
-+ -march=armv4 -mtune=strongarm -mcpu=strongarm \
-+ -DREAL_IS_FIXED -DUSE_MMAP -DREAD_MMAP -DTERM_CONTROL \
-+ -DNETBSD' \
-+ mpg123-make
-+
-+netbsd-arm-64:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ OBJECTS='decode.o dct64.o audio_sun.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
-+ -funroll-all-loops -finline-functions -ffast-math \
-+ -march=armv4 -mtune=strongarm110 -mcpu=strongarm110 \
-+ -DREAL_IS_FIXED_ARMV4 -DUSE_MMAP -DREAD_MMAP \
-+ -DTERM_CONTROL -DNETBSD' \
-+ mpg123-make
-+
-+netbsd-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode.o dct64.o audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DREAD_MMAP \
-+ -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD \
-+ `esd-config --cflags`' \
-+ mpg123-make
-+
-+netbsd-i386-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode_i386.o dct64_i386.o audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DROT_I386 -DREAD_MMAP \
-+ -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD \
-+ `esd-config --cflags`' \
-+ mpg123-make
-+
-+netbsd-i386-elf-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
-+ audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DROT_I386 \
-+ -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DUSE_MMAP \
-+ -DREAD_MMAP -DNETBSD -DTERM_CONTROL \
-+ `esd-config --cflags`' \
-+ mpg123-make
-+
-+netbsd-m68k-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode.o dct64.o audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-+ -ffast-math -DREAL_IS_FLOAT -DREAD_MMAP \
-+ -DUSE_MMAP -DNETBSD -DM68K_ASSEM -DTERM_CONTROL \
-+ `esd-config --cflags`' \
-+ mpg123-make
-+
-+netbsd-arm-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode.o dct64.o audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
-+ -funroll-all-loops -finline-functions -ffast-math \
-+ -march=armv4 -mtune=strongarm -mcpu=strongarm \
-+ -DREAL_IS_FIXED -DUSE_MMAP -DREAD_MMAP -DTERM_CONTROL \
-+ -DNETBSD `esd-config --cflags`' \
-+ mpg123-make
-+
-+netbsd-arm-64-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode.o dct64.o audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
-+ -funroll-all-loops -finline-functions -ffast-math \
-+ -march=armv4 -mtune=strongarm110 -mcpu=strongarm110 \
-+ -DREAL_IS_FIXED_ARMV4 -DUSE_MMAP -DREAD_MMAP \
-+ -DTERM_CONTROL -DNETBSD `esd-config --cflags`' \
-+ mpg123-make
-+
-+netbsd-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode.o dct64.o audio_nas.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DREAD_MMAP \
-+ -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD \
-+ -DNAS' \
-+ mpg123-make
-+
-+dragonfly-nas freebsd-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode_i386.o dct64_i386.o $(GETBITS) audio_nas.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DROT_I386 \
-+ -DREAD_MMAP \
-+ -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNAS' \
-+ mpg123-make
-+
-+netbsd-i386-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode_i386.o dct64_i386.o audio_nas.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DROT_I386 -DREAD_MMAP \
-+ -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL -DNETBSD \
-+ -DNAS' \
-+ mpg123-make
-+
-+netbsd-i386-elf-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
-+ audio_nas.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -fomit-frame-pointer \
- -funroll-all-loops -ffast-math -DROT_I386 \
-- -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
-+ -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DUSE_MMAP \
-+ -DREAD_MMAP -DNETBSD -DTERM_CONTROL \
-+ -DNAS' \
-+ mpg123-make
-+
-+netbsd-m68k-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode.o dct64.o audio_nas.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-+ -ffast-math -DREAL_IS_FLOAT -DREAD_MMAP \
-+ -DUSE_MMAP -DNETBSD -DM68K_ASSEM -DTERM_CONTROL \
-+ -DNAS' \
-+ mpg123-make
-+
-+netbsd-arm-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode.o dct64.o audio_nas.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
-+ -funroll-all-loops -finline-functions -ffast-math \
-+ -march=armv4 -mtune=strongarm -mcpu=strongarm \
-+ -DREAL_IS_FIXED -DUSE_MMAP -DREAD_MMAP -DTERM_CONTROL \
-+ -DNETBSD -DNAS' \
-+ mpg123-make
-+
-+netbsd-arm-64-nas:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib -laudio -L${X11BASE}/lib -Wl,-R${X11BASE}/lib -lXt -lXau" \
-+ OBJECTS='decode.o dct64.o audio_nas.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -O6 -fomit-frame-pointer \
-+ -funroll-all-loops -finline-functions -ffast-math \
-+ -march=armv4 -mtune=strongarm110 -mcpu=strongarm110 \
-+ -DREAL_IS_FIXED_ARMV4 -DUSE_MMAP -DREAD_MMAP \
-+ -DTERM_CONTROL -DNETBSD -DNAS' \
- mpg123-make
-
- bsdos:
-@@ -556,6 +749,16 @@ generic:
- CFLAGS='$(CFLAGS) -O -DGENERIC -DNOXFERMEM' \
- mpg123-make
-
-+darwin-esd:
-+ $(MAKE) CC=cc LDFLAGS= \
-+ AUDIO_LIB="`esd-config --libs`" \
-+ OBJECTS='decode.o dct64.o audio_esd.o term.o' \
-+ CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
-+ -funroll-all-loops -ffast-math -DREAD_MMAP \
-+ -DREAL_IS_FLOAT -DUSE_MMAP -DTERM_CONTROL \
-+ `esd-config --cflags`' \
-+ mpg123-make
-+
- ###########################################################################
- ###########################################################################
- ###########################################################################
-@@ -644,12 +847,12 @@ system: mpg123.h system.c
- install: prepared-for-install
- strip mpg123
- if [ -x /usr/ccs/bin/mcs ]; then /usr/ccs/bin/mcs -d mpg123; fi
-- mkdir -p $(BINDIR)
-- mkdir -p $(MANDIR)/man$(SECTION)
-- cp -f mpg123 $(BINDIR)
-- chmod 755 $(BINDIR)/mpg123
-- cp -f mpg123.1 $(MANDIR)/man$(SECTION)
-- chmod 644 $(MANDIR)/man$(SECTION)/mpg123.1
-+ mkdir -p $(DESTDIR)$(BINDIR)
-+ mkdir -p $(DESTDIR)$(MANDIR)/man$(SECTION)
-+ cp -f mpg123 $(DESTDIR)$(BINDIR)
-+ chmod 755 $(DESTDIR)$(BINDIR)/mpg123
-+ cp -f mpg123.1 $(DESTDIR)$(MANDIR)/man$(SECTION)
-+ chmod 644 $(DESTDIR)$(MANDIR)/man$(SECTION)/mpg123.1
-
- dist: clean
- DISTNAME="`basename \`pwd\``" ; \
diff --git a/audio/mpg123/patches/patch-ab b/audio/mpg123/patches/patch-ab
deleted file mode 100644
index 63585b91bee..00000000000
--- a/audio/mpg123/patches/patch-ab
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD: patch-ab,v 1.3 1999/07/18 19:23:55 tron Exp $
-
---- mpg123.c.orig Tue Jun 15 22:21:36 1999
-+++ mpg123.c Sun Jul 18 21:20:19 1999
-@@ -177,6 +177,9 @@
- _exit(0);
- default: /* parent */
- xfermem_init_writer (buffermem);
-+ if (xfermem_block(XF_WRITER, buffermem) == XF_CMD_TERMINATE) {
-+ intflag = TRUE;
-+ }
- param.outmode = DECODE_BUFFER;
- }
- }
-@@ -918,7 +921,7 @@
- {
- const char *term_type;
- term_type = getenv("TERM");
-- if (!strcmp(term_type,"xterm"))
-+ if (term_type && !strcmp(term_type,"xterm"))
- {
- fprintf(stderr, "\033]0;%s\007", filename);
- }
diff --git a/audio/mpg123/patches/patch-ac b/audio/mpg123/patches/patch-ac
deleted file mode 100644
index 42803422ad5..00000000000
--- a/audio/mpg123/patches/patch-ac
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-ac,v 1.3 1999/09/27 08:27:46 agc Exp $
-
---- audio_sun.c.orig Thu Feb 4 13:22:34 1999
-+++ audio_sun.c Mon Sep 27 09:17:00 1999
-@@ -17,6 +17,8 @@
-
- #include "mpg123.h"
-
-+extern int outburst;
-+
- #ifndef SPARCLINUX
- #include <sys/filio.h>
- #ifdef SUNOS
-@@ -78,6 +80,17 @@
- }
-
- #ifndef NETBSD
-+ AUDIO_INITINFO(&ainfo);
-+ if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) == -1)
-+ return -1;
-+#ifdef SOLARIS
-+ outburst = MAXOUTBURST;
-+#else
-+ outburst = ainfo.blocksize;
-+#endif
-+ if(outburst > MAXOUTBURST)
-+ outburst = MAXOUTBURST;
-+
- AUDIO_INITINFO(&ainfo);
-
- if(ai->output > 0)
diff --git a/audio/mpg123/patches/patch-ad b/audio/mpg123/patches/patch-ad
index 60e5bfc511d..0cca675b5f6 100644
--- a/audio/mpg123/patches/patch-ad
+++ b/audio/mpg123/patches/patch-ad
@@ -1,75 +1,22 @@
-$NetBSD: patch-ad,v 1.3 1999/10/12 04:43:12 simonb Exp $
+$NetBSD: patch-ad,v 1.4 2010/03/14 14:19:19 martin Exp $
---- dct64.c.orig Sat Sep 20 21:16:04 1997
-+++ dct64.c Thu Aug 12 23:28:33 1999
-@@ -29,7 +29,7 @@
- for(i=15;i>=0;i--)
- *bs++ = (*b1++ + *--b2);
- for(i=15;i>=0;i--)
-- *bs++ = (*--b2 - *b1++) * *--costab;
-+ *bs++ = REAL_MUL((*--b2 - *b1++), *--costab);
-
- b1 = bufs;
- costab = pnts[1]+8;
-@@ -39,13 +39,13 @@
- for(i=7;i>=0;i--)
- *bs++ = (*b1++ + *--b2);
- for(i=7;i>=0;i--)
-- *bs++ = (*--b2 - *b1++) * *--costab;
-+ *bs++ = REAL_MUL((*--b2 - *b1++), *--costab);
- b2 += 32;
- costab += 8;
- for(i=7;i>=0;i--)
- *bs++ = (*b1++ + *--b2);
- for(i=7;i>=0;i--)
-- *bs++ = (*b1++ - *--b2) * *--costab;
-+ *bs++ = REAL_MUL((*b1++ - *--b2), *--costab);
- b2 += 32;
- }
-
-@@ -58,12 +58,12 @@
- for(i=3;i>=0;i--)
- *bs++ = (*b1++ + *--b2);
- for(i=3;i>=0;i--)
-- *bs++ = (*--b2 - *b1++) * costab[i];
-+ *bs++ = REAL_MUL((*--b2 - *b1++), costab[i]);
- b2 += 16;
- for(i=3;i>=0;i--)
- *bs++ = (*b1++ + *--b2);
- for(i=3;i>=0;i--)
-- *bs++ = (*b1++ - *--b2) * costab[i];
-+ *bs++ = REAL_MUL((*b1++ - *--b2), costab[i]);
- b2 += 16;
- }
-
-@@ -75,13 +75,13 @@
- {
- *bs++ = (*b1++ + *--b2);
- *bs++ = (*b1++ + *--b2);
-- *bs++ = (*--b2 - *b1++) * costab[1];
-- *bs++ = (*--b2 - *b1++) * costab[0];
-+ *bs++ = REAL_MUL((*--b2 - *b1++), costab[1]);
-+ *bs++ = REAL_MUL((*--b2 - *b1++), costab[0]);
- b2 += 8;
- *bs++ = (*b1++ + *--b2);
- *bs++ = (*b1++ + *--b2);
-- *bs++ = (*b1++ - *--b2) * costab[1];
-- *bs++ = (*b1++ - *--b2) * costab[0];
-+ *bs++ = REAL_MUL((*b1++ - *--b2), costab[1]);
-+ *bs++ = REAL_MUL((*b1++ - *--b2), costab[0]);
- b2 += 8;
- }
- bs = bufs;
-@@ -92,10 +92,10 @@
- real v0,v1;
- v0=*b1++; v1 = *b1++;
- *bs++ = (v0 + v1);
-- *bs++ = (v0 - v1) * (*costab);
-+ *bs++ = REAL_MUL((v0 - v1), (*costab));
- v0=*b1++; v1 = *b1++;
- *bs++ = (v0 + v1);
-- *bs++ = (v1 - v0) * (*costab);
-+ *bs++ = REAL_MUL((v1 - v0), (*costab));
- }
-
- }
+--- src/output/oss.c.orig 2009-12-05 21:26:23.000000000 +0100
++++ src/output/oss.c 2010-02-06 20:09:39.000000000 +0100
+@@ -167,7 +167,7 @@
+ if(!ao) return -1;
+
+ if(!ao->device) {
+- ao->device = "/dev/dsp";
++ ao->device = DEVOSSAUDIO;
+ usingdefdev = 1;
+ }
+
+@@ -176,7 +176,7 @@
+ if(ao->fn < 0)
+ {
+ if(usingdefdev) {
+- ao->device = "/dev/sound/dsp";
++ ao->device = DEVOSSSOUND;
+ ao->fn = open(ao->device,O_WRONLY);
+ if(ao->fn < 0) {
+ if(!AOQUIET) error("Can't open default sound device!");
diff --git a/audio/mpg123/patches/patch-ae b/audio/mpg123/patches/patch-ae
deleted file mode 100644
index b7b340d3663..00000000000
--- a/audio/mpg123/patches/patch-ae
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-ae,v 1.5 1999/10/12 04:43:13 simonb Exp $
-
---- dct64_i486.c.orig Thu Nov 19 21:42:36 1998
-+++ dct64_i486.c Mon Aug 16 01:49:16 1999
-@@ -47,7 +47,11 @@
- #define SETOUT(out,n,expr) out[FIR_BUFFER_SIZE*(n)]=(expr)
- #define MUL(a,b) (((a)*(b)) >> 15)
- #define MULL(a,b) (((long long)(a)*(long long)(b)) >> 15)
-+#ifdef REAL_IS_FIXED
-+#define TOINT(a) ((a) * 32768 / (int)REAL_FACTOR)
-+#else
- #define TOINT(a) ((int)((a)*32768.0))
-+#endif
-
- void dct64_1_486(int *out0,int *out1,int *b1,int *b2)
- {
diff --git a/audio/mpg123/patches/patch-af b/audio/mpg123/patches/patch-af
index e0beaa74d3b..eed3fc7ba0b 100644
--- a/audio/mpg123/patches/patch-af
+++ b/audio/mpg123/patches/patch-af
@@ -1,19 +1,33 @@
-$NetBSD: patch-af,v 1.1 1999/04/08 07:35:56 tron Exp $
+$NetBSD: patch-af,v 1.2 2010/03/14 14:19:19 martin Exp $
---- audio.c.orig Mon Nov 23 08:16:24 1998
-+++ audio.c Wed Apr 7 16:23:29 1999
-@@ -81,10 +81,14 @@
- k1 = NUM_RATES;
- }
+--- src/xfermem.c.orig 2009-12-05 21:26:24.000000000 +0100
++++ src/xfermem.c 2010-02-06 20:14:14.000000000 +0100
+@@ -37,6 +37,13 @@
-+#ifndef NETBSD
- if(audio_open(&ai1) < 0) {
- perror("audio");
- exit(1);
- }
-+#else
-+ audio_open(&ai1);
+ #ifdef HAVE_MMAP
+ # ifdef MAP_ANON
++
++#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
++ if(madvise((void *)xf, (regsize - sizeof(txfermem)),
++ MADV_SEQUENTIAL) < 0)
++ fprintf(stderr,"madvise failed, continuing anyway...\n");
+#endif
-
- for(i=0;i<NUM_CHANNELS;i++) {
- for(j=0;j<NUM_RATES;j++) {
++
+ if ((*xf = (txfermem *) mmap(0, regsize, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_SHARED, -1, 0)) == (txfermem *) -1) {
+ perror ("mmap()");
+@@ -92,7 +99,13 @@
+ if(!xf)
+ return;
+ #ifdef HAVE_MMAP
+- munmap ((caddr_t) xf, xf->size + xf->metasize + sizeof(txfermem));
++ munmap ((void *) xf, xf->size + xf->metasize + sizeof(txfermem));
++
++#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
++ if(madvise((void *)xf, (xf->size + xf->metasize), MADV_FREE) < 0)
++ fprintf(stderr,"madvise failed, continuing anyways..\n");
++#endif
++
+ #else
+ if (shmdt((void *) xf) == -1) {
+ perror ("shmdt()");
diff --git a/audio/mpg123/patches/patch-ag b/audio/mpg123/patches/patch-ag
deleted file mode 100644
index fc0ebd58545..00000000000
--- a/audio/mpg123/patches/patch-ag
+++ /dev/null
@@ -1,123 +0,0 @@
-$NetBSD: patch-ag,v 1.3 1999/10/12 04:43:13 simonb Exp $
-
---- decode.c.orig Tue Jan 26 23:47:05 1999
-+++ decode.c Tue Oct 12 01:19:18 1999
-@@ -13,9 +13,9 @@
- #include "mpg123.h"
-
- #define WRITE_SAMPLE(samples,sum,clip) \
-- if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \
-- else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \
-- else { *(samples) = sum; }
-+ if( (sum) > REAL_PLUS_32767) { *(samples) = 0x7fff; (clip)++; } \
-+ else if( (sum) < REAL_MINUS_32768) { *(samples) = -0x8000; (clip)++; } \
-+ else { *(samples) = REAL_TO_SHORT(sum); }
-
- int synth_1to1_8bit(real *bandPtr,int channel,unsigned char *samples,int *pnt)
- {
-@@ -156,36 +156,36 @@
- for (j=16;j;j--,window+=0x10,samples+=step)
- {
- real sum;
-- sum = *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-- sum += *window++ * *b0++;
-- sum -= *window++ * *b0++;
-+ sum = REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-+ sum += REAL_MUL(*window++, *b0++);
-+ sum -= REAL_MUL(*window++, *b0++);
-
- WRITE_SAMPLE(samples,sum,clip);
- }
-
- {
- real sum;
-- sum = window[0x0] * b0[0x0];
-- sum += window[0x2] * b0[0x2];
-- sum += window[0x4] * b0[0x4];
-- sum += window[0x6] * b0[0x6];
-- sum += window[0x8] * b0[0x8];
-- sum += window[0xA] * b0[0xA];
-- sum += window[0xC] * b0[0xC];
-- sum += window[0xE] * b0[0xE];
-+ sum = REAL_MUL(window[0x0], b0[0x0]);
-+ sum += REAL_MUL(window[0x2], b0[0x2]);
-+ sum += REAL_MUL(window[0x4], b0[0x4]);
-+ sum += REAL_MUL(window[0x6], b0[0x6]);
-+ sum += REAL_MUL(window[0x8], b0[0x8]);
-+ sum += REAL_MUL(window[0xA], b0[0xA]);
-+ sum += REAL_MUL(window[0xC], b0[0xC]);
-+ sum += REAL_MUL(window[0xE], b0[0xE]);
- WRITE_SAMPLE(samples,sum,clip);
- b0-=0x10,window-=0x20,samples+=step;
- }
-@@ -194,22 +194,22 @@
- for (j=15;j;j--,b0-=0x20,window-=0x10,samples+=step)
- {
- real sum;
-- sum = -*(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-- sum -= *(--window) * *b0++;
-+ sum = -REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-+ sum -= REAL_MUL(*(--window), *b0++);
-
- WRITE_SAMPLE(samples,sum,clip);
- }
-@@ -219,5 +219,3 @@
-
- return clip;
- }
--
--
diff --git a/audio/mpg123/patches/patch-ah b/audio/mpg123/patches/patch-ah
index 755dc0f59f4..efe1ae93b7e 100644
--- a/audio/mpg123/patches/patch-ah
+++ b/audio/mpg123/patches/patch-ah
@@ -1,22 +1,13 @@
-$NetBSD: patch-ah,v 1.3 1999/10/12 04:43:14 simonb Exp $
+$NetBSD: patch-ah,v 1.4 2010/03/14 14:19:19 martin Exp $
---- equalizer.c.orig Tue Feb 2 03:47:35 1999
-+++ equalizer.c Mon Aug 16 02:08:31 1999
-@@ -13,7 +13,7 @@
-
- if(equalfile) {
- for(i=0;i<32;i++)
-- bandPtr[i] *= equalizer[channel][i];
-+ bandPtr[i] = REAL_MUL(bandPtr[i], equalizer[channel][i]);
- }
-
- /* if(param.equalizer & 0x2) {
-@@ -28,7 +28,7 @@
- {
- int i;
- for(i=0;i<576;i++) {
-- bandPtr[i] *= equalizerband[channel][i];
-+ bandPtr[i] = REAL_MUL(bandPtr[i], equalizerband[channel][i]);
- }
- }
+--- src/term.c.orig 2009-12-05 21:26:24.000000000 +0100
++++ src/term.c 2010-02-06 20:20:54.000000000 +0100
+@@ -217,7 +217,7 @@
+ while(n > 0) {
+ fd_set r;
+ struct timeval t;
+- char val;
++ unsigned char val;
+ t.tv_sec=0;
+ t.tv_usec=(do_delay) ? 10*1000 : 0;
diff --git a/audio/mpg123/patches/patch-ai b/audio/mpg123/patches/patch-ai
deleted file mode 100644
index 00c2d51b813..00000000000
--- a/audio/mpg123/patches/patch-ai
+++ /dev/null
@@ -1,842 +0,0 @@
-$NetBSD: patch-ai,v 1.5 2008/08/20 22:17:30 martin Exp $
-
---- layer3.c.orig 1999-04-21 17:25:18.000000000 +0200
-+++ layer3.c 2008-08-20 15:48:42.000000000 +0200
-@@ -109,54 +109,54 @@
- int i,j,k,l;
-
- for(i=-256;i<118+4;i++)
-- gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) );
-+ gainpow2[i+256] = DOUBLE_TO_REAL(pow((double)2.0,-0.25 * (double) (i+210) ));
-
- for(i=0;i<8207;i++)
-- ispow[i] = pow((double)i,(double)4.0/3.0);
-+ ispow[i] = DOUBLE_TO_REAL(pow((double)i,(double)4.0/3.0));
-
- for (i=0;i<8;i++) {
- static double Ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037};
- double sq=sqrt(1.0+Ci[i]*Ci[i]);
-- aa_cs[i] = 1.0/sq;
-- aa_ca[i] = Ci[i]/sq;
-+ aa_cs[i] = DOUBLE_TO_REAL(1.0/sq);
-+ aa_ca[i] = DOUBLE_TO_REAL(Ci[i]/sq);
- }
-
- for(i=0;i<18;i++) {
-- win[0][i] = win[1][i] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 );
-- win[0][i+18] = win[3][i+18] = 0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 );
-+ win[0][i] = win[1][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 72.0 * (double) (2*(i+0) +1) ) / cos ( M_PI * (double) (2*(i+0) +19) / 72.0 ));
-+ win[0][i+18] = win[3][i+18] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 72.0 * (double) (2*(i+18)+1) ) / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ));
- }
- for(i=0;i<6;i++) {
-- win[1][i+18] = 0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 );
-- win[3][i+12] = 0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 );
-- win[1][i+24] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 );
-- win[1][i+30] = win[3][i] = 0.0;
-- win[3][i+6 ] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 );
-+ win[1][i+18] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ));
-+ win[3][i+12] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 ));
-+ win[1][i+24] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 ));
-+ win[1][i+30] = win[3][i] = DOUBLE_TO_REAL(0.0);
-+ win[3][i+6 ] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 ));
- }
-
- for(i=0;i<9;i++)
-- COS9[i] = cos( M_PI / 18.0 * (double) i);
-+ COS9[i] = DOUBLE_TO_REAL(cos( M_PI / 18.0 * (double) i));
-
- for(i=0;i<9;i++)
-- tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 );
-+ tfcos36[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 ));
- for(i=0;i<3;i++)
-- tfcos12[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 );
-+ tfcos12[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 ));
-
-- COS6_1 = cos( M_PI / 6.0 * (double) 1);
-- COS6_2 = cos( M_PI / 6.0 * (double) 2);
-+ COS6_1 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 1));
-+ COS6_2 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 2));
-
- #ifdef NEW_DCT9
-- cos9[0] = cos(1.0*M_PI/9.0);
-- cos9[1] = cos(5.0*M_PI/9.0);
-- cos9[2] = cos(7.0*M_PI/9.0);
-- cos18[0] = cos(1.0*M_PI/18.0);
-- cos18[1] = cos(11.0*M_PI/18.0);
-- cos18[2] = cos(13.0*M_PI/18.0);
-+ cos9[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/9.0));
-+ cos9[1] = DOUBLE_TO_REAL(cos(5.0*M_PI/9.0));
-+ cos9[2] = DOUBLE_TO_REAL(cos(7.0*M_PI/9.0));
-+ cos18[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/18.0));
-+ cos18[1] = DOUBLE_TO_REAL(cos(11.0*M_PI/18.0));
-+ cos18[2] = DOUBLE_TO_REAL(cos(13.0*M_PI/18.0));
- #endif
-
- for(i=0;i<12;i++) {
-- win[2][i] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 );
-+ win[2][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 ));
- for(j=0;j<6;j++)
-- COS1[i][j] = cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) );
-+ COS1[i][j] = DOUBLE_TO_REAL(cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) ));
- }
-
- for(j=0;j<4;j++) {
-@@ -169,10 +169,10 @@
-
- for(i=0;i<16;i++) {
- double t = tan( (double) i * M_PI / 12.0 );
-- tan1_1[i] = t / (1.0+t);
-- tan2_1[i] = 1.0 / (1.0 + t);
-- tan1_2[i] = M_SQRT2 * t / (1.0+t);
-- tan2_2[i] = M_SQRT2 / (1.0 + t);
-+ tan1_1[i] = DOUBLE_TO_REAL(t / (1.0+t));
-+ tan2_1[i] = DOUBLE_TO_REAL(1.0 / (1.0 + t));
-+ tan1_2[i] = DOUBLE_TO_REAL(M_SQRT2 * t / (1.0+t));
-+ tan2_2[i] = DOUBLE_TO_REAL(M_SQRT2 / (1.0 + t));
-
- for(j=0;j<2;j++) {
- double base = pow(2.0,-0.25*(j+1.0));
-@@ -183,10 +183,10 @@
- else
- p2 = pow(base,i*0.5);
- }
-- pow1_1[j][i] = p1;
-- pow2_1[j][i] = p2;
-- pow1_2[j][i] = M_SQRT2 * p1;
-- pow2_2[j][i] = M_SQRT2 * p2;
-+ pow1_1[j][i] = DOUBLE_TO_REAL(p1);
-+ pow2_1[j][i] = DOUBLE_TO_REAL(p2);
-+ pow1_2[j][i] = DOUBLE_TO_REAL(M_SQRT2 * p1);
-+ pow2_2[j][i] = DOUBLE_TO_REAL(M_SQRT2 * p2);
- }
- }
-
-@@ -354,7 +354,7 @@
-
- if(gr_info->block_type == 0) {
- fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n");
-- exit(1);
-+ return;
- }
-
- /* region_count/start parameters are implicit in this case. */
-@@ -434,7 +434,7 @@
-
- if(gr_info->block_type == 0) {
- fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n");
-- exit(1);
-+ return;
- }
- /* region_count/start parameters are implicit in this case. */
- /* check this again! */
-@@ -608,7 +608,7 @@
- * Dequantize samples (includes huffman decoding)
- */
- /* 24 is enough because tab13 has max. a 19 bit huffvector */
--#define BITSHIFT ((sizeof(long)-1)*8)
-+#define BITSHIFT ((sizeof(int)-1)*8)
- #define REFRESH_MASK \
- while(num < BITSHIFT) { \
- mask |= getbyte()<<(BITSHIFT-num); \
-@@ -625,7 +625,7 @@
- int *me;
-
- int num=getbitoffset();
-- long mask = (long) getbits(num)<<(BITSHIFT+8-num);
-+ int mask = (int) getbits(num)<<(BITSHIFT+8-num);
- part2remain -= num;
-
- {
-@@ -709,50 +709,50 @@
- if(x == 15 && h->linbits) {
- max[lwin] = cb;
- REFRESH_MASK;
-- x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+ x += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
- num -= h->linbits+1;
- mask <<= h->linbits;
- if(mask < 0)
-- *xrpnt = -ispow[x] * v;
-+ *xrpnt = REAL_MUL(-ispow[x], v);
- else
-- *xrpnt = ispow[x] * v;
-+ *xrpnt = REAL_MUL(ispow[x], v);
- mask <<= 1;
- }
- else if(x) {
- max[lwin] = cb;
- if(mask < 0)
-- *xrpnt = -ispow[x] * v;
-+ *xrpnt = REAL_MUL(-ispow[x], v);
- else
-- *xrpnt = ispow[x] * v;
-+ *xrpnt = REAL_MUL(ispow[x], v);
- num--;
- mask <<= 1;
- }
- else
-- *xrpnt = 0.0;
-+ *xrpnt = DOUBLE_TO_REAL(0.0);
- xrpnt += step;
- if(y == 15 && h->linbits) {
- max[lwin] = cb;
- REFRESH_MASK;
-- y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+ y += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
- num -= h->linbits+1;
- mask <<= h->linbits;
- if(mask < 0)
-- *xrpnt = -ispow[y] * v;
-+ *xrpnt = REAL_MUL(-ispow[y], v);
- else
-- *xrpnt = ispow[y] * v;
-+ *xrpnt = REAL_MUL(ispow[y], v);
- mask <<= 1;
- }
- else if(y) {
- max[lwin] = cb;
- if(mask < 0)
-- *xrpnt = -ispow[y] * v;
-+ *xrpnt = REAL_MUL(-ispow[y], v);
- else
-- *xrpnt = ispow[y] * v;
-+ *xrpnt = REAL_MUL(ispow[y], v);
- num--;
- mask <<= 1;
- }
- else
-- *xrpnt = 0.0;
-+ *xrpnt = DOUBLE_TO_REAL(0.0);
- xrpnt += step;
- }
- }
-@@ -804,7 +804,7 @@
- mask <<= 1;
- }
- else
-- *xrpnt = 0.0;
-+ *xrpnt = DOUBLE_TO_REAL(0.0);
- xrpnt += step;
- }
- }
-@@ -812,8 +812,8 @@
- if(lwin < 3) { /* short band? */
- while(1) {
- for(;mc > 0;mc--) {
-- *xrpnt = 0.0; xrpnt += 3; /* short band -> step=3 */
-- *xrpnt = 0.0; xrpnt += 3;
-+ *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; /* short band -> step=3 */
-+ *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3;
- }
- if(m >= me)
- break;
-@@ -883,50 +883,50 @@
- if (x == 15 && h->linbits) {
- max = cb;
- REFRESH_MASK;
-- x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+ x += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
- num -= h->linbits+1;
- mask <<= h->linbits;
- if(mask < 0)
-- *xrpnt++ = -ispow[x] * v;
-+ *xrpnt++ = REAL_MUL(-ispow[x], v);
- else
-- *xrpnt++ = ispow[x] * v;
-+ *xrpnt++ = REAL_MUL(ispow[x], v);
- mask <<= 1;
- }
- else if(x) {
- max = cb;
- if(mask < 0)
-- *xrpnt++ = -ispow[x] * v;
-+ *xrpnt++ = REAL_MUL(-ispow[x], v);
- else
-- *xrpnt++ = ispow[x] * v;
-+ *xrpnt++ = REAL_MUL(ispow[x], v);
- num--;
- mask <<= 1;
- }
- else
-- *xrpnt++ = 0.0;
-+ *xrpnt++ = DOUBLE_TO_REAL(0.0);
-
- if (y == 15 && h->linbits) {
- max = cb;
- REFRESH_MASK;
-- y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+ y += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
- num -= h->linbits+1;
- mask <<= h->linbits;
- if(mask < 0)
-- *xrpnt++ = -ispow[y] * v;
-+ *xrpnt++ = REAL_MUL(-ispow[y], v);
- else
-- *xrpnt++ = ispow[y] * v;
-+ *xrpnt++ = REAL_MUL(ispow[y], v);
- mask <<= 1;
- }
- else if(y) {
- max = cb;
- if(mask < 0)
-- *xrpnt++ = -ispow[y] * v;
-+ *xrpnt++ = REAL_MUL(-ispow[y], v);
- else
-- *xrpnt++ = ispow[y] * v;
-+ *xrpnt++ = REAL_MUL(ispow[y], v);
- num--;
- mask <<= 1;
- }
- else
-- *xrpnt++ = 0.0;
-+ *xrpnt++ = DOUBLE_TO_REAL(0.0);
- }
- }
-
-@@ -974,7 +974,7 @@
- mask <<= 1;
- }
- else
-- *xrpnt++ = 0.0;
-+ *xrpnt++ = DOUBLE_TO_REAL(0.0);
- }
- }
-
-@@ -987,7 +987,7 @@
- num = 0;
-
- while(xrpnt < &xr[SBLIMIT][0])
-- *xrpnt++ = 0.0;
-+ *xrpnt++ = DOUBLE_TO_REAL(0.0);
-
- while( part2remain > 16 ) {
- getbits(16); /* Dismiss stuffing Bits */
-@@ -1065,8 +1065,8 @@
- t1 = tab1[is_p]; t2 = tab2[is_p];
- for (; sb > 0; sb--,idx+=3) {
- real v = xr[0][idx];
-- xr[0][idx] = v * t1;
-- xr[1][idx] = v * t2;
-+ xr[0][idx] = REAL_MUL(v, t1);
-+ xr[1][idx] = REAL_MUL(v, t2);
- }
- }
- }
-@@ -1087,8 +1087,8 @@
- t1 = tab1[is_p]; t2 = tab2[is_p];
- for ( ; sb > 0; sb--,idx+=3 ) {
- real v = xr[0][idx];
-- xr[0][idx] = v * t1;
-- xr[1][idx] = v * t2;
-+ xr[0][idx] = REAL_MUL(v, t1);
-+ xr[1][idx] = REAL_MUL(v, t2);
- }
- }
- } /* end for(lwin; .. ; . ) */
-@@ -1108,8 +1108,8 @@
- t1 = tab1[is_p]; t2 = tab2[is_p];
- for ( ; sb > 0; sb--,idx++) {
- real v = xr[0][idx];
-- xr[0][idx] = v * t1;
-- xr[1][idx] = v * t2;
-+ xr[0][idx] = REAL_MUL(v, t1);
-+ xr[1][idx] = REAL_MUL(v, t2);
- }
- }
- else
-@@ -1119,7 +1119,10 @@
- }
- else { /* ((gr_info->block_type != 2)) */
- int sfb = gr_info->maxbandl;
-- int is_p,idx = bi->longIdx[sfb];
-+ int is_p,idx;
-+ if (sfb > 21)
-+ return;
-+ idx = bi->longIdx[sfb];
- for ( ; sfb<21; sfb++) {
- int sb = bi->longDiff[sfb];
- is_p = scalefac[sfb]; /* scale: 0-15 */
-@@ -1128,8 +1131,8 @@
- t1 = tab1[is_p]; t2 = tab2[is_p];
- for ( ; sb > 0; sb--,idx++) {
- real v = xr[0][idx];
-- xr[0][idx] = v * t1;
-- xr[1][idx] = v * t2;
-+ xr[0][idx] = REAL_MUL(v, t1);
-+ xr[1][idx] = REAL_MUL(v, t2);
- }
- }
- else
-@@ -1143,8 +1146,8 @@
-
- for ( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) {
- real v = xr[0][idx];
-- xr[0][idx] = v * t1;
-- xr[1][idx] = v * t2;
-+ xr[0][idx] = REAL_MUL(v, t1);
-+ xr[1][idx] = REAL_MUL(v, t2);
- }
- }
- } /* ... */
-@@ -1177,8 +1180,8 @@
- for(ss=7;ss>=0;ss--)
- { /* upper and lower butterfly inputs */
- register real bu = *--xr2,bd = *xr1;
-- *xr2 = (bu * (*cs) ) - (bd * (*ca) );
-- *xr1++ = (bd * (*cs++) ) + (bu * (*ca++) );
-+ *xr2 = REAL_MUL(bu, *cs) - REAL_MUL(bd, *ca);
-+ *xr1++ = REAL_MUL(bd, *cs++) + REAL_MUL(bu, *ca++);
- }
- }
- }
-@@ -1252,8 +1255,8 @@
- {
- real t0, t1, t2;
-
-- t0 = COS6_2 * (in[8] + in[16] - in[4]);
-- t1 = COS6_2 * in[12];
-+ t0 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4]));
-+ t1 = REAL_MUL(COS6_2, in[12]);
-
- t3 = in[0];
- t2 = t3 - t1 - t1;
-@@ -1261,16 +1264,16 @@
- tmp[4] = t2 + t0 + t0;
- t3 += t1;
-
-- t2 = COS6_1 * (in[10] + in[14] - in[2]);
-+ t2 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2]));
- tmp[1] -= t2;
- tmp[7] += t2;
- }
- {
- real t0, t1, t2;
-
-- t0 = cos9[0] * (in[4] + in[8] );
-- t1 = cos9[1] * (in[8] - in[16]);
-- t2 = cos9[2] * (in[4] + in[16]);
-+ t0 = REAL_MUL(cos9[0], (in[4] + in[8] ));
-+ t1 = REAL_MUL(cos9[1], (in[8] - in[16]));
-+ t2 = REAL_MUL(cos9[2], (in[4] + in[16]));
-
- tmp[2] = tmp[6] = t3 - t0 - t2;
- tmp[0] = tmp[8] = t3 + t0 + t1;
-@@ -1280,9 +1283,9 @@
- {
- real t1, t2, t3;
-
-- t1 = cos18[0] * (in[2] + in[10]);
-- t2 = cos18[1] * (in[10] - in[14]);
-- t3 = COS6_1 * in[6];
-+ t1 = REAL_MUL(cos18[0], (in[2] + in[10]));
-+ t2 = REAL_MUL(cos18[1], (in[10] - in[14]));
-+ t3 = REAL_MUL(COS6_1, in[6]);
-
- {
- real t0 = t1 + t2 + t3;
-@@ -1293,7 +1296,7 @@
- t2 -= t3;
- t1 -= t3;
-
-- t3 = cos18[2] * (in[2] + in[14]);
-+ t3 = REAL_MUL(cos18[2], (in[2] + in[14]));
-
- t1 += t3;
- tmp[3] += t1;
-@@ -1308,35 +1311,35 @@
- {
- real t0, t1, t2, t3, t4, t5, t6, t7;
-
-- t1 = COS6_2 * in[12];
-- t2 = COS6_2 * (in[8] + in[16] - in[4]);
-+ t1 = REAL_MUL(COS6_2, in[12]);
-+ t2 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4]));
-
- t3 = in[0] + t1;
- t4 = in[0] - t1 - t1;
- t5 = t4 - t2;
- tmp[4] = t4 + t2 + t2;
-
-- t0 = cos9[0] * (in[4] + in[8]);
-- t1 = cos9[1] * (in[8] - in[16]);
-+ t0 = REAL_MUL(cos9[0], (in[4] + in[8]));
-+ t1 = REAL_MUL(cos9[1], (in[8] - in[16]));
-
-- t2 = cos9[2] * (in[4] + in[16]);
-+ t2 = REAL_MUL(cos9[2], (in[4] + in[16]));
-
- t6 = t3 - t0 - t2;
- t0 += t3 + t1;
- t3 += t2 - t1;
-
-- t2 = cos18[0] * (in[2] + in[10]);
-- t4 = cos18[1] * (in[10] - in[14]);
-- t7 = COS6_1 * in[6];
-+ t2 = REAL_MUL(cos18[0], (in[2] + in[10]));
-+ t4 = REAL_MUL(cos18[1], (in[10] - in[14]));
-+ t7 = REAL_MUL(COS6_1, in[6]);
-
- t1 = t2 + t4 + t7;
- tmp[0] = t0 + t1;
- tmp[8] = t0 - t1;
-- t1 = cos18[2] * (in[2] + in[14]);
-+ t1 = REAL_MUL(cos18[2], (in[2] + in[14]));
- t2 += t1 - t7;
-
- tmp[3] = t3 + t2;
-- t0 = COS6_1 * (in[10] + in[14] - in[2]);
-+ t0 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2]));
- tmp[5] = t3 - t2;
-
- t4 -= t1 + t7;
-@@ -1351,53 +1354,53 @@
- {
- real t0, t1, t2, t3, t4, t5, t6, t7;
-
-- t1 = COS6_2 * in[13];
-- t2 = COS6_2 * (in[9] + in[17] - in[5]);
-+ t1 = REAL_MUL(COS6_2, in[13]);
-+ t2 = REAL_MUL(COS6_2, (in[9] + in[17] - in[5]));
-
- t3 = in[1] + t1;
- t4 = in[1] - t1 - t1;
- t5 = t4 - t2;
-
-- t0 = cos9[0] * (in[5] + in[9]);
-- t1 = cos9[1] * (in[9] - in[17]);
-+ t0 = REAL_MUL(cos9[0], (in[5] + in[9]));
-+ t1 = REAL_MUL(cos9[1], (in[9] - in[17]));
-
-- tmp[13] = (t4 + t2 + t2) * tfcos36[17-13];
-- t2 = cos9[2] * (in[5] + in[17]);
-+ tmp[13] = REAL_MUL((t4 + t2 + t2), tfcos36[17-13]);
-+ t2 = REAL_MUL(cos9[2], (in[5] + in[17]));
-
- t6 = t3 - t0 - t2;
- t0 += t3 + t1;
- t3 += t2 - t1;
-
-- t2 = cos18[0] * (in[3] + in[11]);
-- t4 = cos18[1] * (in[11] - in[15]);
-- t7 = COS6_1 * in[7];
-+ t2 = REAL_MUL(cos18[0], (in[3] + in[11]));
-+ t4 = REAL_MUL(cos18[1], (in[11] - in[15]));
-+ t7 = REAL_MUL(COS6_1, in[7]);
-
- t1 = t2 + t4 + t7;
-- tmp[17] = (t0 + t1) * tfcos36[17-17];
-- tmp[9] = (t0 - t1) * tfcos36[17-9];
-- t1 = cos18[2] * (in[3] + in[15]);
-+ tmp[17] = REAL_MUL((t0 + t1), tfcos36[17-17]);
-+ tmp[9] = REAL_MUL((t0 - t1), tfcos36[17-9]);
-+ t1 = REAL_MUL(cos18[2], (in[3] + in[15]));
- t2 += t1 - t7;
-
-- tmp[14] = (t3 + t2) * tfcos36[17-14];
-- t0 = COS6_1 * (in[11] + in[15] - in[3]);
-- tmp[12] = (t3 - t2) * tfcos36[17-12];
-+ tmp[14] = REAL_MUL((t3 + t2), tfcos36[17-14]);
-+ t0 = REAL_MUL(COS6_1, (in[11] + in[15] - in[3]));
-+ tmp[12] = REAL_MUL((t3 - t2), tfcos36[17-12]);
-
- t4 -= t1 + t7;
-
-- tmp[16] = (t5 - t0) * tfcos36[17-16];
-- tmp[10] = (t5 + t0) * tfcos36[17-10];
-- tmp[15] = (t6 + t4) * tfcos36[17-15];
-- tmp[11] = (t6 - t4) * tfcos36[17-11];
-+ tmp[16] = REAL_MUL((t5 - t0), tfcos36[17-16]);
-+ tmp[10] = REAL_MUL((t5 + t0), tfcos36[17-10]);
-+ tmp[15] = REAL_MUL((t6 + t4), tfcos36[17-15]);
-+ tmp[11] = REAL_MUL((t6 - t4), tfcos36[17-11]);
- }
-
- #define MACRO(v) { \
- real tmpval; \
- tmpval = tmp[(v)] + tmp[17-(v)]; \
-- out2[9+(v)] = tmpval * w[27+(v)]; \
-- out2[8-(v)] = tmpval * w[26-(v)]; \
-+ out2[9+(v)] = REAL_MUL(tmpval, w[27+(v)]); \
-+ out2[8-(v)] = REAL_MUL(tmpval, w[26-(v)]); \
- tmpval = tmp[(v)] - tmp[17-(v)]; \
-- ts[SBLIMIT*(8-(v))] = out1[8-(v)] + tmpval * w[8-(v)]; \
-- ts[SBLIMIT*(9+(v))] = out1[9+(v)] + tmpval * w[9+(v)]; }
-+ ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(tmpval, w[8-(v)]); \
-+ ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(tmpval, w[9+(v)]); }
-
- {
- register real *out2 = o2;
-@@ -1422,20 +1425,20 @@
-
- #define MACRO0(v) { \
- real tmp; \
-- out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \
-- out2[8-(v)] = tmp * w[26-(v)]; } \
-+ out2[9+(v)] = REAL_MUL((tmp = sum0 + sum1), w[27+(v)]); \
-+ out2[8-(v)] = REAL_MUL(tmp, w[26-(v)]); } \
- sum0 -= sum1; \
-- ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \
-- ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)];
-+ ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(sum0, w[8-(v)]); \
-+ ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(sum0, w[9+(v)]);
- #define MACRO1(v) { \
- real sum0,sum1; \
- sum0 = tmp1a + tmp2a; \
-- sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \
-+ sum1 = REAL_MUL((tmp1b + tmp2b), tfcos36[(v)]); \
- MACRO0(v); }
- #define MACRO2(v) { \
- real sum0,sum1; \
- sum0 = tmp2a - tmp1a; \
-- sum1 = (tmp2b - tmp1b) * tfcos36[(v)]; \
-+ sum1 = REAL_MUL((tmp2b - tmp1b), tfcos36[(v)]); \
- MACRO0(v); }
-
- register const real *c = COS9;
-@@ -1446,17 +1449,17 @@
-
- real ta33,ta66,tb33,tb66;
-
-- ta33 = in[2*3+0] * c[3];
-- ta66 = in[2*6+0] * c[6] + in[2*0+0];
-- tb33 = in[2*3+1] * c[3];
-- tb66 = in[2*6+1] * c[6] + in[2*0+1];
-+ ta33 = REAL_MUL(in[2*3+0], c[3]);
-+ ta66 = REAL_MUL(in[2*6+0], c[6]);
-+ tb33 = REAL_MUL(in[2*3+1], c[3]);
-+ tb66 = REAL_MUL(in[2*6+1], c[6]);
-
- {
- real tmp1a,tmp2a,tmp1b,tmp2b;
-- tmp1a = in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7];
-- tmp1b = in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7];
-- tmp2a = in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8];
-- tmp2b = in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8];
-+ tmp1a = REAL_MUL(in[2*1+0], c[1]) + ta33 + REAL_MUL(in[2*5+0], c[5]) + REAL_MUL(in[2*7+0], c[7]);
-+ tmp1b = REAL_MUL(in[2*1+1], c[1]) + tb33 + REAL_MUL(in[2*5+1], c[5]) + REAL_MUL(in[2*7+1], c[7]);
-+ tmp2a = REAL_MUL(in[2*2+0], c[2]) + REAL_MUL(in[2*4+0], c[4]) + ta66 + REAL_MUL(in[2*8+0], c[8]);
-+ tmp2b = REAL_MUL(in[2*2+1], c[2]) + REAL_MUL(in[2*4+1], c[4]) + tb66 + REAL_MUL(in[2*8+1], c[8]);
-
- MACRO1(0);
- MACRO2(8);
-@@ -1464,10 +1467,10 @@
-
- {
- real tmp1a,tmp2a,tmp1b,tmp2b;
-- tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3];
-- tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3];
-- tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0];
-- tmp2b = ( in[2*2+1] - in[2*4+1] - in[2*8+1] ) * c[6] - in[2*6+1] + in[2*0+1];
-+ tmp1a = REAL_MUL(( in[2*1+0] - in[2*5+0] - in[2*7+0] ), c[3]);
-+ tmp1b = REAL_MUL(( in[2*1+1] - in[2*5+1] - in[2*7+1] ), c[3]);
-+ tmp2a = REAL_MUL(( in[2*2+0] - in[2*4+0] - in[2*8+0] ), c[6]) - in[2*6+0] + in[2*0+0];
-+ tmp2b = REAL_MUL(( in[2*2+1] - in[2*4+1] - in[2*8+1] ), c[6]) - in[2*6+1] + in[2*0+1];
-
- MACRO1(1);
- MACRO2(7);
-@@ -1475,10 +1478,10 @@
-
- {
- real tmp1a,tmp2a,tmp1b,tmp2b;
-- tmp1a = in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1];
-- tmp1b = in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1];
-- tmp2a = - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4];
-- tmp2b = - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4];
-+ tmp1a = REAL_MUL(in[2*1+0], c[5]) - ta33 - REAL_MUL(in[2*5+0], c[7]) + REAL_MUL(in[2*7+0], c[1]);
-+ tmp1b = REAL_MUL(in[2*1+1], c[5]) - tb33 - REAL_MUL(in[2*5+1], c[7]) + REAL_MUL(in[2*7+1], c[1]);
-+ tmp2a = - REAL_MUL(in[2*2+0], c[8]) - REAL_MUL(in[2*4+0], c[2]) + ta66 + REAL_MUL(in[2*8+0], c[4]);
-+ tmp2b = - REAL_MUL(in[2*2+1], c[8]) - REAL_MUL(in[2*4+1], c[2]) + tb66 + REAL_MUL(in[2*8+1], c[4]);
-
- MACRO1(2);
- MACRO2(6);
-@@ -1486,10 +1489,10 @@
-
- {
- real tmp1a,tmp2a,tmp1b,tmp2b;
-- tmp1a = in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5];
-- tmp1b = in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5];
-- tmp2a = - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2];
-- tmp2b = - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - in[2*8+1] * c[2];
-+ tmp1a = REAL_MUL(in[2*1+0], c[7]) - ta33 + REAL_MUL(in[2*5+0], c[1]) - REAL_MUL(in[2*7+0], c[5]);
-+ tmp1b = REAL_MUL(in[2*1+1], c[7]) - tb33 + REAL_MUL(in[2*5+1], c[1]) - REAL_MUL(in[2*7+1], c[5]);
-+ tmp2a = - REAL_MUL(in[2*2+0], c[4]) + REAL_MUL(in[2*4+0], c[8]) + ta66 - REAL_MUL(in[2*8+0], c[2]);
-+ tmp2b = - REAL_MUL(in[2*2+1], c[4]) + REAL_MUL(in[2*4+1], c[8]) + tb66 - REAL_MUL(in[2*8+1], c[2]);
-
- MACRO1(3);
- MACRO2(5);
-@@ -1498,7 +1501,7 @@
- {
- real sum0,sum1;
- sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0];
-- sum1 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4];
-+ sum1 = REAL_MUL((in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ), tfcos36[4]);
- MACRO0(4);
- }
- }
-@@ -1522,19 +1525,19 @@
- \
- in5 += in3; in3 += in1; \
- \
-- in2 *= COS6_1; \
-- in3 *= COS6_1; \
-+ in2 = REAL_MUL(in2, COS6_1); \
-+ in3 = REAL_MUL(in3, COS6_1); \
-
- #define DCT12_PART2 \
-- in0 += in4 * COS6_2; \
-+ in0 += REAL_MUL(in4, COS6_2); \
- \
- in4 = in0 + in2; \
- in0 -= in2; \
- \
-- in1 += in5 * COS6_2; \
-+ in1 += REAL_MUL(in5, COS6_2); \
- \
-- in5 = (in1 + in3) * tfcos12[0]; \
-- in1 = (in1 - in3) * tfcos12[2]; \
-+ in5 = REAL_MUL((in1 + in3), tfcos12[0]); \
-+ in1 = REAL_MUL((in1 - in3), tfcos12[2]); \
- \
- in3 = in4 + in5; \
- in4 -= in5; \
-@@ -1554,27 +1557,27 @@
- {
- real tmp0,tmp1 = (in0 - in4);
- {
-- real tmp2 = (in1 - in5) * tfcos12[1];
-+ real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]);
- tmp0 = tmp1 + tmp2;
- tmp1 -= tmp2;
- }
-- ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1];
-- ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1];
-- ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1];
-- ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1];
-+ ts[(17-1)*SBLIMIT] = out1[17-1] + REAL_MUL(tmp0, wi[11-1]);
-+ ts[(12+1)*SBLIMIT] = out1[12+1] + REAL_MUL(tmp0, wi[6+1]);
-+ ts[(6 +1)*SBLIMIT] = out1[6 +1] + REAL_MUL(tmp1, wi[1]);
-+ ts[(11-1)*SBLIMIT] = out1[11-1] + REAL_MUL(tmp1, wi[5-1]);
- }
-
- DCT12_PART2
-
-- ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0];
-- ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0];
-- ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2];
-- ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2];
--
-- ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0];
-- ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0];
-- ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2];
-- ts[(11-2)*SBLIMIT] = out1[11-2] + in4 * wi[5-2];
-+ ts[(17-0)*SBLIMIT] = out1[17-0] + REAL_MUL(in2, wi[11-0]);
-+ ts[(12+0)*SBLIMIT] = out1[12+0] + REAL_MUL(in2, wi[6+0]);
-+ ts[(12+2)*SBLIMIT] = out1[12+2] + REAL_MUL(in3, wi[6+2]);
-+ ts[(17-2)*SBLIMIT] = out1[17-2] + REAL_MUL(in3, wi[11-2]);
-+
-+ ts[(6 +0)*SBLIMIT] = out1[6+0] + REAL_MUL(in0, wi[0]);
-+ ts[(11-0)*SBLIMIT] = out1[11-0] + REAL_MUL(in0, wi[5-0]);
-+ ts[(6 +2)*SBLIMIT] = out1[6+2] + REAL_MUL(in4, wi[2]);
-+ ts[(11-2)*SBLIMIT] = out1[11-2] + REAL_MUL(in4, wi[5-2]);
- }
-
- in++;
-@@ -1588,27 +1591,27 @@
- {
- real tmp0,tmp1 = (in0 - in4);
- {
-- real tmp2 = (in1 - in5) * tfcos12[1];
-+ real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]);
- tmp0 = tmp1 + tmp2;
- tmp1 -= tmp2;
- }
-- out2[5-1] = tmp0 * wi[11-1];
-- out2[0+1] = tmp0 * wi[6+1];
-- ts[(12+1)*SBLIMIT] += tmp1 * wi[1];
-- ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1];
-+ out2[5-1] = REAL_MUL(tmp0, wi[11-1]);
-+ out2[0+1] = REAL_MUL(tmp0, wi[6+1]);
-+ ts[(12+1)*SBLIMIT] += REAL_MUL(tmp1, wi[1]);
-+ ts[(17-1)*SBLIMIT] += REAL_MUL(tmp1, wi[5-1]);
- }
-
- DCT12_PART2
-
-- out2[5-0] = in2 * wi[11-0];
-- out2[0+0] = in2 * wi[6+0];
-- out2[0+2] = in3 * wi[6+2];
-- out2[5-2] = in3 * wi[11-2];
--
-- ts[(12+0)*SBLIMIT] += in0 * wi[0];
-- ts[(17-0)*SBLIMIT] += in0 * wi[5-0];
-- ts[(12+2)*SBLIMIT] += in4 * wi[2];
-- ts[(17-2)*SBLIMIT] += in4 * wi[5-2];
-+ out2[5-0] = REAL_MUL(in2, wi[11-0]);
-+ out2[0+0] = REAL_MUL(in2, wi[6+0]);
-+ out2[0+2] = REAL_MUL(in3, wi[6+2]);
-+ out2[5-2] = REAL_MUL(in3, wi[11-2]);
-+
-+ ts[(12+0)*SBLIMIT] += REAL_MUL(in0, wi[0]);
-+ ts[(17-0)*SBLIMIT] += REAL_MUL(in0, wi[5-0]);
-+ ts[(12+2)*SBLIMIT] += REAL_MUL(in4, wi[2]);
-+ ts[(17-2)*SBLIMIT] += REAL_MUL(in4, wi[5-2]);
- }
-
- in++;
-@@ -1623,27 +1626,27 @@
- {
- real tmp0,tmp1 = (in0 - in4);
- {
-- real tmp2 = (in1 - in5) * tfcos12[1];
-+ real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]);
- tmp0 = tmp1 + tmp2;
- tmp1 -= tmp2;
- }
-- out2[11-1] = tmp0 * wi[11-1];
-- out2[6 +1] = tmp0 * wi[6+1];
-- out2[0+1] += tmp1 * wi[1];
-- out2[5-1] += tmp1 * wi[5-1];
-+ out2[11-1] = REAL_MUL(tmp0, wi[11-1]);
-+ out2[6 +1] = REAL_MUL(tmp0, wi[6+1]);
-+ out2[0+1] += REAL_MUL(tmp1, wi[1]);
-+ out2[5-1] += REAL_MUL(tmp1, wi[5-1]);
- }
-
- DCT12_PART2
-
-- out2[11-0] = in2 * wi[11-0];
-- out2[6 +0] = in2 * wi[6+0];
-- out2[6 +2] = in3 * wi[6+2];
-- out2[11-2] = in3 * wi[11-2];
--
-- out2[0+0] += in0 * wi[0];
-- out2[5-0] += in0 * wi[5-0];
-- out2[0+2] += in4 * wi[2];
-- out2[5-2] += in4 * wi[5-2];
-+ out2[11-0] = REAL_MUL(in2, wi[11-0]);
-+ out2[6 +0] = REAL_MUL(in2, wi[6+0]);
-+ out2[6 +2] = REAL_MUL(in3, wi[6+2]);
-+ out2[11-2] = REAL_MUL(in3, wi[11-2]);
-+
-+ out2[0+0] += REAL_MUL(in0, wi[0]);
-+ out2[5-0] += REAL_MUL(in0, wi[5-0]);
-+ out2[0+2] += REAL_MUL(in4, wi[2]);
-+ out2[5-2] += REAL_MUL(in4, wi[5-2]);
- }
- }
-
-@@ -1693,7 +1696,7 @@
- int i;
- for(i=0;i<SSLIMIT;i++) {
- tspnt[i*SBLIMIT] = *rawout1++;
-- *rawout2++ = 0.0;
-+ *rawout2++ = DOUBLE_TO_REAL(0.0);
- }
- }
- }
-@@ -1865,5 +1868,3 @@
-
- return clip;
- }
--
--
diff --git a/audio/mpg123/patches/patch-aj b/audio/mpg123/patches/patch-aj
deleted file mode 100644
index 15eb00dd41c..00000000000
--- a/audio/mpg123/patches/patch-aj
+++ /dev/null
@@ -1,120 +0,0 @@
-$NetBSD: patch-aj,v 1.2 2002/06/23 08:45:09 kent Exp $
-
---- mpg123.h.orig Fri May 28 23:51:58 1999
-+++ mpg123.h
-@@ -56,8 +56,115 @@
- # define real float
- #elif defined(REAL_IS_LONG_DOUBLE)
- # define real long double
-+#elif defined(REAL_IS_FIXED)
-+# define real long
-+
-+# define REAL_RADIX 15
-+# define REAL_FACTOR (32.0 * 1024.0)
-+
-+# define REAL_PLUS_32767 ( 32767 << REAL_RADIX )
-+# define REAL_MINUS_32768 ( -32768 << REAL_RADIX )
-+
-+# define DOUBLE_TO_REAL(x) ((int)((x) * REAL_FACTOR))
-+# define REAL_TO_SHORT(x) ((x) >> REAL_RADIX)
-+# define REAL_MUL(x, y) (((long long)(x) * (long long)(y)) >> REAL_RADIX)
-+
-+#elif defined(REAL_IS_FIXED_ARMV4)
-+# define REAL_IS_FIXED
-+# define real long long
-+
-+# define REAL_RADIX 32
-+# define REAL_FACTOR (4294967296.0)
-+
-+# define REAL_PLUS_32767 ( 32767LL << REAL_RADIX )
-+# define REAL_MINUS_32768 ( -32768LL << REAL_RADIX )
-+
-+# define DOUBLE_TO_REAL(x) ((long long)((x) * REAL_FACTOR))
-+# define REAL_TO_SHORT(x) ((x) >> REAL_RADIX)
-+
-+/*
-+ * "Reals" are signed, 15 bits before the point, 32 bits after.
-+ * Multiplication is done like so:
-+ *
-+ * if |x| < 2^8, shift x >> 7, else shift x >>15
-+ * if |y| < 2^8, shift y >> 7, else shift y >>15
-+ * multiply x * y (just avoids clipping MSB)
-+ * shift the result >> 2, 10 or 18 bits, to make a total shift of 32 bits
-+ *
-+ * I'd do it in C, but gcc optimises it rather poorly (2K stack
-+ * frames, anyone?). Hence the bit of (ARMv4) asm magic below.
-+ * (Unfortunately, the CLZ opcode, which would make for a much neater
-+ * solution to this, doesn't appear until ARMv5)
-+ *
-+ * (tjd April 2002)
-+ */
-+
-+# define REAL_MUL(x, y) real_mul((x),(y))
-+
-+static __inline__ long long real_mul(long long x, long long y) {
-+ const register long long _x asm("r0") = (x);
-+ const register long long _y asm("r2") = (y);
-+ register long long rv asm("r0");
-+ __asm__ __volatile__ (
-+"@ we'll need to shift the result at least >> 2\n"
-+" mov r4, #2\n"
-+"@ both args >> 7,\n"
-+" mov r0, r0, lsr #7\n"
-+" mov r2, r2, lsr #7\n"
-+" orr r0, r0, r1, lsl #25\n"
-+" orr r2, r2, r3, lsl #25\n"
-+" mov r1, r1, asr #7\n"
-+" mov r3, r3, asr #7\n"
-+"@ check if x needs further shiftage\n"
-+" cmp r1, #0\n"
-+" cmnne r1, #1\n"
-+" addeq r4, r4, #8\n"
-+"@ shift x if needed\n"
-+" movne r0, r0, lsr #8\n"
-+" orrne r0, r0, r1, lsl #24\n"
-+" movne r1, r1, asr #8\n"
-+"@ check if y needs further shiftage\n"
-+" cmp r3, #0\n"
-+" cmnne r3, #1\n"
-+" addeq r4, r4, #8\n"
-+"@ shift y if needed\n"
-+" movne r2, r2, lsr #8\n"
-+" orrne r2, r2, r3, lsl #24\n"
-+" movne r3, r3, asr #8\n"
-+"@ multiply (ignoring overflow)\n"
-+" mul r3, r0, r3\n"
-+" mla r3, r1, r2, r3\n"
-+" umull r0, r1, r2, r0\n"
-+" add r1, r1, r3\n"
-+"@ shift the result the appropriate amount\n"
-+" rsb r3, r4, #32\n"
-+" mov r0, r0, lsr r4\n"
-+" orr r0, r0, r1, lsl r3\n"
-+" mov r1, r1, asr r4\n"
-+ : "=r" (rv)
-+ : "0" (_x), "r" (_y)
-+ : "r1", "r3", "r4", "cc");
-+ return rv;
-+}
-+
- #else
- # define real double
-+#endif
-+
-+#ifndef DOUBLE_TO_REAL
-+# define DOUBLE_TO_REAL(x) (x)
-+#endif
-+#ifndef REAL_TO_SHORT
-+# define REAL_TO_SHORT(x) (x)
-+#endif
-+#ifndef REAL_PLUS_32767
-+# define REAL_PLUS_32767 32767.0
-+#endif
-+#ifndef REAL_MINUS_32768
-+# define REAL_MINUS_32768 -32768.0
-+#endif
-+#ifndef REAL_MUL
-+# define REAL_MUL(x, y) ((x) * (y))
- #endif
-
- #ifdef __GNUC__
diff --git a/audio/mpg123/patches/patch-ak b/audio/mpg123/patches/patch-ak
deleted file mode 100644
index 1442e5fbb80..00000000000
--- a/audio/mpg123/patches/patch-ak
+++ /dev/null
@@ -1,40 +0,0 @@
-$NetBSD: patch-ak,v 1.1 1999/10/12 04:43:15 simonb Exp $
-
---- tabinit.c.orig Mon Feb 15 23:55:11 1999
-+++ tabinit.c Thu Aug 12 17:31:33 1999
-@@ -56,7 +56,7 @@
- kr=0x10>>i; divv=0x40>>i;
- costab = pnts[i];
- for(k=0;k<kr;k++)
-- costab[k] = 1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv));
-+ costab[k] = DOUBLE_TO_REAL(1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv)));
- #ifdef USE_3DNOW
- for(k=0;k<kr;k++)
- costab[k+kr] = -costab[k];
-@@ -69,7 +69,7 @@
- for(i=0,j=0;i<256;i++,j++,idx+=32)
- {
- if(idx < 512+16)
-- decwin[idx+16] = decwin[idx] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
-+ decwin[idx+16] = decwin[idx] = DOUBLE_TO_REAL((double) intwinbase[j] / 65536.0 * (double) scaleval);
-
- if(i % 32 == 31)
- idx -= 1023;
-@@ -80,7 +80,7 @@
- for( /* i=256 */ ;i<512;i++,j--,idx+=32)
- {
- if(idx < 512+16)
-- decwin[idx+16] = decwin[idx] = (double) intwinbase[j] / 65536.0 * (double) scaleval;
-+ decwin[idx+16] = decwin[idx] = DOUBLE_TO_REAL((double) intwinbase[j] / 65536.0 * (double) scaleval);
-
- if(i % 32 == 31)
- idx -= 1023;
-@@ -91,7 +91,7 @@
- #ifdef USE_3DNOW
- if(!param.down_sample) {
- for(i=0;i<512+32;i++) {
-- decwin[512+31-i] *= 65536.0; /* allows faster clipping in 3dnow code */
-+ decwin[512+31-i] = REAL_MUL(decwin[512+31-i], 65536.0); /* allows faster clipping in 3dnow code */
- decwin[512+32+i] = decwin[512+31-i];
- }
- }
diff --git a/audio/mpg123/patches/patch-al b/audio/mpg123/patches/patch-al
deleted file mode 100644
index 37f3ba7781a..00000000000
--- a/audio/mpg123/patches/patch-al
+++ /dev/null
@@ -1,40 +0,0 @@
-$NetBSD: patch-al,v 1.3 2001/05/12 20:21:37 mycroft Exp $
-
---- readers.c.orig Thu Mar 4 11:03:49 1999
-+++ readers.c Sat May 12 20:09:05 2001
-@@ -1,5 +1,9 @@
- #include <stdlib.h>
-
-+#ifdef __NetBSD__
-+#include <sys/param.h>
-+#endif
-+
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
-@@ -251,7 +255,12 @@
- return -1;
-
- mapend = mapbuf + len;
--
-+
-+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
-+ if(madvise(mapbuf, mapend-mapbuf, MADV_SEQUENTIAL) < 0)
-+ fprintf(stderr,"madvise failed, continuing anyways..\n");
-+#endif
-+
- if(param.verbose > 1)
- fprintf(stderr,"Using memory mapped IO for this stream.\n");
-
-@@ -268,6 +276,11 @@
-
- static void mapped_close(struct reader *rds)
- {
-+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104030000)
-+ if(madvise(mapbuf, mapend-mapbuf, MADV_FREE) < 0)
-+ fprintf(stderr,"madvise failed, continuing anyways..\n");
-+#endif
-+
- munmap((void *)mapbuf,mapend-mapbuf);
- if (rds->flags & READER_FD_OPENED)
- close(rds->filept);
diff --git a/audio/mpg123/patches/patch-am b/audio/mpg123/patches/patch-am
deleted file mode 100644
index 84c253e7acc..00000000000
--- a/audio/mpg123/patches/patch-am
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-am,v 1.1 2002/02/27 21:37:40 martin Exp $
-
---- getlopt.h.orig Mon Nov 2 23:58:54 1998
-+++ getlopt.h Wed Feb 27 22:29:14 2002
-@@ -24,7 +24,7 @@
- #define GLO_ARG 1
- #define GLO_CHAR 2
- #define GLO_NUM 0
--#define GLO_LONG GLO_NUM
-+#define GLO_LONG 4 /* int != long !!! */
-
- /* flags:
- * bit 0 = 0 - no argument
diff --git a/audio/mpg123/patches/patch-an b/audio/mpg123/patches/patch-an
deleted file mode 100644
index 510cd68a151..00000000000
--- a/audio/mpg123/patches/patch-an
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD: patch-an,v 1.1 2002/02/27 21:37:41 martin Exp $
-
---- getlopt.c.orig Tue Dec 8 10:41:11 1998
-+++ getlopt.c Wed Feb 27 22:29:57 2002
-@@ -45,10 +45,12 @@
-
- if (!(opt->flags & 1)) { /* doesn't take argument */
- if (opt->var) {
-- if (opt->flags & 2) /* var is *char */
-+ if (opt->flags & GLO_CHAR) /* var is *char */
- *((char *) opt->var) = (char) opt->value;
-- else
-+ else if (opt->flags & GLO_LONG) /* var is *long */
- *((long *) opt->var) = opt->value;
-+ else /* var is *int */
-+ *((int *) opt->var) = opt->value;
- }
- else
- result = opt->value ? opt->value : opt->sname;
diff --git a/audio/mpg123/patches/patch-ao b/audio/mpg123/patches/patch-ao
deleted file mode 100644
index 46d3583e69d..00000000000
--- a/audio/mpg123/patches/patch-ao
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD: patch-ao,v 1.1 2002/06/22 17:56:37 kent Exp $
-
---- audio_esd.c.orig Sat May 29 00:06:29 1999
-+++ audio_esd.c
-@@ -8,6 +8,10 @@
- #include <stropts.h>
- #include <sys/conf.h>
- #endif
-+#ifdef NETBSD
-+#include <sys/ioctl.h>
-+#include <sys/audioio.h>
-+#endif
-
- static unsigned esd_rate = 0, esd_format = 0, esd_channels = 0;
-
-@@ -75,7 +79,7 @@
- else if (ai->rate > esd_rate)
- return -1;
-
-- ai->fn = esd_play_stream_fallback(format, ai->rate, esdserver, "mpg123");
-+ ai->fn = esd_play_stream_fallback(format, ai->rate, NULL/*esdserver*/, "mpg123");
- return (ai->fn);
- }
-
diff --git a/audio/mpg123/patches/patch-ap b/audio/mpg123/patches/patch-ap
deleted file mode 100644
index 043ae956961..00000000000
--- a/audio/mpg123/patches/patch-ap
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-ap,v 1.1 2003/10/18 11:27:11 grant Exp $
-
---- audio_oss.c.orig 1998-02-01 01:14:08.000000000 +1100
-+++ audio_oss.c
-@@ -28,7 +28,7 @@ extern int outburst;
- #include <sys/ioctl.h>
- #ifdef LINUX
- #include <linux/soundcard.h>
--#elif defined(__bsdi__)
-+#elif defined(__bsdi__) || defined(__FreeBSD__)
- #include <sys/soundcard.h>
- #else
- #include <machine/soundcard.h>
diff --git a/audio/mpg123/patches/patch-aq b/audio/mpg123/patches/patch-aq
deleted file mode 100644
index 08e50c199fb..00000000000
--- a/audio/mpg123/patches/patch-aq
+++ /dev/null
@@ -1,91 +0,0 @@
-$NetBSD: patch-aq,v 1.3 2005/10/03 15:17:14 joerg Exp $
-
---- httpget.c.orig 2005-10-03 17:03:06.000000000 +0200
-+++ httpget.c 2005-10-03 17:03:06.000000000 +0200
-@@ -18,11 +18,9 @@
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
--#include <sys/errno.h>
-+#include <errno.h>
- #include <ctype.h>
-
--extern int errno;
--
- #include "mpg123.h"
-
- #ifndef INADDR_NONE
-@@ -55,11 +53,10 @@
- #endif
- int pos = 0;
-
-- while(1) {
-+ while(pos < (maxlen - 1)) {
- if( read(fileno(f),string+pos,1) == 1) {
- pos++;
- if(string[pos-1] == '\n') {
-- string[pos] = 0;
- break;
- }
- }
-@@ -78,6 +75,7 @@
- }
- #endif
-
-+ string[pos] = '\0';
- }
-
- void encode64 (char *source,char *destination)
-@@ -111,7 +109,7 @@
- }
-
- /* VERY simple auth-from-URL grabber */
--int getauthfromURL(char *url,char *auth)
-+int getauthfromURL(char *url,char *auth,unsigned long authlen)
- {
- char *pos;
-
-@@ -126,9 +124,13 @@
- if( url[i] == '/' )
- return 0;
- }
-+ if (pos-url >= authlen) {
-+ fprintf (stderr, "Error: authentication data exceeds max. length.\n");
-+ return -1;
-+ }
- strncpy(auth,url,pos-url);
- auth[pos-url] = 0;
-- strcpy(url,pos+1);
-+ memmove(url,pos+1,strlen(pos+1)+1);
- return 1;
- }
- return 0;
-@@ -199,7 +201,7 @@
- strncpy(p0, portptr, stringlength);
- *(p0 + stringlength) = '\0';
-
-- for (p = p0; *p && isdigit(*p); p++)
-+ for (p = p0; *p && isdigit((unsigned char)*p); p++)
- ;
- *p = '\0';
- *port = (char *)p0;
-@@ -265,7 +267,10 @@
- strncpy (purl, url, 1023);
- purl[1023] = '\0';
-
-- getauthfromURL(purl,httpauth1);
-+ if (getauthfromURL(purl,httpauth1,sizeof(httpauth1)) < 0) {
-+ sock = -1;
-+ goto exit;
-+ }
-
- do {
- strcpy (request, "GET ");
-@@ -399,6 +404,7 @@
- fprintf (stderr, "Too many HTTP relocations.\n");
- exit (1);
- }
-+exit:
- free (purl);
- free (request);
- free(host);
diff --git a/audio/mpg123/patches/patch-ar b/audio/mpg123/patches/patch-ar
deleted file mode 100644
index 4517d3bcae9..00000000000
--- a/audio/mpg123/patches/patch-ar
+++ /dev/null
@@ -1,26 +0,0 @@
-$NetBSD: patch-ar,v 1.2 2005/01/12 11:52:38 drochner Exp $
-
---- layer2.c.orig 1999-02-10 13:13:06.000000000 +0100
-+++ layer2.c
-@@ -240,7 +240,7 @@ static void II_select_table(struct frame
- { alloc_0, alloc_1, alloc_2, alloc_3 , alloc_4 };
- static int sblims[5] = { 27 , 30 , 8, 12 , 30 };
-
-- if(fr->lsf)
-+ if(fr->sampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */
- table = 4;
- else
- table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index];
-@@ -265,6 +265,12 @@ int do_layer2(struct frame *fr,int outmo
- fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
- (fr->mode_ext<<2)+4 : fr->II_sblimit;
-
-+ if (fr->jsbound > fr->II_sblimit)
-+ {
-+ fprintf(stderr, "Truncating stereo boundary to sideband limit.\n");
-+ fr->jsbound=fr->II_sblimit;
-+ }
-+
- if(stereo == 1 || single == 3)
- single = 0;
-
diff --git a/audio/mpg123/patches/patch-as b/audio/mpg123/patches/patch-as
deleted file mode 100644
index 458c6881cfd..00000000000
--- a/audio/mpg123/patches/patch-as
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-as,v 1.1 2005/01/07 14:52:13 drochner Exp $
-
---- common.c.orig 1999-06-15 23:24:19.000000000 +0200
-+++ common.c
-@@ -123,7 +123,7 @@ int head_check(unsigned long head)
- return FALSE;
- if(!((head>>17)&3))
- return FALSE;
-- if( ((head>>12)&0xf) == 0xf)
-+ if( ((head>>12)&0xf) == 0xf || ((head>>12)&0xf) == 0)
- return FALSE;
- if( ((head>>10)&0x3) == 0x3 )
- return FALSE;
diff --git a/audio/mpg123/patches/patch-at b/audio/mpg123/patches/patch-at
deleted file mode 100644
index 235fbb0e18d..00000000000
--- a/audio/mpg123/patches/patch-at
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-at,v 1.1 2005/01/07 14:52:13 drochner Exp $
-
---- mpg123.c.orig 2005-01-07 15:18:27.000000000 +0100
-+++ mpg123.c
-@@ -309,9 +309,9 @@ char *find_next_file (int argc, char *ar
- if (line[0]=='\0' || line[0]=='#')
- continue;
- if ((listnamedir) && (line[0]!='/') && (line[0]!='\\')){
-- strcpy (linetmp, listnamedir);
-- strcat (linetmp, line);
-- strcpy (line, linetmp);
-+ strncpy (linetmp, listnamedir, 1023);
-+ strncat (linetmp, line, 1023 - strlen(linetmp));
-+ strncpy (line, linetmp, 1023);
- }
- return (line);
- }
diff --git a/audio/mpg123/patches/patch-au b/audio/mpg123/patches/patch-au
deleted file mode 100644
index e09d2aa28a8..00000000000
--- a/audio/mpg123/patches/patch-au
+++ /dev/null
@@ -1,157 +0,0 @@
-$NetBSD: patch-au,v 1.1 2005/03/28 19:52:21 schwarz Exp $
-
---- audio_sgi.c.orig 2005-03-07 13:54:23.000000000 +0100
-+++ audio_sgi.c 2005-03-07 13:54:27.000000000 +0100
-@@ -6,20 +6,48 @@
-
- #include "mpg123.h"
-
-+#ifdef AL_RESOURCE /* as a test whether we use the "new" IRIX
-+ audio libraries */
-+#define NEW_IRIX_AUDIO
-+#define HAVE_ALGETERRORSTRING
-+#else
-+#define alClosePort(x) ALcloseport(x)
-+#define alFreeConfig(x) ALfreeconfig(x)
-+#define alGetFilled(x) ALgetfilled(x)
-+#define alSetChannels(x,y) ALsetchannels(x,y)
-+#define alSetQueueSize(x,y) ALsetqueuesize(x,y)
-+#define alSetSampFmt(x,y) ALsetsampfmt(x,y)
-+#define alSetWidth(x,y) ALsetwidth(x,y)
-+#define alNewConfig() ALnewconfig()
-+#define alOpenPort(x,y,z) ALopenport(x,y,z)
-+#endif
-
- /* Analog output constant */
- static const char analog_output_res_name[] = ".AnalogOut";
-
-+/* Routine to print a message to stderr; uses alGetErrorString(oserror)
-+ if available */
-+
-+void errormessage(const char *message)
-+{
-+#ifdef HAVE_ALGETERRORSTRING
-+ fprintf(stderr,"%s : %s\n",message,alGetErrorString(oserror()));
-+#else
-+ fprintf(stderr,"%s error\n",message);
-+#endif
-+}
-
- int audio_open(struct audio_info_struct *ai)
- {
-+#ifdef NEW_IRIX_AUDIO
- int dev = AL_DEFAULT_OUTPUT;
-+#endif
-
- ai->config = alNewConfig();
-
- /* Test for correct completion */
- if (ai->config == 0) {
-- fprintf(stderr,"audio_open : %s\n",alGetErrorString(oserror()));
-+ errormessage("audio_open");
- exit(-1);
- }
-
-@@ -33,6 +61,8 @@
- alSetSampFmt(ai->config,AL_SAMPFMT_TWOSCOMP);
- alSetQueueSize(ai->config, 131069);
-
-+#ifdef NEW_IRIX_AUDIO
-+
- /* Setup output device to specified module. If there is no module
- specified in ai structure, use the default four output */
- if ((ai->device) != NULL) {
-@@ -61,15 +91,16 @@
- /* Set the device */
- if (alSetDevice(ai->config,dev) < 0)
- {
-- fprintf(stderr,"audio_open : %s\n",alGetErrorString(oserror()));
-+ errormessage("audio_open");
- exit(-1);
- }
-
-+#endif /* NEW_IRIX_AUDIO */
-+
- /* Open the audio port */
- ai->port = alOpenPort("mpg123-VSC", "w", ai->config);
- if(ai->port == NULL) {
-- fprintf(stderr, "Unable to open audio channel: %s\n",
-- alGetErrorString(oserror()));
-+ errormessage("Unable to open audio channel");
- exit(-1);
- }
-
-@@ -99,22 +130,30 @@
-
- int audio_set_rate(struct audio_info_struct *ai)
- {
-+#ifdef NEW_IRIX_AUDIO
- int dev = alGetDevice(ai->config);
- ALpv params[1];
-+#else
-+ int dev;
-+ long params[2] = {AL_OUTPUT_RATE, AL_RATE_44100};
-+ params[1] = ai->rate;
-+ dev=ALsetparams(AL_DEFAULT_DEVICE, params, 2);
-+#endif
-
- /* Make sure the device is OK */
- if (dev < 0)
- {
-- fprintf(stderr,"audio_set_rate : %s\n",alGetErrorString(oserror()));
-+ errormessage("audio_set_rate");
- return 1;
- }
-
-+#ifdef NEW_IRIX_AUDIO
- params[0].param = AL_OUTPUT_RATE;
- params[0].value.ll = alDoubleToFixed(ai->rate);
-
- if (alSetParams(dev, params,1) < 0)
-- fprintf(stderr,"audio_set_rate : %s\n",alGetErrorString(oserror()));
--
-+ errormessage("audio_set_rate");
-+#endif
- return 0;
- }
-
-@@ -128,7 +167,7 @@
- ret = alSetChannels(ai->config, AL_MONO);
-
- if (ret < 0)
-- fprintf(stderr,"audio_set_channels : %s\n",alGetErrorString(oserror()));
-+ errormessage("audio_set_channels");
-
- return 0;
- }
-@@ -136,10 +175,10 @@
- int audio_set_format(struct audio_info_struct *ai)
- {
- if (alSetSampFmt(ai->config,AL_SAMPFMT_TWOSCOMP) < 0)
-- fprintf(stderr,"audio_set_format : %s\n",alGetErrorString(oserror()));
-+ errormessage("audio_set_format");
-
- if (alSetWidth(ai->config,AL_SAMPLE_16) < 0)
-- fprintf(stderr,"audio_set_format : %s\n",alGetErrorString(oserror()));
-+ errormessage("audio_set_format");
-
- return 0;
- }
-@@ -153,9 +192,17 @@
- int audio_play_samples(struct audio_info_struct *ai,unsigned char *buf,int len)
- {
- if(ai->format == AUDIO_FORMAT_SIGNED_8)
-+#ifdef NEW_IRIX_AUDIO
- alWriteFrames(ai->port, buf, len>>1);
-+#else
-+ ALwritesamps(ai->port, buf, len);
-+#endif
- else
-+#ifdef NEW_IRIX_AUDIO
- alWriteFrames(ai->port, buf, len>>2);
-+#else
-+ ALwritesamps(ai->port, buf, len>>1);
-+#endif
-
- return len;
- }
diff --git a/audio/mpg123/patches/patch-av b/audio/mpg123/patches/patch-av
deleted file mode 100644
index 0d702f2631c..00000000000
--- a/audio/mpg123/patches/patch-av
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD: patch-av,v 1.2 2008/08/20 22:17:30 martin Exp $
-
---- xfermem.c.orig 1999-05-27 20:41:10.000000000 +0200
-+++ xfermem.c 2008-08-20 16:04:32.000000000 +0200
-@@ -32,8 +32,6 @@
- #include <sys/shm.h>
- #endif
-
--extern int errno;
--
- #if defined (USE_MMAP) && defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
- #define MAP_ANON MAP_ANONYMOUS
- #endif
-@@ -180,6 +178,15 @@
- if (FD_ISSET(fd, &selfds))
- switch (read(fd, &cmd, 1)) {
- case 0: /* EOF */
-+ /*
-+ * We should not check
-+ * errno later on in
-+ * this case, but we
-+ * have to return an
-+ * error code, so it
-+ * will happen.
-+ */
-+ errno = 0;
- return (-1);
- case -1:
- if (errno == EINTR)
diff --git a/audio/mpg123/patches/patch-aw b/audio/mpg123/patches/patch-aw
deleted file mode 100644
index d22aebe6368..00000000000
--- a/audio/mpg123/patches/patch-aw
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-aw,v 1.1 2005/10/03 15:17:14 joerg Exp $
-
---- term.c.orig 2005-10-03 15:20:10.000000000 +0200
-+++ term.c
-@@ -90,7 +90,7 @@ static long term_handle_input(struct fra
- while(n > 0) {
- fd_set r;
- struct timeval t;
-- char val;
-+ unsigned char val;
-
- t.tv_sec=0;
- t.tv_usec=(do_delay) ? 1000 : 0;