aboutsummaryrefslogtreecommitdiff
path: root/audio/quelcom
diff options
context:
space:
mode:
authorKirill Ponomarev <krion@FreeBSD.org>2004-02-14 12:54:17 +0000
committerKirill Ponomarev <krion@FreeBSD.org>2004-02-14 12:54:17 +0000
commit51505fe87160d96ee169096629f226ab1de71461 (patch)
tree3004c76cf66fa92cf01f8fa03dbcb9ff81517e42 /audio/quelcom
parente3b47aca3b00779fda7f6901672bff0d3b765745 (diff)
downloadports-51505fe87160d96ee169096629f226ab1de71461.tar.gz
ports-51505fe87160d96ee169096629f226ab1de71461.zip
Notes
Diffstat (limited to 'audio/quelcom')
-rw-r--r--audio/quelcom/Makefile50
-rw-r--r--audio/quelcom/distinfo4
-rw-r--r--audio/quelcom/files/patch-aa22
-rw-r--r--audio/quelcom/files/patch-ab23
-rw-r--r--audio/quelcom/files/patch-ac9
-rw-r--r--audio/quelcom/files/patch-ad9
-rw-r--r--audio/quelcom/files/patch-ae9
-rw-r--r--audio/quelcom/files/patch-af11
-rw-r--r--audio/quelcom/files/patch-bin::qmp3check.cc206
-rw-r--r--audio/quelcom/files/patch-bin::qmp3cut.c41
-rw-r--r--audio/quelcom/files/patch-bin::qmp3info.cc65
-rw-r--r--audio/quelcom/files/patch-bin::qmp3join.cc68
-rw-r--r--audio/quelcom/files/patch-bin::qmp3report.cc165
-rw-r--r--audio/quelcom/files/patch-bin::qwavcut.cc41
-rw-r--r--audio/quelcom/files/patch-bin::qwavfade.cc87
-rw-r--r--audio/quelcom/files/patch-bin::qwavheaderdump.cc243
-rw-r--r--audio/quelcom/files/patch-bin::qwavinfo.cc61
-rw-r--r--audio/quelcom/files/patch-bin::qwavjoin.cc61
-rw-r--r--audio/quelcom/files/patch-bin::qwavsilence.cc105
-rw-r--r--audio/quelcom/files/patch-lib::endian.hh39
-rw-r--r--audio/quelcom/files/patch-lib::qcuthandler.cc11
-rw-r--r--audio/quelcom/files/patch-lib::qcuthandler.hh13
-rw-r--r--audio/quelcom/files/patch-lib::qexception.hh11
-rw-r--r--audio/quelcom/files/patch-lib::qfile.hh10
-rw-r--r--audio/quelcom/files/patch-lib::qmisc.cc11
-rw-r--r--audio/quelcom/files/patch-lib::qmp3.cc47
-rw-r--r--audio/quelcom/files/patch-lib::qmp3.hh11
-rw-r--r--audio/quelcom/files/patch-lib::qmp3frameheader.cc289
-rw-r--r--audio/quelcom/files/patch-lib::qmp3frameheader.hh37
-rw-r--r--audio/quelcom/files/patch-lib::qreport.cc155
-rw-r--r--audio/quelcom/files/patch-lib::qreport.hh10
-rw-r--r--audio/quelcom/files/patch-lib::qtag.cc27
-rw-r--r--audio/quelcom/files/patch-lib::qtag.hh10
-rw-r--r--audio/quelcom/files/patch-lib::qvf.cc20
-rw-r--r--audio/quelcom/files/patch-lib::qvf.hh23
-rw-r--r--audio/quelcom/files/patch-lib::qwav.cc42
-rw-r--r--audio/quelcom/files/patch-lib::qwav.hh17
-rw-r--r--audio/quelcom/files/patch-lib::qwavheader.cc88
-rw-r--r--audio/quelcom/files/patch-lib::qwavheader.hh66
-rw-r--r--audio/quelcom/files/patch-lib::qwavsample.cc143
-rw-r--r--audio/quelcom/pkg-plist7
41 files changed, 2264 insertions, 103 deletions
diff --git a/audio/quelcom/Makefile b/audio/quelcom/Makefile
index 0b097fb7110a..6e516dac23c7 100644
--- a/audio/quelcom/Makefile
+++ b/audio/quelcom/Makefile
@@ -6,36 +6,50 @@
#
PORTNAME= quelcom
-PORTVERSION= 0.3.0
-PORTREVISION= 2
+PORTVERSION= 0.4.0
CATEGORIES= audio
MASTER_SITES= http://www.etse.urv.es/~dmanye/quelcom/src/
MAINTAINER= ports@FreeBSD.org
COMMENT= A set of command-line utilities for MP3 and wave files
-USE_GETOPT_LONG=yes
+USE_GCC= 3.3
+USE_GETOPT_LONG= yes
+USE_GETTEXT= yes
+USE_REINPLACE= yes
USE_GMAKE= yes
MAKEFILE= makefile
-USE_GCC= 2.95
-USE_REINPLACE= yes
+MAKE_ENV= CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
+INSTALLS_SHLIB= yes
-MAN1= qmp3check.1 qmp3cut.1 qmp3info.1 qmp3join.1 qmp3report.1 \
- qwavcut.1 qwavfade.1 qwavheaderdump.1 qwavinfo.1 qwavjoin.1 \
- qwavsilence.1
-
-.include <bsd.port.pre.mk>
+CXXFLAGS+= -I../lib -I${LOCALBASE}/include ${CPPFLAGS} \
+ -DHAVE_DECL_GETOPT -fPIC
+LDFLAGS= -L../lib -L${LOCALBASE}/lib -lintl
post-patch:
- ${REINPLACE_CMD} -e 's,g++,${CXX},g' ${WRKSRC}/src/makefile
-.if ${OSVERSION} >= 500041
- ${REINPLACE_CMD} -e 's, -lgnugetopt,,g' ${WRKSRC}/src/makefile
-.endif
+ @${FIND} ${WRKSRC} -name "makefile" | ${XARGS} ${REINPLACE_CMD} -e \
+ 's|make |$$(MAKE) |g ; \
+ s|^CXX=|CXX?=|g ; \
+ s|^CXXFLAGS=|CXXFLAGS+=|g ; \
+ s|^LDFLAGS=|LDFLAGS+=|g ; \
+ s|-L./../lib -lqextra|$$(LDFLAGS) -lqextra|g'
do-install:
-.for F in ${MAN1}
- ${INSTALL_MAN} ${WRKSRC}/man/${F} ${PREFIX}/man/man1
- ${INSTALL_PROGRAM} ${WRKSRC}/src/${F:S/.1//g} ${PREFIX}/bin
+.for file in qmp3check qmp3cut qmp3info qmp3join qmp3report qwavcut qwavfade \
+ qwavheaderdump qwavinfo qwavjoin qwavsilence
+ ${INSTALL_PROGRAM} ${WRKSRC}/bin/${file} ${PREFIX}/bin
.endfor
+.for file in libqextra.so libqmp3.so libqwav.so
+ ${INSTALL_DATA} ${WRKSRC}/lib/${file} ${PREFIX}/lib
+.endfor
+.for lang in ca es
+ @${MKDIR} ${PREFIX}/share/locale/${lang}/LC_MESSAGES
+ ${INSTALL_DATA} ${WRKSRC}/po/${lang}.mo \
+ ${PREFIX}/share/locale/${lang}/LC_MESSAGES/quelcom.mo
+.endfor
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/doc/quelcom.html ${DOCSDIR}
+.endif
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/audio/quelcom/distinfo b/audio/quelcom/distinfo
index 1709cc71a7a7..b3426a69843a 100644
--- a/audio/quelcom/distinfo
+++ b/audio/quelcom/distinfo
@@ -1,2 +1,2 @@
-MD5 (quelcom-0.3.0.tar.gz) = 0ff826e8280a98c87de1aa9d52c70746
-SIZE (quelcom-0.3.0.tar.gz) = 36417
+MD5 (quelcom-0.4.0.tar.gz) = a681c06bcf6159f8540d64cf680e6661
+SIZE (quelcom-0.4.0.tar.gz) = 171984
diff --git a/audio/quelcom/files/patch-aa b/audio/quelcom/files/patch-aa
deleted file mode 100644
index 55783615d869..000000000000
--- a/audio/quelcom/files/patch-aa
+++ /dev/null
@@ -1,22 +0,0 @@
---- makefile.orig Tue Jan 23 00:02:00 2001
-+++ makefile Tue Jan 23 12:57:32 2001
-@@ -3,16 +3,16 @@
- #
-
- # change these variables to fit your needs
--MANDIR=/usr/local/man
-+MANDIR=$(PREFIX)/man
- PACKAGE=quelcom
--LOCALEDIR=~/share/locale
-+LOCALEDIR=$(PREFIX)/share/locale
- #BINDIR=/usr/local/bin
- # you should change BINDIR in src/makefile
-
- VERSION=0.3.0
-
- all:
-- cd src; make
-+ cd src; $(MAKE)
-
- clean:
- cd src; make clean
diff --git a/audio/quelcom/files/patch-ab b/audio/quelcom/files/patch-ab
deleted file mode 100644
index 2615c9f3edb7..000000000000
--- a/audio/quelcom/files/patch-ab
+++ /dev/null
@@ -1,23 +0,0 @@
---- src/makefile.orig Tue Jan 23 00:02:01 2001
-+++ src/makefile Tue Jan 23 12:59:11 2001
-@@ -1,16 +1,16 @@
- TARGETS=qwavheaderdump qwavfade qmp3report qmp3check qwavsilence qwavinfo qwavjoin qwavcut qmp3info qmp3join qmp3cut
-
- PACKAGE=\"quelcom\"
--LOCALEDIR=\"/usr/local/share/locale\"
-+LOCALEDIR=$(PREFIX)/share/locale
-
- all: $(TARGETS)
- strip $(TARGETS)
-
--BINDIR=/usr/local/bin
-+BINDIR=$(PREFIX)/bin
- VERSION=\"0.3.0\"
- CXX=g++
--CXXFLAGS=-Wall -DVERSION=$(VERSION) -DPACKAGE=$(PACKAGE) -DLOCALEDIR=$(LOCALEDIR)
--LDFLAGS=
-+CXXFLAGS+=-Wall -DVERSION=$(VERSION) -DPACKAGE=$(PACKAGE) -DLOCALEDIR=$(LOCALEDIR) -I$(PREFIX)/include
-+LDFLAGS=-L$(PREFIX)/lib -lgnugetopt
-
- SOURCES=qwav.cc qwavheader.cc qexception.cc qvf.cc qcuthandler.cc qfile.cc qmisc.cc
- HEADERS=qwav.hh qwavheader.hh qexception.hh qvf.hh qcuthandler.hh qfile.hh qmisc.hh
diff --git a/audio/quelcom/files/patch-ac b/audio/quelcom/files/patch-ac
deleted file mode 100644
index 06654415c35a..000000000000
--- a/audio/quelcom/files/patch-ac
+++ /dev/null
@@ -1,9 +0,0 @@
---- src/qmisc.cc.orig Tue Jan 23 13:01:16 2001
-+++ src/qmisc.cc Tue Jan 23 13:01:23 2001
-@@ -1,6 +1,6 @@
- # include <string>
- # include <stdio.h>
--
-+# include "qmisc.hh"
-
- string uint2string (uint ui) {
diff --git a/audio/quelcom/files/patch-ad b/audio/quelcom/files/patch-ad
deleted file mode 100644
index dd38f4081d47..000000000000
--- a/audio/quelcom/files/patch-ad
+++ /dev/null
@@ -1,9 +0,0 @@
---- src/qmp3frameheader.hh.orig Tue Jan 23 13:03:03 2001
-+++ src/qmp3frameheader.hh Tue Jan 23 13:03:11 2001
-@@ -2,6 +2,7 @@
- # define _qmp3frameheader_hh_
-
- # include <string>
-+# include <sys/types.h>
-
- typedef unsigned int uint;
diff --git a/audio/quelcom/files/patch-ae b/audio/quelcom/files/patch-ae
deleted file mode 100644
index f82dfe16a678..000000000000
--- a/audio/quelcom/files/patch-ae
+++ /dev/null
@@ -1,9 +0,0 @@
---- src/qwavinfo.cc.orig Tue Jan 23 13:05:30 2001
-+++ src/qwavinfo.cc Tue Jan 23 13:05:42 2001
-@@ -1,6 +1,6 @@
- # include <getopt.h> // getopt
- # include <sys/types.h> // ulong, ...
--
-+typedef unsigned long ulong;
- # include "qwav.hh"
- # include "qexception.hh"
diff --git a/audio/quelcom/files/patch-af b/audio/quelcom/files/patch-af
deleted file mode 100644
index 02951031c30a..000000000000
--- a/audio/quelcom/files/patch-af
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/qmp3info.cc.orig Tue Jan 23 13:06:43 2001
-+++ src/qmp3info.cc Tue Jan 23 13:07:04 2001
-@@ -1,7 +1,7 @@
- # include <getopt.h> // getopt
- # include "qmp3.hh"
- # include "qexception.hh"
--
-+typedef unsigned long ulong;
- #ifdef NLS
- # include <locale.h>
- # include <libintl.h>
diff --git a/audio/quelcom/files/patch-bin::qmp3check.cc b/audio/quelcom/files/patch-bin::qmp3check.cc
new file mode 100644
index 000000000000..36230ec0d1fb
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qmp3check.cc
@@ -0,0 +1,206 @@
+--- bin/qmp3check.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qmp3check.cc Fri Feb 13 19:17:38 2004
+@@ -15,9 +15,9 @@
+ #endif
+
+ void usage () {
+-
+- cerr.form(_(" %s: check and clean mp3 streams\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ cerr << APPNAME << ": " << _("check and clean mp3 streams") << '\n';
++ cerr << ' ' << _("syntax") << APPNAME
++ << ' ' << _("[option]... file...") << '\n';
+ cerr << _(" -D, --delete: delete invalid frames and garbage. use with care\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -q, --quiet: no output messages\n");
+@@ -76,11 +76,12 @@
+ verbose=true; quiet=false;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -144,8 +145,8 @@
+ skipped = frame->getMap()-file.getMap();
+ if (skipped) {
+ if (!quiet)
+- cerr.form(_("%s: skipped %d bytes of garbage at the beginning\n"),
+- *argv,skipped);
++ cerr << *argv << ": " << _("skipped") << ' ' << skipped << ' '
++ << _("bytes of garbage at the beginning") << '\n';
+ total_skipped += skipped;
+ stream_length -= skipped;
+ }
+@@ -156,8 +157,9 @@
+ }
+ else
+ if (!quiet)
+- cerr.form(_("%s: first frame incomplete: %d of %d bytes\n"),
+- *argv,stream_length,frame->getLength());
++ cerr << *argv << ": " << _("first frame incomplete") << ": "
++ << stream_length << _(" of ") << frame->getLength()
++ << ' ' << _("bytes") << '\n';
+
+ while (stream_length) {
+
+@@ -166,10 +168,11 @@
+ }
+ catch (qexception e) {
+ if (!quiet)
+- cerr.form(_("%s: %d bytes of garbage at the end"),
+- *argv,stream_length);
++ cerr << *argv << ": " << stream_length
++ << _(" bytes of garbage at the end");
+ if (verbose)
+- cerr.form(" (%d..%d)",file.getSize()-stream_length,file.getSize());
++ cerr << " (" << file.getSize()-stream_length
++ << ',' << file.getSize() << ')';
+ if (!quiet)
+ cerr << endl;
+ total_skipped += stream_length;
+@@ -179,11 +182,11 @@
+
+ if (skipped) {
+ if (!quiet)
+- cerr.form(_("%s: skipped %d bytes"),*argv,skipped);
++ cerr << *argv << _(": skipped") << skipped << _(" bytes");
+ if (verbose)
+- cerr.form(" (%d..%d)",
+- clean_block_end-file.getMap()+1,
+- frame->getMap()-file.getMap()-1);
++ cerr << " (" << clean_block_end-file.getMap()+1
++ << ".." << frame->getMap()-file.getMap()-1 << ')';
++
+ if (!quiet)
+ cerr << endl;
+
+@@ -191,15 +194,14 @@
+ (clean_offset!=file.getMap()-1)) {
+ if (del) {
+ if (!quiet)
+- cerr.form(_("%s: moving %d bytes"),
+- *argv,
+- clean_block_end-clean_block_begin+1);
++ cerr << *argv << _(": moving ")
++ << clean_block_end-clean_block_begin+1
++ << _(" bytes");
+ if (verbose)
+- cerr.form(" (%d..%d) <-- (%d..%d)",
+- clean_offset-file.getMap()+1,
+- clean_offset-file.getMap()+1+clean_block_end-clean_block_begin,
+- clean_block_begin-file.getMap(),
+- clean_block_end-file.getMap());
++ cerr << " (" << clean_offset-file.getMap()+1
++ << ".." << clean_offset-file.getMap()+1+clean_block_end-clean_block_begin
++ << ") <-- (" << clean_block_begin-file.getMap()
++ << ".." << clean_block_end-file.getMap() << ")";
+ if (!quiet)
+ cerr << endl;
+
+@@ -223,8 +225,9 @@
+ }
+ else {
+ if (!quiet)
+- cerr.form(_("%s: last frame (%d+1) truncated: %d of %d bytes\n"),
+- *argv,frames,stream_length,frame->getLength());
++ cerr << *argv << _(": last frame (") << frames << _(") truncated: ")
++ << stream_length << _(" of ") << frame->getLength()
++ << _(" bytes\n");
+ total_skipped += stream_length;
+ stream_length = 0;
+ break;
+@@ -237,14 +240,13 @@
+
+ if (del) {
+ if (!quiet)
+- cerr.form(_("%s: moving %d bytes"),
+- *argv,clean_block_end-clean_block_begin+1);
+- if (verbose)
+- cerr.form(" (%d..%d) <-- (%d..%d)",
+- clean_offset-file.getMap()+1,
+- clean_offset-file.getMap()+1+clean_block_end-clean_block_begin,
+- clean_block_begin-file.getMap(),
+- clean_block_end-file.getMap());
++ cerr << *argv << _(": moving ")
++ << clean_block_end-clean_block_begin+1 << _(" bytes");
++ if (verbose)
++ cerr << " (" << clean_offset-file.getMap()+1
++ << ".." << clean_offset-file.getMap()+1+clean_block_end-clean_block_begin
++ << ") <-- (" << clean_block_begin-file.getMap()
++ << ".." << clean_block_end-file.getMap() << ')';
+ if (!quiet)
+ cerr << endl;
+
+@@ -261,7 +263,7 @@
+ if (del) {
+ if (delTag) {
+ if (!quiet)
+- cerr.form(_("%s: skipping tag"),*argv);
++ cerr << *argv << _(": skipping tag");
+ if (verbose)
+ cerr << " (" << qtag::LENGTH << " bytes)";
+ if (!quiet)
+@@ -274,13 +276,13 @@
+ (u_int32_t)(tag->getMap()-file.getMap()+qtag::LENGTH-1),
+ (u_int32_t)(clean_offset+1-file.getMap()));
+ if (!quiet)
+- cerr.form(_("%s: moving tag (%d bytes)"),*argv,qtag::LENGTH);
++ cerr << *argv << _(": moving tag (") << qtag::LENGTH << ")";
+ if (verbose)
+- cerr.form(" (%d..%d) <-- (%d..%d)",
+- clean_offset-file.getMap()+1,
+- clean_offset-file.getMap()+1+qtag::LENGTH-1,
+- tag->getMap()-file.getMap(),
+- tag->getMap()-file.getMap()+qtag::LENGTH-1);
++
++ cerr << " (" << clean_offset-file.getMap()+1
++ << ".." << clean_offset-file.getMap()+1+qtag::LENGTH-1
++ << ") <-- (" << tag->getMap()-file.getMap()
++ << ".." << tag->getMap()-file.getMap()+qtag::LENGTH-1 << ')';
+ if (!quiet)
+ cerr << endl;
+ }
+@@ -293,12 +295,12 @@
+
+ if (total_skipped) {
+ if (!quiet)
+- cerr.form(_("%s: %d of %d discardable bytes\n"),
+- *argv,total_skipped,file.getSize());
++ cerr << *argv << ": " << total_skipped << _(" of ") << file.getSize()
++ << _(" discardable bytes\n");
+ if (del) {
+ if (!quiet)
+- cerr.form(_("%s: truncating to %d bytes\n"),
+- *argv,file.getSize()-total_skipped);
++ cerr << *argv << _(": truncating to ") << file.getSize()-total_skipped
++ << _(" bytes\n");
+ file.truncate(file.getSize()-total_skipped);
+ }
+ }
+@@ -309,8 +311,8 @@
+ cerr << mp3 << endl; // quedaria millor la versió 'verbose...'
+ }
+ else
+- cerr.form(_("%s: %d frames, %d bytes\n"),
+- *argv,frames,clean_offset-file.getMap()+1);
++ cerr << *argv << ": " << frames << _(" frames, ")
++ << clean_offset-file.getMap()+1 << _(" bytes\n");
+ }
+
+ if (hasTag)
+@@ -327,5 +329,5 @@
+ } while (*++argv);
+
+ if (error_files && verbose)
+- cerr.form(_("%d error files found\n"),error_files);
++ cerr << error_files << _(" error files found\n");
+ }
diff --git a/audio/quelcom/files/patch-bin::qmp3cut.c b/audio/quelcom/files/patch-bin::qmp3cut.c
new file mode 100644
index 000000000000..b4e476e10a2f
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qmp3cut.c
@@ -0,0 +1,41 @@
+--- bin/qmp3cut.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qmp3cut.cc Fri Feb 13 19:17:38 2004
+@@ -11,9 +11,8 @@
+ #endif
+
+ void usage () {
+-
+- cerr.form(_(" %s: extract and/or delete parts of a mp3 file\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": extract and/or delete parts of a mp3 file\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file\n");
+ cerr << _(" options:\n");
+ cerr << _(" -B, --set-begin <cut point>: set the first frame from the beginning of the file\n");
+ cerr << _(" -b, --set-begin-from-eof <cut point>: set the first frame from the end of the file\n");
+@@ -102,13 +101,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -140,7 +140,7 @@
+ qmp3 mp3 (infile,mode);
+
+ if (verbose)
+- cerr.form(_("scanning '%s'..."),infile.c_str());
++ cerr << _("scanning '") << infile << "'...";
+ mp3.scan();
+ if (verbose)
+ cerr << "ok." << endl;
diff --git a/audio/quelcom/files/patch-bin::qmp3info.cc b/audio/quelcom/files/patch-bin::qmp3info.cc
new file mode 100644
index 000000000000..9029e4efcea8
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qmp3info.cc
@@ -0,0 +1,65 @@
+--- bin/qmp3info.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qmp3info.cc Fri Feb 13 19:17:38 2004
+@@ -11,9 +11,8 @@
+ #endif
+
+ void usage () {
+-
+- cerr.form(_(" %s: show info from mp3 files\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": show info from mp3 files\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file...\n");
+ cerr << _(" -c, --check: check the entire stream (slower but accurate)\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -s, --summary-only: show only the summary\n");
+@@ -69,13 +68,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -136,15 +136,22 @@
+ optind++;
+ }
+
+- cout.form (_("%u file%c"),files,files>1?'s':0);
++ cout << files << _(" file") << (files>1?"s":"");
+ if (errors)
+- cout.form (" (%u error%c)",errors,errors>1?'s':0);
+- if (verbose)
+- cout.form (" => %d:%02d.%03d %u frames %u bytes\n",
+- total_msduration/60000,(total_msduration/1000)%60,
+- total_msduration%1000,total_frames,total_bytes);
+- else
+- cout.form (" => %d:%02d\n",
+- total_msduration/60000,(total_msduration/1000)%60);
+-
++ cout << errors << _(" error") << (errors>1?"s":"");
++ if (verbose) {
++ cout << " => " << total_msduration/60000 << ":";
++ cout.width(2);
++ cout.fill('0');
++ cout << (total_msduration/1000)%60 << '.';
++ cout.width(3);
++ cout.fill('0');
++ cout << total_msduration%1000 << " " << total_frames << " "
++ << total_bytes << " bytes\n";
++ } else {
++ cout << " => " << total_msduration/60000 << ':';
++ cout.width(2);
++ cout.fill('0');
++ cout << (total_msduration/1000)%60 << '\n';
++ }
+ }
diff --git a/audio/quelcom/files/patch-bin::qmp3join.cc b/audio/quelcom/files/patch-bin::qmp3join.cc
new file mode 100644
index 000000000000..947194e00860
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qmp3join.cc
@@ -0,0 +1,68 @@
+--- bin/qmp3join.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qmp3join.cc Fri Feb 13 19:17:38 2004
+@@ -11,9 +11,8 @@
+ #endif
+
+ void usage () {
+-
+- cerr.form(_(" %s: join mp3 files\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file1 file2...\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": join mp3 files\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file1 file2...\n");
+ cerr << _(" -f, --force: force join bypassing bit rate checks\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -o, --output <file>: send output to <file>. otherwise, append to <file1>\n");
+@@ -68,13 +67,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -95,7 +95,7 @@
+ if (outfile!="") {
+ mp3 = new qmp3(*argv);
+ if (verbose)
+- cerr.form(_("copying '%s' to '%s'..."),*argv,outfile.c_str());
++ cerr << _(" copying '") << *argv << _("' to '") << outfile << "'...";
+ mp3->dup(outfile);
+ if (verbose)
+ cerr << "ok." << endl;
+@@ -106,7 +106,7 @@
+ mp3 = new qmp3(*argv,qmp3::READWRITE);
+
+ if (verbose)
+- cerr.form(_("scanning '%s'..."),mp3->getName().c_str());
++ cerr << _("scanning '") << mp3->getName() << "'...";
+
+ mp3->scan();
+ if (verbose)
+@@ -117,14 +117,14 @@
+ qmp3 mm(*argv);
+
+ if (verbose)
+- cerr.form(_("scanning '%s'..."),mm.getName().c_str());
++ cerr << _("scanning '") << mm.getName() << "'...";
+ mm.scan();
+ if (verbose)
+ cerr << "ok." << endl;
+
+ if (verbose)
+- cerr.form(_("appending '%s' to '%s'..."),
+- mm.getName().c_str(),mp3->getName().c_str());
++ cerr << _("appending '") << mm.getName() << _("' to '")
++ << mp3->getName() << "'...";
+ mp3->append(mm,force);
+ if (verbose)
+ cerr << "ok." << endl;
diff --git a/audio/quelcom/files/patch-bin::qmp3report.cc b/audio/quelcom/files/patch-bin::qmp3report.cc
new file mode 100644
index 000000000000..30b9e893291d
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qmp3report.cc
@@ -0,0 +1,165 @@
+--- bin/qmp3report.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qmp3report.cc Fri Feb 13 19:17:38 2004
+@@ -11,6 +11,8 @@
+ # include "qreport.hh"
+ # include "qmisc.hh"
+
++using namespace std;
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -30,8 +32,9 @@
+
+ void usage () {
+
+- cerr.form(_(" %s: generate reports from mp3 files and directories\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ cerr << ' ' << APPNAME
++ << ": generate reports from mp3 files and directories\n";
++ cerr << " syntax: " << APPNAME << " [option]... file...\n";
+ cerr << _(" options:\n");
+ cerr << _(" -a, --all-files: report all files, not just *.mp3\n");
+ cerr << _(" -A, --show-all: implies -d, -f, -s\n");
+@@ -58,7 +61,7 @@
+ if (opts.all) {
+ qfile f(filename);
+ if (opts.verbose)
+- cerr.form (_("reporting file '%s'\n"),filename.c_str());
++ cerr << _("reporting file") << " '" << filename << "'\n";
+ qreport r(f);
+ if (opts.showfiles) {
+ if (opts.html) {
+@@ -89,7 +92,7 @@
+ mp3.scan();
+ }
+ if (opts.verbose)
+- cerr.form (_("reporting mp3 file '%s'\n"),mp3name.c_str());
++ cerr << _("reporting mp3 file") << " '" << mp3name << "'\n";
+ qreport r(mp3);
+ if (opts.showfiles) {
+ if (opts.html) {
+@@ -110,13 +113,13 @@
+ qreport report_directory (string dirname, struct options &opts) {
+
+ if (opts.verbose)
+- cerr.form (_("reporting directory '%s'\n"),dirname.c_str());
++ cerr << _("reporting directory") << " '" << dirname << "'\n";
+
+ qreport dirreport(dirname);
+
+ if (!opts.recursive) {
+ if (opts.verbose)
+- cerr.form(_("%s: '%s' is a directory\n"),APPNAME,dirname.c_str());
++ cerr << APPNAME << ": '" << dirname << ' ' << _("is a directory") << '\n';
+ return dirreport;
+ }
+
+@@ -125,17 +128,18 @@
+ ofstream *out;
+ if (opts.split) {
+ if (getcwd(previous_wd,sizeof(previous_wd))==NULL) {
+- cerr.form(_("cannot get current directory (%s): %s\n"),
+- dirname.c_str(),strerror(errno));
++ cerr << _("cannot get current directory") << " ("
++ << dirname << "): " << strerror(errno) << '\n';
+ return dirreport;
+ }
+ if (chdir(dirname.c_str())) {
+- cerr.form(_("cannot move to dir %s: %s\n"),dirname.c_str(),strerror(errno));
++ cerr << _("cannot move to dir")
++ << dirname << ": " << strerror(errno) << '\n';
+ return dirreport;
+ }
+ if (getcwd(wd,sizeof(wd))==NULL) {
+- cerr.form(_("cannot get current directory (%s): %s\n"),
+- dirname.c_str(),strerror(errno));
++ cerr << _("cannot get current directory")
++ << " (" << dirname << "): " << strerror(errno) << '\n';
+ return dirreport;
+ }
+ char *index = strrchr(wd,'/');
+@@ -150,7 +154,7 @@
+ outfilename += string(".txt");
+
+ if (opts.verbose)
+- cerr.form(_("opening output file '%s'\n"),outfilename.c_str());
++ cerr << _("opening output file") << " '" << outfilename << "'\n";
+
+ out = opts.out;
+ opts.out = new ofstream(outfilename.c_str());
+@@ -162,7 +166,7 @@
+ struct dirent **namelist;
+
+ if ((n = scandir(dirname.c_str(),&namelist,0,alphasort))<0) {
+- cerr.form(_("%s: cannot scan '%s'\n"),APPNAME,dirname.c_str());
++ cerr << APPNAME << ':' << _("cannot scan") << " '" << dirname << "'\n";
+ return dirreport;
+ }
+
+@@ -181,8 +185,9 @@
+ filepathname = dirname + string("/") + string(namelist[i]->d_name);
+
+ if (stat(filepathname.c_str(),&filestat)) {
+- cerr.form(_("%s: error reading '%s' status: %s\n"),
+- APPNAME,dirname.c_str(),strerror(errno));
++ cerr << APPNAME << ": " << _("error reading")
++ << " '" << dirname << "' status: "
++ << strerror(errno) << '\n';
+ continue;
+ }
+
+@@ -284,13 +289,14 @@
+ case 'S': opts.split = true; break;
+ case 'v': opts.verbose = true; break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -304,12 +310,12 @@
+
+ qreport base;
+
+- opts.out = new ofstream(1);
++ opts.out = new ofstream;
+
+ if (opts.split)
+ opts.out = new ofstream("/dev/null");
+ else {
+- opts.out = new ofstream(1);
++ opts.out = new ofstream;
+ if (opts.html)
+ *opts.out << "<html>\n<head><title>qmp3report</title>\n</head>\n\n<body>\n";
+ }
+@@ -319,8 +325,9 @@
+ struct stat filestat;
+
+ if (stat(argv[optind],&filestat)) {
+- cerr.form(_("%s: error reading '%s' status: %s\n"),
+- APPNAME,argv[optind],strerror(errno));
++ cerr << APPNAME << ": " << _("error reading") << " '"
++ << argv[optind] << "' " << _("status") << ": "
++ << strerror(errno) << '\n';
+ continue;
+ }
+
+@@ -358,7 +365,7 @@
+ cout << base << endl;
+ }
+ else {
+- base.html(new ofstream(1));
++ base.html(new ofstream);
+ cout << "<br>" << endl;
+ }
+ }
diff --git a/audio/quelcom/files/patch-bin::qwavcut.cc b/audio/quelcom/files/patch-bin::qwavcut.cc
new file mode 100644
index 000000000000..5755d7d50f2d
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qwavcut.cc
@@ -0,0 +1,41 @@
+--- bin/qwavcut.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qwavcut.cc Fri Feb 13 19:17:38 2004
+@@ -2,6 +2,8 @@
+ # include "qwav.hh"
+ # include "qexception.hh"
+
++#include <iostream>
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -11,9 +13,8 @@
+ #endif
+
+ void usage () {
+-
+- cerr.form(_(" %s: extract and/or delete parts of a wav file\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": extract and/or delete parts of a wav file\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file\n");
+ cerr << _(" options:\n");
+ cerr << _(" -B, --set-begin <cut point>: set the first sample from the beginning of the file\n");
+ cerr << _(" -b, --set-begin-from-eof <cut point>: set the first sample from the end of the file\n");
+@@ -102,13 +103,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
diff --git a/audio/quelcom/files/patch-bin::qwavfade.cc b/audio/quelcom/files/patch-bin::qwavfade.cc
new file mode 100644
index 000000000000..b29c88227c7d
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qwavfade.cc
@@ -0,0 +1,87 @@
+--- bin/qwavfade.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qwavfade.cc Fri Feb 13 19:17:38 2004
+@@ -4,6 +4,8 @@
+ # include "qexception.hh"
+ # include "qmisc.hh"
+
++#include <iostream>
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -14,8 +16,8 @@
+
+ void usage () {
+
+- cerr.form(_(" %s: fade in/out wav files\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ cerr << " " << APPNAME << _(": fade in/out wav files\n");
++ cerr << " " << _("syntax: ") << APPNAME << _("[option]... file...\n");
+ cerr << _(" -d, --duration <duration>[j|s|m|b|k|M]: set the fade duration\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -i, --in: just fade in\n");
+@@ -95,13 +97,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -118,7 +121,7 @@
+ while (argv[optind]) {
+
+ if (verbose)
+- cerr.form(_("fading '%s'...\n"),argv[optind]);
++ cerr << _("fading '") << argv[optind] << "'...\n";
+
+ qwav *wav = new qwav(argv[optind],wavmode);
+ u_int32_t nsamples = wav->getSample(duration); // dins del rang?
+@@ -142,7 +145,7 @@
+ wav->cut(h);
+
+ if (verbose)
+- cerr.form(_("created testfile '%s'\n"),name.c_str());
++ cerr << _("created testfile '") << name << "'\n";
+
+ delete wav;
+ wav = new qwav(name,qwav::READWRITE);
+@@ -157,7 +160,8 @@
+ }
+
+ if (verbose)
+- cerr.form(_("faded in %d samples in '%s'\n"),nsamples,wav->getName().c_str());
++ cerr << _("faded in ") << nsamples << _(" samples in '") << wav->getName()
++ << "'\n";
+ }
+
+ delete wav;
+@@ -176,7 +180,7 @@
+ wav->cut(h);
+
+ if (verbose)
+- cerr.form(_("created testfile '%s'\n"),name.c_str());
++ cerr << _("created testfile ") << name << "'\n";
+
+ delete wav;
+ wav = new qwav(name,qwav::READWRITE);
+@@ -191,7 +195,8 @@
+ }
+
+ if (verbose)
+- cerr.form(_("faded out %d samples in '%s'\n"),nsamples,wav->getName().c_str());
++ cerr << _("faded out ") << nsamples << _(" samples in '")
++ << wav->getName() << "'\n";
+ }
+
+ optind++;
diff --git a/audio/quelcom/files/patch-bin::qwavheaderdump.cc b/audio/quelcom/files/patch-bin::qwavheaderdump.cc
new file mode 100644
index 000000000000..8fe4ffe716b0
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qwavheaderdump.cc
@@ -0,0 +1,243 @@
+--- bin/qwavheaderdump.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qwavheaderdump.cc Fri Feb 13 19:17:38 2004
+@@ -1,7 +1,15 @@
+ # include <getopt.h> // getopt
+ # include <sys/types.h> // u_int16_t, u_int32_t
+ # include "qfile.hh"
++# include "qwavheader.hh"
+ # include "qexception.hh"
++# include "endian.hh"
++
++/* caved in and used C's printf in a few places that don't seem to
++ * be expressible with ios
++ */
++#include <cstdio>
++#include <iostream>
+
+ #ifdef NLS
+ # include <locale.h>
+@@ -29,15 +37,15 @@
+
+ char data[4];
+ u_int32_t datalength;
+-};
++} __attribute__((packed));
+
+ const unsigned int HEADERSIZE = sizeof(struct header);
+
+
+ void usage () {
+
+- cerr.form(_(" %s: dump (and fix) wav header\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ fprintf(stderr,_(" %s: dump (and fix) wav header\n"),APPNAME);
++ fprintf(stderr,_(" syntax: %s [option]... file...\n"),APPNAME);
+ cerr << _(" -F, --fix: correct header. use with care\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -q, --quiet: no output messages\n");
+@@ -86,13 +94,14 @@
+ quiet=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -113,22 +122,33 @@
+ qfile f(argv[optind],openmode);
+
+ if (f.getSize()<HEADERSIZE) {
+- cerr.form(_("%s: '%s' has not enough room for a wav header\n"),
+- APPNAME,f.getName().c_str());
++ cerr << APPNAME << ": '" << f.getName()
++ << _("' has not enough room for a wav header\n");
+ optind++;
+ continue;
+ }
+
++ if ((int)f.getMap() % sizeof(u_int32_t) != 0) {
++ // should never happen with a mapping at offset 0, but if it does,
++ // we need to catch it rather than tossing subtle memory misread
++ // bugs. 32-bit alignment is adequate since no integer in a WAV header
++ // is longer
++ cerr << APPNAME << _(": mapping of header in '") << f.getName()
++ << _("' is not 32-bit aligned\n");
++ optind++;
++ continue;
++ }
++
+ struct header *header = (struct header*) f.getMap();
+
+ cout << f.getName() << " (" << f.getSize() << " bytes):" << endl;
+
+ // the file should have an integer number of samples...
+
+- cout.form("\triff: '%.4s'\n",header->riff);
++ printf("\triff: '%.4s'\n",header->riff);
+ if (strncmp(header->riff,"RIFF",4)) {
+ if (!quiet)
+- cerr.form(_("\t\triff field should be 'RIFF'\n"));
++ fprintf(stderr,_("\t\triff field should be 'RIFF'\n"));
+ if (fix) {
+ strncpy(header->riff,"RIFF",4);
+ if (!quiet)
+@@ -136,21 +156,21 @@
+ }
+ }
+
+- cout.form(_("\triff length: %d\n"),header->rifflength);
+- if (header->rifflength!=f.getSize()-8) {
++ printf(_("\triff length: %d\n"),letohl(header->rifflength));
++ if (letohl(header->rifflength)!=f.getSize()-8) {
+ if (!quiet)
+- cerr.form(_("\t\triff length field should be %d\n"),f.getSize()-8);
++ fprintf(stderr,_("\t\triff length field should be %d\n"),f.getSize()-8);
+ if (fix) {
+- header->rifflength = f.getSize()-8;
++ header->rifflength = htolel(f.getSize()-8);
+ if (!quiet)
+ cerr << _("\t\tfixed\n");
+ }
+ }
+
+- cout.form("\twave: '%.4s'\n",header->wave);
++ printf("\twave: '%.4s'\n",header->wave);
+ if (strncmp(header->wave,"WAVE",4)) {
+ if (!quiet)
+- cerr.form(_("\t\twave field should be 'WAVE'\n"));
++ fprintf(stderr,_("\t\twave field should be 'WAVE'\n"));
+ if (fix) {
+ strncpy(header->wave,"WAVE",4);
+ if (!quiet)
+@@ -158,10 +178,10 @@
+ }
+ }
+
+- cout.form("\tfmt: '%.4s'\n",header->fmt_);
++ printf("\tfmt: '%.4s'\n",header->fmt_);
+ if (strncmp(header->fmt_,"fmt ",4)) {
+ if (!quiet)
+- cerr.form(_("\t\tfmt field should be 'fmt '\n"));
++ fprintf(stderr,_("\t\tfmt field should be 'fmt '\n"));
+ if (fix) {
+ strncpy(header->fmt_,"fmt ",4);
+ if (!quiet)
+@@ -169,32 +189,33 @@
+ }
+ }
+
+- cout.form(_("\tfmt length: %d\n"),header->fmtlength);
+- if (header->fmtlength!=16) {
++ printf(_("\tfmt length: %d\n"),letohl(header->fmtlength));
++ if (letohl(header->fmtlength)!=16) {
+ if (!quiet)
+- cerr.form(_("\t\tfmt length field should be %d\n"),16);
++ fprintf(stderr,_("\t\tfmt length field should be %d\n"),16);
+ if (fix) {
+- header->fmtlength = 16;
++ header->fmtlength = htolel(16);
+ if (!quiet)
+ cerr << _("\t\tfixed\n");
+ }
+ }
+
+- cout.form("\tformat: %d\n",header->format);
+- if (header->format!=1) {
++ printf("\tformat: %d\n",letohs(header->format));
++ if (letohs(header->format)!=1) {
+ if (!quiet)
+- cerr.form(_("\t\tformat field should 1 (pcm tag)\n"),16);
++ fprintf(stderr,_("\t\tformat field should 1 (pcm tag)\n"));
+ if (fix) {
+- header->format = 1;
++ header->format = htoles(1);
+ if (!quiet)
+ cerr << _("\t\tfixed\n");
+ }
+ }
+
+- cout.form(_("\tchannels: %d\n"),header->channels);
+- if (header->channels!=2 && header->channels!=1) {
++ printf(_("\tchannels: %d\n"),letohs(header->channels));
++ if (letohs(header->channels)!=2 &&
++ letohs(header->channels)!=1) {
+ if (!quiet)
+- cerr.form(_("\t\tchannels field should be 1 (mono) or 2 (stereo)\n"));
++ fprintf(stderr,_("\t\tchannels field should be 1 (mono) or 2 (stereo)\n"));
+ if (fix) {
+ cerr << _("\t\tdon't know which value must be set...\n") << endl;
+ if (!quiet)
+@@ -202,33 +223,34 @@
+ }
+ }
+
+- cout.form(_("\tsample rate: %d\n"),header->samplerate);
+- if (header->samplerate>48000 || header->samplerate<8000) {
++ printf(_("\tsample rate: %d\n"),letohl(header->samplerate));
++ if (letohl(header->samplerate)>48000 ||
++ letohl(header->samplerate)<8000) {
+ if (!quiet)
+- cerr.form(_("\t\tsample rate field should be between 8000 and 48000\n"));
++ fprintf(stderr,_("\t\tsample rate field should be between 8000 and 48000\n"));
+ if (fix)
+ cerr << _("\t\tdon't know which value must be set...\n") << endl;
+ }
+
+- cout.form(_("\tbytes/second: %d\n"),header->bytespersec);
++ printf(_("\tbytes/second: %d\n"),letohl(header->bytespersec));
+
+
+- cout.form(_("\tbytes/sample: %d\n"),header->bytespersample);
+- if (header->bytespersample!=1 &&
+- header->bytespersample!=2 &&
+- header->bytespersample!=4) {
++ printf(_("\tbytes/sample: %d\n"),letohs(header->bytespersample));
++ if (letohs(header->bytespersample)!=1 &&
++ letohs(header->bytespersample)!=2 &&
++ letohs(header->bytespersample)!=4) {
+ if (!quiet)
+- cerr.form(_("\t\t bytes/sample field should be 1, 2 or 4\n"));
++ fprintf(stderr,_("\t\t bytes/sample field should be 1, 2 or 4\n"));
+ if (fix)
+ cerr << _("\t\tdon't know which value must be set...\n") << endl;
+ }
+
+- cout.form(_("\tbits/sample: %d\n"),header->bitspersample);
++ printf(_("\tbits/sample: %d\n"),letohs(header->bitspersample));
+
+- cout.form("\tdata: '%.4s'\n",header->data);
++ printf("\tdata: '%.4s'\n",header->data);
+ if (strncmp(header->data,"data",4)) {
+ if (!quiet)
+- cerr.form(_("\t\tdata field should be 'data'\n"));
++ fprintf(stderr,_("\t\tdata field should be 'data'\n"));
+ if (fix) {
+ strncpy(header->data,"data",4);
+ if (!quiet)
+@@ -236,12 +258,12 @@
+ }
+ }
+
+- cout.form(_("\tdata length: %d\n"),header->datalength);
+- if (header->datalength!=f.getSize()-44) {
++ printf(_("\tdata length: %d\n"),letohl(header->datalength));
++ if (letohl(header->datalength)!=f.getSize()-44) {
+ if (!quiet)
+- cerr.form(_("\t\tdata length field should be %d\n"),f.getSize()-44);
++ fprintf(stderr,_("\t\tdata length field should be %d\n"),f.getSize()-44);
+ if (fix) {
+- header->datalength = f.getSize()-44;
++ header->datalength = htolel(f.getSize()-44);
+ if (!quiet)
+ cerr << _("\t\tfixed\n");
+ }
diff --git a/audio/quelcom/files/patch-bin::qwavinfo.cc b/audio/quelcom/files/patch-bin::qwavinfo.cc
new file mode 100644
index 000000000000..9a9193ffc225
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qwavinfo.cc
@@ -0,0 +1,61 @@
+--- bin/qwavinfo.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qwavinfo.cc Fri Feb 13 19:17:38 2004
+@@ -4,6 +4,9 @@
+ # include "qwav.hh"
+ # include "qexception.hh"
+
++#include <iostream>
++#include <cstdio>
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -14,9 +17,8 @@
+
+
+ void usage () {
+-
+- cerr.form(_(" %s: show info from wav files\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": show info from wav files\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file...\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -s, --summary-only: show only the summary\n");
+ cerr << _(" -v, --verbose: verbose\n");
+@@ -66,13 +68,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -124,14 +127,14 @@
+ optind++;
+ }
+
+- cout.form (_("%u file%c"),files,files>1?'s':0);
++ printf (_("%u file%c"),files,files>1?'s':0);
+ if (errors)
+- cout.form (" (%u error%c)",errors,errors>1?'s':0);
++ printf (" (%u error%c)",errors,errors>1?'s':0);
+ if (verbose)
+- cout.form (_(" => %d:%02d.%03d %u samples %u bytes\n"),
++ printf (_(" => %d:%02d.%03d %u samples %u bytes\n"),
+ total_msduration/60000,(total_msduration/1000)%60,
+ total_msduration%1000,total_samples,total_bytes);
+ else
+- cout.form (" => %d:%02d\n",
++ printf (" => %d:%02d\n",
+ total_msduration/60000,(total_msduration/1000)%60);
+ }
diff --git a/audio/quelcom/files/patch-bin::qwavjoin.cc b/audio/quelcom/files/patch-bin::qwavjoin.cc
new file mode 100644
index 000000000000..9da254915b89
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qwavjoin.cc
@@ -0,0 +1,61 @@
+--- bin/qwavjoin.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qwavjoin.cc Fri Feb 13 19:17:38 2004
+@@ -2,6 +2,8 @@
+ # include "qwav.hh"
+ # include "qexception.hh"
+
++#include <iostream>
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -12,9 +14,8 @@
+
+
+ void usage () {
+-
+- cerr.form(_(" %s: join wav files\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file1 file2...\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": join wav files\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file1 file2...\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -o, --output <file>: send output to <file>. otherwise, append to <file1>\n");
+ cerr << _(" -v, --verbose: verbose\n");
+@@ -64,13 +65,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -91,7 +93,7 @@
+ if (outfile!="") {
+ wav = new qwav(*argv);
+ if (verbose)
+- cerr.form(_("copying '%s' to '%s'..."),*argv,outfile.c_str());
++ cerr << _("copying '") << *argv << _("' to '") << outfile << "'...";
+ wav->dup(outfile);
+ if (verbose)
+ cerr << "ok." << endl;
+@@ -106,8 +108,8 @@
+ qwav ww(*argv);
+
+ if (verbose)
+- cerr.form(_("appending '%s' to '%s'..."),
+- ww.getName().c_str(),wav->getName().c_str());
++ cerr << _("appending '") << ww.getName() << _("' to '")
++ << wav->getName() << "'...";
+ wav->append(ww);
+ if (verbose)
+ cerr << "ok." << endl;
diff --git a/audio/quelcom/files/patch-bin::qwavsilence.cc b/audio/quelcom/files/patch-bin::qwavsilence.cc
new file mode 100644
index 000000000000..40ac402c3de9
--- /dev/null
+++ b/audio/quelcom/files/patch-bin::qwavsilence.cc
@@ -0,0 +1,105 @@
+--- bin/qwavsilence.cc.orig Fri Feb 23 21:29:12 2001
++++ bin/qwavsilence.cc Fri Feb 13 19:17:38 2004
+@@ -4,6 +4,9 @@
+ # include "qexception.hh"
+ # include "qmisc.hh"
+
++#include <iostream>
++#include <cstdio>
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -14,9 +17,8 @@
+
+
+ void usage () {
+-
+- cerr.form(_(" %s: detect and shrink silence sequence in wav files\n"),APPNAME);
+- cerr.form(_(" syntax: %s [option]... file...\n"),APPNAME);
++ cerr << ' ' << APPNAME << _(": detect and shrink silence sequence in wav files\n");
++ cerr << _(" syntax: ") << APPNAME << _(" [option]... file...\n");
+ cerr << _(" -d, --duration <duration>[j|s|m|b|k|M]: set the minimum silence duration.\n");
+ cerr << _(" -h, --help: show this help and exit\n");
+ cerr << _(" -l, --length [[h:]m:]s[.ms]: set the minimum silence duration.\n");
+@@ -84,7 +86,7 @@
+ case 't':
+ temp = strtod(optarg,0);
+ if (temp<0 || temp>100) {
+- cerr.form(_("%s: threshold must be 0..100 (%d)\n"),APPNAME,temp);
++ fprintf(stderr,_("%s: threshold must be 0..100 (%d)\n"),APPNAME,(int)temp);
+ return 1;
+ }
+ threshold = (u_int32_t)temp;
+@@ -93,13 +95,14 @@
+ verbose=true;
+ break;
+ case 'V':
+- cerr.form(_("%s - version %s - build %s\n"),APPNAME,VERSION,__DATE__);
++ cerr << APPNAME << " - " << _("version") << ' ' << VERSION
++ << _("build") << ' ' << __DATE__ << '\n';
+ return 0;
+ break;
+ case '?':
+ default:
+- cerr.form(_("%s: option '%s' is not recognized or bad used\n"),
+- APPNAME,argv[optind-1]);
++ cerr << APPNAME << ": " << _("option") << " '" << argv[optind-1]
++ << "' " << _("is not recognized or bad used") << '\n';
+ usage();
+ return 1;
+ }
+@@ -173,12 +176,12 @@
+ mssec_end = (1000LL*silent_samples)/wav.getSampleRate();
+
+ if (!verbose)
+- cout.form(_("%s: %d:%02d of silence at %d:%02d\n"),
++ printf(_("%s: %d:%02d of silence at %d:%02d\n"),
+ argv[optind],
+ mssec_end/60000,(mssec_end/1000)%60,
+ mssec_begin/60000,(mssec_begin/1000)%60);
+ else
+- cout.form(_("%s: %d:%02d.%03d (%d samples) at %d:%02d:%03d (sample %d)\n"),
++ printf(_("%s: %d:%02d.%03d (%d samples) at %d:%02d:%03d (sample %d)\n"),
+ argv[optind],
+ mssec_end/60000,(mssec_end/1000)%60,mssec_end%1000,
+ silent_samples,
+@@ -190,11 +193,11 @@
+ if (shrink) {
+ u_int32_t shrinkable_samples = silent_samples - duration_samples;
+
+- cerr.form(_("shrink %d samples at %d\n"),
++ fprintf(stderr,_("shrink %d samples at %d\n"),
+ shrinkable_samples,sample_index - shrinkable_samples - 1);
+ if (shrinked_samples) {
+ u_int32_t samples_moved = sample_index-shrinkable_samples-(first_shrinkable_sample+shrinked_samples+1);
+- cerr.form(_("move %d..%d (%d samples) to %d..%d\n"),
++ fprintf(stderr,_("move %d..%d (%d samples) to %d..%d\n"),
+ first_shrinkable_sample+shrinked_samples+1,
+ sample_index-shrinkable_samples-1,
+ samples_moved,
+@@ -232,7 +235,7 @@
+ else { // sortim del bucle pq s'ha acabat el fitxer...
+ if (shrink && shrinked_samples) {
+ u_int32_t samples_moved = sample_number-(first_shrinkable_sample+shrinked_samples+1);
+- cerr.form(_("move %d..%d (%d samples) to %d..%d\n"),
++ fprintf(stderr,_("move %d..%d (%d samples) to %d..%d\n"),
+ first_shrinkable_sample+shrinked_samples+1,
+ sample_number,
+ samples_moved,
+@@ -247,7 +250,7 @@
+
+ if (verbose) {
+ u_int32_t mssec = 1000LL*total_silent_samples/wav.getSampleRate();
+- cerr.form(_("%s: total silence reported: %d:%02d.%02d (%d samples)\n"),
++ fprintf(stderr,_("%s: total silence reported: %d:%02d.%02d (%d samples)\n"),
+ argv[optind],mssec/60000,(mssec/1000)%60,(mssec%1000)/10,
+ total_silent_samples);
+ }
+@@ -267,5 +270,5 @@
+ }
+
+ if (errors)
+- cout.form ("%u error%c\n",errors,errors>1?'s':0);
++ printf ("%u error%c\n",errors,errors>1?'s':0);
+ }
diff --git a/audio/quelcom/files/patch-lib::endian.hh b/audio/quelcom/files/patch-lib::endian.hh
new file mode 100644
index 000000000000..6643a15f57f4
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::endian.hh
@@ -0,0 +1,39 @@
+--- lib/endian.hh.orig Fri Feb 13 19:17:38 2004
++++ lib/endian.hh Fri Feb 13 19:17:38 2004
+@@ -0,0 +1,36 @@
++#ifndef _endian_hh_
++#define _endian_hh_
++
++/* quick and dirty endian conversion macros; applicable on big-endian
++ * architectures. This works okay on big- and little-endian machines, but
++ * not on middle-endian ones, should the "Linux on PDP-11" thing ever get
++ * past the April Fool's stage.
++ */
++
++#if __BYTE_ORDER == __BIG_ENDIAN
++
++static inline u_int16_t letohs(u_int16_t n) { return (n<<8)|(n>>8); }
++static inline u_int32_t letohl(u_int32_t n) {
++ return (n<<24) | ((n&0xff00)<<8) | ((n&0xff0000)>>8) | (n>>24);
++}
++static inline u_int16_t htoles(u_int16_t n) { return letohs(n); }
++static inline u_int32_t htolel(u_int32_t n) { return letohl(n); }
++
++static inline int16_t letohs_s(int16_t n) {
++ unsigned char *p = (unsigned char *)&n, tmp;
++ tmp = p[0]; p[0] = p[1]; p[1] = tmp;
++ return n;
++}
++static inline int16_t htoles_s(int16_t n) { return letohs_s(n); }
++#elif __BYTE_ORDER == __LITTLE_ENDIAN
++static inline u_int16_t letohs(u_int16_t n) { return n; }
++static inline u_int32_t letohl(u_int32_t n) { return n; }
++static inline u_int16_t htoles(u_int16_t n) { return n; }
++static inline u_int32_t htolel(u_int32_t n) { return n; }
++
++static inline int16_t letohs_s(int16_t n) { return n; }
++static inline int16_t htoles_s(int16_t n) { return n; }
++#endif
++
++#endif
++
diff --git a/audio/quelcom/files/patch-lib::qcuthandler.cc b/audio/quelcom/files/patch-lib::qcuthandler.cc
new file mode 100644
index 000000000000..65e9afd3bd8d
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qcuthandler.cc
@@ -0,0 +1,11 @@
+--- lib/qcuthandler.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qcuthandler.cc Fri Feb 13 19:17:38 2004
+@@ -2,6 +2,8 @@
+ * implementation functions for class qcuthandler
+ */
+
++#include <iostream>
++
+ # include "qcuthandler.hh"
+ # include "qmisc.hh"
+ # include "qexception.hh"
diff --git a/audio/quelcom/files/patch-lib::qcuthandler.hh b/audio/quelcom/files/patch-lib::qcuthandler.hh
new file mode 100644
index 000000000000..05f13f34a9d6
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qcuthandler.hh
@@ -0,0 +1,13 @@
+--- lib/qcuthandler.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qcuthandler.hh Fri Feb 13 19:17:38 2004
+@@ -8,7 +8,9 @@
+ # include <string>
+
+ # include "qvf.hh"
+-
++
++using namespace std;
++
+ /*!
+ * \brief class for file-cut specifications
+ *
diff --git a/audio/quelcom/files/patch-lib::qexception.hh b/audio/quelcom/files/patch-lib::qexception.hh
new file mode 100644
index 000000000000..24e09c35a4b0
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qexception.hh
@@ -0,0 +1,11 @@
+--- lib/qexception.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qexception.hh Fri Feb 13 19:17:38 2004
+@@ -5,6 +5,8 @@
+ # ifndef _qexception_hh_
+ # define _qexception_hh_
+
++using namespace std;
++
+ #include <string>
+
+ /*!
diff --git a/audio/quelcom/files/patch-lib::qfile.hh b/audio/quelcom/files/patch-lib::qfile.hh
new file mode 100644
index 000000000000..270ac8814cd2
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qfile.hh
@@ -0,0 +1,10 @@
+--- lib/qfile.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qfile.hh Fri Feb 13 19:17:38 2004
+@@ -9,6 +9,7 @@
+ # include <sys/stat.h> // struct stat, fstat
+ # include <sys/types.h> // u_int32_t
+
++using namespace std;
+
+ /*!
+ * \brief class for mapped files.
diff --git a/audio/quelcom/files/patch-lib::qmisc.cc b/audio/quelcom/files/patch-lib::qmisc.cc
new file mode 100644
index 000000000000..ed0256e07629
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qmisc.cc
@@ -0,0 +1,11 @@
+--- lib/qmisc.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qmisc.cc Fri Feb 13 19:17:38 2004
+@@ -7,7 +7,7 @@
+ # include <stdio.h>
+ # include <stdlib.h>
+ # include "qexception.hh"
+-# include <iostream.h>
++# include <iostream>
+ # include <math.h>
+
+ #ifdef NLS
diff --git a/audio/quelcom/files/patch-lib::qmp3.cc b/audio/quelcom/files/patch-lib::qmp3.cc
new file mode 100644
index 000000000000..b5493daf07eb
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qmp3.cc
@@ -0,0 +1,47 @@
+--- lib/qmp3.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qmp3.cc Fri Feb 13 19:17:38 2004
+@@ -2,6 +2,10 @@
+ * implementation functions for class qmp3
+ */
+
++using namespace std;
++
++#include <iostream>
++
+ # include "qmp3.hh"
+ # include "qexception.hh"
+ # include "qmisc.hh"
+@@ -67,7 +71,7 @@
+ }
+
+
+-qmp3::qmp3(string name, u_int32_t flags=READ)
++qmp3::qmp3(string name, u_int32_t flags)
+ : qfile (name,flags),
+ qmp3frameheader (qfile::getMap()),
+ qtag (qfile::getMap()+getSize()-qtag::LENGTH) {
+@@ -114,7 +118,7 @@
+ return false;
+ }
+
+-u_int32_t qmp3::scan (u_int32_t bufsize=0) {
++u_int32_t qmp3::scan (u_int32_t bufsize) {
+
+ if (!bufsize)
+ bufsize = getStreamLength();
+@@ -178,8 +182,13 @@
+ *os << "[vbr]";
+
+ msduration = getMsDuration();
+- os->form(" %d:%02d.%03d ",
+- msduration/60000,(msduration/1000)%60,msduration%1000);
++ *os << " " << msduration/60000 << ":";
++ os->width(2);
++ os->fill('0');
++ *os << (msduration/1000)%60 << '.';
++ os->width(3);
++ os->fill('0');
++ *os << msduration%1000 << " ";
+
+ if (hasTag)
+ this->qtag::print(os);
diff --git a/audio/quelcom/files/patch-lib::qmp3.hh b/audio/quelcom/files/patch-lib::qmp3.hh
new file mode 100644
index 000000000000..54a4348387db
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qmp3.hh
@@ -0,0 +1,11 @@
+--- lib/qmp3.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qmp3.hh Fri Feb 13 19:17:38 2004
+@@ -5,6 +5,8 @@
+ # ifndef _qmp3_hh_
+ # define _qmp3_hh_
+
++using namespace std;
++
+ # include <string>
+
+ # include "qfile.hh"
diff --git a/audio/quelcom/files/patch-lib::qmp3frameheader.cc b/audio/quelcom/files/patch-lib::qmp3frameheader.cc
new file mode 100644
index 000000000000..5dab510576eb
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qmp3frameheader.cc
@@ -0,0 +1,289 @@
+--- lib/qmp3frameheader.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qmp3frameheader.cc Fri Feb 13 19:17:38 2004
+@@ -4,6 +4,7 @@
+
+ # include "qmp3frameheader.hh"
+ # include "qexception.hh"
++# include "endian.hh"
+
+ #ifdef NLS
+ # include <locale.h>
+@@ -46,21 +47,20 @@
+
+ static u_int32_t samplesPerFrame[4] = { 1152, 1152, 384, 0 };
+
+-string qmp3frameheader::getLayer() { return string(layers[header->layer]);}
+-u_int32_t qmp3frameheader::getSamplesPerFrame() { return samplesPerFrame[header->layer]; }
+-string qmp3frameheader::getVersion() { return string(versions[header->version]);}
++string qmp3frameheader::getLayer() { return string(layers[header.layer]);}
++u_int32_t qmp3frameheader::getSamplesPerFrame() { return samplesPerFrame[header.layer]; }
++string qmp3frameheader::getVersion() { return string(versions[header.version]);}
+
+
+-caddr_t qmp3frameheader::getMap() {return (caddr_t)header;}
++caddr_t qmp3frameheader::getMap() {return (caddr_t)mappedheader;}
+ void qmp3frameheader::remap(caddr_t p) {
+-
+- header = (struct header*)p;
++ setHeader(p);
+ }
+
+-u_int32_t qmp3frameheader::getSignature() {return (*(u_int32_t*)header)&MASK;}
++u_int32_t qmp3frameheader::getSignature() {return letohl(*(u_int32_t *)mappedheader)&MASK;}
+ u_int32_t qmp3frameheader::getSampleRate() {
+
+- return samplerates[header->version][header->samplerate];
++ return samplerates[header.version][header.samplerate];
+ }
+
+
+@@ -76,28 +76,32 @@
+
+
+ bool qmp3frameheader::valid (caddr_t p) {
++ struct header header;
++
++ if (p == NULL)
++ return false;
+
+- struct header *header = (struct header*)p;
++ copyHeader(&header, p);
+
+- return ( (header->sync1 == 0xff) &&
+- (header->sync2 == 0x7) &&
+- (header->version != UNDEFINED_VERSION) &&
+- (header->layer != 0) &&
+- (header->bitrate != 0x0f) &&
+- (header->samplerate != 0x03) &&
+- (header->emphasis != 0x02) );
++ return ( (header.sync1 == 0xff) &&
++ (header.sync2 == 0x7) &&
++ (header.version != UNDEFINED_VERSION) &&
++ (header.layer != 0) &&
++ (header.bitrate != 0x0f) &&
++ (header.samplerate != 0x03) &&
++ (header.emphasis != 0x02) );
+ }
+
+
+ bool qmp3frameheader::valid () {
+
+- return ! ( (header->sync1 != 0xff) ||
+- (header->sync2 != 0x7) ||
+- (header->version == UNDEFINED_VERSION) ||
+- (header->layer == 0) ||
+- (header->bitrate == 0x0f) ||
+- (header->samplerate == 0x03) ||
+- (header->emphasis == 0x02) );
++ return ! ( (header.sync1 != 0xff) ||
++ (header.sync2 != 0x7) ||
++ (header.version == UNDEFINED_VERSION) ||
++ (header.layer == 0) ||
++ (header.bitrate == 0x0f) ||
++ (header.samplerate == 0x03) ||
++ (header.emphasis == 0x02) );
+ }
+
+
+@@ -105,26 +109,28 @@
+
+
+ bool qmp3frameheader::compatible(caddr_t p, u_int32_t signature) {
+- return ((*(u_int32_t*)p)&(MASK)) == signature;
++ return (letohl(*(u_int32_t *)p)&MASK) == signature;
+ }
+
+
+ u_int32_t qmp3frameheader::setNext(u_int32_t bufsize) {
++ caddr_t supposed= (char*)mappedheader+getLength();
+
+- caddr_t supposed= (char*)header+getLength();
++ setHeader(seek_header(supposed,bufsize,getSignature()));
+
+- header = (struct header*) seek_header(supposed,bufsize,getSignature());
+-
+- return (char*)header-(char*)supposed;
++ return (char*)mappedheader-(char*)supposed;
+ }
+
+ u_int32_t qmp3frameheader::setNext(caddr_t endstream) {
+
+- caddr_t previous = (caddr_t) header;
++ caddr_t previous = (caddr_t) mappedheader;
++ caddr_t next;
++
++ next = seek_header((char*)mappedheader+getLength(),(char*)endstream-(char*)mappedheader+1,getSignature());
+
+- header = (struct header*) seek_header((char*)header+getLength(),(char*)endstream-(char*)header+1,getSignature());
++ setHeader(next);
+
+- return (char*)header-(char*)previous-getLength();
++ return (char*)mappedheader-(char*)previous-getLength();
+ }
+
+
+@@ -156,7 +162,59 @@
+
+ qmp3frameheader::qmp3frameheader(caddr_t p, u_int32_t bufsize, u_int32_t signature) {
+
+- header = (struct header*) seek_header(p,bufsize,signature);
++ setHeader(seek_header(p,bufsize,signature));
++}
++
++
++void qmp3frameheader::setHeader(caddr_t p)
++{
++ mappedheader = (struct header *)p;
++ copyHeader(&header, p);
++}
++
++void qmp3frameheader::copyHeader(struct header *header, caddr_t p)
++{
++ unsigned char b = *(unsigned char *)p;
++
++ header->sync1 = b;
++
++ b = *(++p);
++ header->protection = b & 0x1;
++ header->layer = (b>>1) & 0x3;
++ header->version = (b>>3) & 0x3;
++ header->sync2 = (b>>5) & 0x7;
++
++ b = *(++p);
++ header->privat = b & 0x1;
++ header->padding = (b>>1) & 0x1;
++ header->samplerate = (b>>2) & 0x3;
++ header->bitrate = (b>>4) & 0xf;
++
++ b = *(++p);
++ header->emphasis = b & 0x3;
++ header->original = (b>>2) & 0x1;
++ header->copyright = (b>>3) & 0x1;
++ header->mode_extension = (b>>4) & 0x3;
++ header->channel_mode = (b>>6) & 0x3;
++}
++
++void qmp3frameheader::copyHeader(caddr_t p, struct header &header)
++{
++ *(p++) = header.sync1;
++
++ *(p++) = (header.protection |
++ header.layer << 1 |
++ header.version << 3 |
++ header.sync2 << 5);
++ *(p++) = (header.privat |
++ header.padding << 1 |
++ header.samplerate << 2 |
++ header.bitrate << 4);
++ *(p++) = (header.emphasis |
++ header.original << 2 |
++ header.copyright << 3 |
++ header.mode_extension << 4 |
++ header.channel_mode << 6);
+ }
+
+
+@@ -164,20 +222,20 @@
+
+ switch (f) {
+
+- case SYNC1: return header->sync1;
+- case SYNC2: return header->sync2;
+- case _VERSION: return header->version;
+- case LAYER: return header->layer;
+- case PROTECTION: return header->protection;
+- case BITRATE: return header->bitrate;
+- case SAMPLERATE: return header->samplerate;
+- case PADDING: return header->padding;
+- case PRIVAT: return header->privat;
+- case CHANNEL_MODE: return header->channel_mode;
+- case MODE_EXTENSION: return header->mode_extension;
+- case COPYRIGHT: return header->copyright;
+- case ORIGINAL: return header->original;
+- case EMPHASIS: return header->emphasis;
++ case SYNC1: return header.sync1;
++ case SYNC2: return header.sync2;
++ case _VERSION: return header.version;
++ case LAYER: return header.layer;
++ case PROTECTION: return header.protection;
++ case BITRATE: return header.bitrate;
++ case SAMPLERATE: return header.samplerate;
++ case PADDING: return header.padding;
++ case PRIVAT: return header.privat;
++ case CHANNEL_MODE: return header.channel_mode;
++ case MODE_EXTENSION: return header.mode_extension;
++ case COPYRIGHT: return header.copyright;
++ case ORIGINAL: return header.original;
++ case EMPHASIS: return header.emphasis;
+ default:
+ throw qexception(__PRETTY_FUNCTION__,_("invalid field"));
+ // i pintar el valor...
+@@ -189,34 +247,35 @@
+
+ switch (f) {
+
+- case SYNC1: header->sync1 = v; break;
+- case SYNC2: header->sync2 = v; break;
+- case _VERSION: header->version = v; break;
+- case LAYER: header->layer = v; break;
+- case PROTECTION: header->protection = v; break;
+- case BITRATE: header->bitrate = v; break;
+- case SAMPLERATE: header->samplerate = v; break;
+- case PADDING: header->padding = v; break;
+- case PRIVAT: header->privat = v; break;
+- case CHANNEL_MODE: header->channel_mode = v; break;
+- case MODE_EXTENSION: header->mode_extension = v; break;
+- case COPYRIGHT: header->copyright = v; break;
+- case ORIGINAL: header->original = v; break;
+- case EMPHASIS: header->emphasis = v; break;
++ case SYNC1: header.sync1 = v; break;
++ case SYNC2: header.sync2 = v; break;
++ case _VERSION: header.version = v; break;
++ case LAYER: header.layer = v; break;
++ case PROTECTION: header.protection = v; break;
++ case BITRATE: header.bitrate = v; break;
++ case SAMPLERATE: header.samplerate = v; break;
++ case PADDING: header.padding = v; break;
++ case PRIVAT: header.privat = v; break;
++ case CHANNEL_MODE: header.channel_mode = v; break;
++ case MODE_EXTENSION: header.mode_extension = v; break;
++ case COPYRIGHT: header.copyright = v; break;
++ case ORIGINAL: header.original = v; break;
++ case EMPHASIS: header.emphasis = v; break;
+ default:
+ throw qexception(__PRETTY_FUNCTION__,_("invalid field"));
+ // i pintar el valor...
+ }
++ copyHeader((caddr_t)mappedheader, header);
+ }
+
+
+ u_int32_t qmp3frameheader::getLength() {
+
+- if (header->layer!=LAYER3)
++ if (header.layer!=LAYER3)
+ throw qexception (__PRETTY_FUNCTION__,_("layer not supported"));
+ // i dir quin valor...
+
+- return (144 * getBitRate() * 1000) / getSampleRate() + header->padding;
++ return (144 * getBitRate() * 1000) / getSampleRate() + header.padding;
+ }
+
+ u_int32_t qmp3frameheader::getMsDuration() {
+@@ -236,13 +295,13 @@
+
+ u_int32_t qmp3frameheader::getBitRate() {
+
+- if (header->layer!=LAYER3)
++ if (header.layer!=LAYER3)
+ throw qexception (__PRETTY_FUNCTION__,_("only layer III is supported"));
+
+- if (header->version==UNDEFINED_VERSION)
++ if (header.version==UNDEFINED_VERSION)
+ throw qexception (__PRETTY_FUNCTION__,_("undefined version"));
+
+- return layer3_bitrates[header->version][header->bitrate];
++ return layer3_bitrates[header.version][header.bitrate];
+ }
+
+
diff --git a/audio/quelcom/files/patch-lib::qmp3frameheader.hh b/audio/quelcom/files/patch-lib::qmp3frameheader.hh
new file mode 100644
index 000000000000..2a3255cb82eb
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qmp3frameheader.hh
@@ -0,0 +1,37 @@
+--- lib/qmp3frameheader.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qmp3frameheader.hh Fri Feb 13 19:17:38 2004
+@@ -7,6 +7,9 @@
+
+ # include <sys/types.h>
+ # include <string>
++# include <iostream>
++
++using namespace std;
+
+ /*!
+ * \brief class for mp3 frame headers
+@@ -39,9 +42,9 @@
+ mode_extension:2, /*!< type of joint stereo coding */
+ channel_mode:2; /*!< mono or which type of stereo */
+ };
+-
++
+ //! pointer to the header (memory location where it is located)
+- struct header *header;
++ struct header header, *mappedheader;
+
+ public:
+
+@@ -101,6 +104,12 @@
+ qmp3frameheader();
+ qmp3frameheader(caddr_t p, u_int32_t bufsize = HEADERSIZE, u_int32_t signature=0);
+
++ // copy and endian-translate the frame header
++ static void copyHeader(struct header *header, caddr_t p);
++ static void copyHeader(caddr_t p, struct header &header);
++
++ void setHeader(caddr_t p);
++
+ // direct access to the header
+ u_int32_t get();
+ void set(u_int32_t h);
diff --git a/audio/quelcom/files/patch-lib::qreport.cc b/audio/quelcom/files/patch-lib::qreport.cc
new file mode 100644
index 000000000000..559e8eefdc77
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qreport.cc
@@ -0,0 +1,155 @@
+--- lib/qreport.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qreport.cc Fri Feb 13 19:17:38 2004
+@@ -165,7 +165,18 @@
+ // if (msduration>0) {
+ // no ho deixis així!!!!
+ int dur = msduration;
+- os->form("%3d:%02d:%02d",dur/3600000,(dur%3600000)/60000,(dur%60000)/1000);
++
++ os->width(3);
++ os->fill('0');
++ *os << dur/3600000 << ':';
++ os->width(2);
++ os->fill('0');
++ *os << (dur%3600000) << ':';
++ os->width(2);
++ os->fill('0');
++ *os << (dur%60000)/1000;
++
++// os->form("%3d:%02d:%02d",dur/3600000,(dur%3600000)/60000,(dur%60000)/1000);
+ // }
+ // else
+ // *os << " ";
+@@ -176,7 +187,9 @@
+ case 0: *os << " "; break;
+ case (u_int32_t)(-1): *os << " [vbr] "; break;
+ default:
+- os->form("%3d kbps",bitrate);
++ os->width(3);
++ *os << bitrate << " kbps";
++// os->form("%3d kbps",bitrate);
+ }
+
+ *os << " - ";
+@@ -190,7 +203,9 @@
+ */
+
+ // if (size>0)
+- os->form("%4.2f Mb",(double)size/(1024*1024));
++ os->precision(2);
++ *os << (double)size/(1024*1024) << " Mb";
++// os->form("%4.2f Mb",(double)size/(1024*1024));
+ // else
+ // *os << " ";
+
+@@ -233,11 +248,15 @@
+ *os << "<a href=\"file://" << htmlize(name) << "\">" << name << "</a>: ";
+ else
+ */
+- os->form("%-64s",name.c_str());
++ os->width(64);
++ *os << name;
++// os->form("%-64s",name.c_str());
+ break;
+ case MP3:
+ // *os << "bliblablo";
+- os->form("%-64s",name.c_str());
++ os->width(64);
++ *os << name;
++// os->form("%-64s",name.c_str());
+ break;
+ case DIR:
+ /*
+@@ -245,10 +264,14 @@
+ *os << "<a href=\"file://" << htmlize(name) << "\">" << name << "</a>: ";
+ else
+ */
+- os->form("%-64s ",name.c_str());
++ os->width(64);
++ *os << name;
++// os->form("%-64s ",name.c_str());
+ if (directories>1) // other than itself
+ *os << directories-1 << _(" directories ");
+- os->form("%3d file%c ",files,(files==1)?' ':'s');
++ os->width(3);
++ *os << files << " file" << (files==1)?' ' : 's';
++// os->form("%3d file%c ",files,(files==1)?' ':'s');
+ break;
+ }
+
+@@ -265,7 +288,17 @@
+ // if (msduration>0) {
+ // no ho deixis així!!!!
+ int dur = msduration;
+- os->form("%3d:%02d:%02d",dur/3600000,(dur%3600000)/60000,(dur%60000)/1000);
++
++ os->width(3);
++ os->fill('0');
++ *os << dur/3600000 << ':';
++ os->width(2);
++ os->fill('0');
++ *os << (dur%3600000) << ':';
++ os->width(2);
++ os->fill('0');
++ *os << (dur%60000)/1000;
++ //os->form("%3d:%02d:%02d",dur/3600000,(dur%3600000)/60000,(dur%60000)/1000);
+ // }
+ // else
+ // *os << " ";
+@@ -277,7 +310,9 @@
+ case 0: *os << " "; break;
+ case (u_int32_t)(-1): *os << " [vbr] "; break;
+ default:
+- os->form("%3d kbps",bitrate);
++ os->width(3);
++ *os << bitrate << " kbps";
++// os->form("%3d kbps",bitrate);
+ }
+
+ *os << " - ";
+@@ -291,7 +326,9 @@
+ */
+
+ // if (size>0)
+- os->form("%4.2f Mb",(double)size/(1024*1024));
++ os->precision(2);
++ *os << (double)size/(1024*1024) << " Mb";
++// os->form("%4.2f Mb",(double)size/(1024*1024));
+ // else
+ // *os << " ";
+
+@@ -328,11 +365,15 @@
+ *os << "<a href=\"file://" << htmlize(name) << "\">" << name << "</a>: ";
+ else
+ */
+- os->form("%-64s",name.c_str());
++ os->width(64);
++ *os << name;
++// os->form("%-64s",name.c_str());
+ break;
+ case MP3:
+ // *os << "bliblablo";
+- os->form("%-64s",name.c_str());
++ os->width(64);
++ *os << name;
++// os->form("%-64s",name.c_str());
+ break;
+ case DIR:
+ /*
+@@ -340,10 +381,14 @@
+ *os << "<a href=\"file://" << htmlize(name) << "\">" << name << "</a>: ";
+ else
+ */
+- os->form("%-64s ",name.c_str());
++ os->width(64);
++ *os << name;
++// os->form("%-64s ",name.c_str());
+ if (directories>1) // other than itself
+ *os << directories-1 << _(" directories ");
+- os->form("%3d file%c ",files,(files==1)?' ':'s');
++ os->width(3);
++ *os << files << " file" << (files==1)?' ':'s';
++// os->form("%3d file%c ",files,(files==1)?' ':'s');
+ break;
+ }
+
diff --git a/audio/quelcom/files/patch-lib::qreport.hh b/audio/quelcom/files/patch-lib::qreport.hh
new file mode 100644
index 000000000000..364731588fd9
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qreport.hh
@@ -0,0 +1,10 @@
+--- lib/qreport.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qreport.hh Fri Feb 13 19:17:38 2004
+@@ -11,6 +11,7 @@
+ # include "qfile.hh"
+ # include "qmp3.hh"
+
++using namespace std;
+
+ class qreport {
+
diff --git a/audio/quelcom/files/patch-lib::qtag.cc b/audio/quelcom/files/patch-lib::qtag.cc
new file mode 100644
index 000000000000..ee3d25066bf5
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qtag.cc
@@ -0,0 +1,27 @@
+--- lib/qtag.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qtag.cc Fri Feb 13 19:17:38 2004
+@@ -2,6 +2,8 @@
+ * implementation functions for class qtag
+ */
+
++#include <iostream>
++
+ # include "qtag.hh"
+ # include "qmisc.hh"
+ # include "qexception.hh"
+@@ -118,8 +120,13 @@
+
+
+ void qtag::print (ostream *os) {
+-
+- os->form ("%-0.30s - %-0.30s - %-0.30s",tag->artist,tag->album,tag->title);
++ os->width(30);
++ *os << tag->artist << " - ";
++ os->width(30);
++ *os << tag->album << " - ";
++ os->width(30);
++ *os << tag->title;
++// os->form ("%-0.30s - %-0.30s - %-0.30s",tag->artist,tag->album,tag->title);
+ }
+
+
diff --git a/audio/quelcom/files/patch-lib::qtag.hh b/audio/quelcom/files/patch-lib::qtag.hh
new file mode 100644
index 000000000000..70515670c2bc
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qtag.hh
@@ -0,0 +1,10 @@
+--- lib/qtag.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qtag.hh Fri Feb 13 19:17:38 2004
+@@ -8,6 +8,7 @@
+ # include "qfile.hh"
+ # include <sys/types.h>
+
++using namespace std;
+
+ /*!
+ * \brief class for mp3 tags
diff --git a/audio/quelcom/files/patch-lib::qvf.cc b/audio/quelcom/files/patch-lib::qvf.cc
new file mode 100644
index 000000000000..d4a80503c73e
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qvf.cc
@@ -0,0 +1,20 @@
+--- lib/qvf.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qvf.cc Fri Feb 13 19:17:38 2004
+@@ -4,6 +4,8 @@
+
+ # include <stdio.h> // sscanf
+
++using namespace std;
++
+ #ifdef NLS
+ # include <locale.h>
+ # include <libintl.h>
+@@ -54,7 +56,7 @@
+ }
+
+
+-qvf::qvf(u_int32_t v, enum format f=SPECIFIC):value(v),format(f) { }
++qvf::qvf(u_int32_t v, enum format f):value(v),format(f) { }
+
+
+ qvf::qvf(char *s) {
diff --git a/audio/quelcom/files/patch-lib::qvf.hh b/audio/quelcom/files/patch-lib::qvf.hh
new file mode 100644
index 000000000000..f620fd6f9a73
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qvf.hh
@@ -0,0 +1,23 @@
+--- lib/qvf.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qvf.hh Fri Feb 13 19:17:38 2004
+@@ -5,9 +5,10 @@
+ # ifndef _qvf_hh_
+ # define _qvf_hh_
+
+-# include <fstream.h> // ostream
++# include <fstream> // ostream
+ # include <sys/types.h>
+
++using namespace std;
+
+ /*! \class qvf
+ * \brief class for value-format pairs.
+@@ -89,7 +90,7 @@
+ * \param v the value
+ * \param f the format
+ */
+- void set (unsigned int v, enum format f=SPECIFIC);
++ void set (unsigned int v, enum format f);
+
+ /*! \fn void print (ostream *os)
+ * \brief print the vf characteristics on the given output stream
diff --git a/audio/quelcom/files/patch-lib::qwav.cc b/audio/quelcom/files/patch-lib::qwav.cc
new file mode 100644
index 000000000000..92249a790c43
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qwav.cc
@@ -0,0 +1,42 @@
+--- lib/qwav.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qwav.cc Fri Feb 13 19:17:38 2004
+@@ -2,6 +2,8 @@
+ * implementation functions for class qwav
+ */
+
++#include <iostream>
++
+ # include "qwav.hh"
+ # include "qexception.hh"
+
+@@ -37,16 +39,28 @@
+ msduration = getMsDuration();
+
+ // cal posar les milèssimes?
++ *os << getName() << ": " << getSampleRate() << " Hz "
++ << getBitsPerSample() << " bits "
++ << ((getChannels()==1)?"mono":"stereo") << ' ';
++ os->width(2);
++ *os << msduration/60000 << ':';
++ os->width(2);
++ os->fill('0');
++ *os << (msduration/1000)%60 << '.';
++ os->width(2);
++ os->fill('0');
++ *os << (msduration%1000)/10;
++ /*
+ os->form("%s: %u Hz %u bits %s %2u:%02u.%02u",
+ getName().c_str(),
+ getSampleRate(),getBitsPerSample(),
+ ((getChannels()==1)?"mono":"stereo"),
+ msduration/60000,(msduration/1000)%60,(msduration%1000)/10);
+-
++ */
+ }
+
+
+-qwav::qwav(string name, u_int32_t flags=READ)
++qwav::qwav(string name, u_int32_t flags)
+ : qfile (name,flags),
+ qwavheader(getMap(),getSize()) {
+
diff --git a/audio/quelcom/files/patch-lib::qwav.hh b/audio/quelcom/files/patch-lib::qwav.hh
new file mode 100644
index 000000000000..030ef42f266c
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qwav.hh
@@ -0,0 +1,17 @@
+--- lib/qwav.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qwav.hh Fri Feb 13 19:17:38 2004
+@@ -28,6 +28,14 @@
+ qwav (string filename, u_int32_t flags = READ);
+
+ /*!
++ * copy constructor, ensuring that both the qfile and qwavheader
++ * superclasses get copied (qwavheader needs a deep copy)
++ */
++ qwav(const qwav &w)
++ :qfile(w),qwavheader(w)
++ {}
++
++ /*!
+ * \brief compares both wavs whether they're compatible or not
+ * \param wav the wav to check for compatibility
+ * \return whether compatible or not
diff --git a/audio/quelcom/files/patch-lib::qwavheader.cc b/audio/quelcom/files/patch-lib::qwavheader.cc
new file mode 100644
index 000000000000..11b91b64cc3f
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qwavheader.cc
@@ -0,0 +1,88 @@
+--- lib/qwavheader.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qwavheader.cc Fri Feb 13 19:17:38 2004
+@@ -5,6 +5,7 @@
+ # include "qwavheader.hh"
+ # include "qexception.hh"
+ # include "qmisc.hh"
++# include "endian.hh"
+
+ #ifdef NLS
+ # include <locale.h>
+@@ -15,12 +16,13 @@
+ #endif
+
+
+-const u_int32_t qwavheader::HEADERSIZE = sizeof(struct header);
++const u_int32_t qwavheader::HEADERSIZE = sizeof(struct wavheader);
+
+
+-qwavheader::qwavheader (caddr_t p, u_int32_t wavlength=0) {
++qwavheader::qwavheader (caddr_t p, u_int32_t wavlength) {
+
+- header = (struct header *)p;
++ header = new wavheader(p);
++ mappedheader = (struct wavheader *)p;
+
+ valid();
+
+@@ -28,10 +30,14 @@
+ validLength(wavlength);
+ }
+
++qwavheader::~qwavheader()
++{
++ delete header;
++}
+
+ void qwavheader::remap(caddr_t p) {
+-
+- header = (struct header*)p;
++ mappedheader = (struct wavheader *)p;
++ header->headerCopy(p);
+ }
+
+
+@@ -41,6 +47,9 @@
+ header->datalength = n*header->bytespersample;
+ header->rifflength = header->datalength+36;
+
++ mappedheader->datalength = htolel(header->datalength);
++ mappedheader->rifflength = htolel(header->rifflength);
++
+ #ifdef QVERBOSE
+ cerr << "sample number set to " << n << endl;
+ #endif
+@@ -70,12 +79,6 @@
+ }
+
+
+-void qwavheader::write(caddr_t p) {
+-
+- memmove(p,header,HEADERSIZE);
+-}
+-
+-
+ bool qwavheader::valid () {
+
+ if (!strcmpn(header->riff,"RIFF",4) ||
+@@ -164,4 +167,20 @@
+ u_int32_t qwavheader::getBytesPerSample() { return header->bytespersample; }
+ bool qwavheader::getStereo() { return header->channels==2; }
+
++void qwavheader::wavheader::headerCopy(caddr_t p)
++{
++ memmove(this, p, HEADERSIZE);
++
++#if __BYTE_ORDER != __LITTLE_ENDIAN
++ rifflength = letohl(rifflength);
++ fmtlength = letohl(fmtlength);
++ format = letohs(format);
++ channels = letohs(channels);
++ samplerate = letohl(samplerate);
++ bytespersec = letohl(bytespersec);
++ bytespersample = letohs(bytespersample);
++ bitspersample = letohs(bitspersample);
++ datalength = letohl(datalength);
++#endif
+
++}
diff --git a/audio/quelcom/files/patch-lib::qwavheader.hh b/audio/quelcom/files/patch-lib::qwavheader.hh
new file mode 100644
index 000000000000..b96f41280404
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qwavheader.hh
@@ -0,0 +1,66 @@
+--- lib/qwavheader.hh.orig Fri Feb 23 21:29:12 2001
++++ lib/qwavheader.hh Fri Feb 13 19:17:38 2004
+@@ -20,9 +20,11 @@
+ /*!
+ * \brief struct for wav headers
+ *
+- * this struct is defined to match exactly with a 'canonical' wav header with no change on a little-endian machine
++ * this struct is defined to match exactly with a 'canonical' wav header with no
++ * change on a little-endian machine; on other architectures the alignment will
++ * match but int values will need conversion
+ */
+- struct header {
++ struct wavheader {
+
+ // riff chunk
+ char riff[4]; /*!< should be 'RIFF' */
+@@ -41,10 +43,19 @@
+
+ char data[4]; /*!< should be 'data' */
+ u_int32_t datalength; /*!< data block length (file size - 44) */
+- };
++
++ wavheader(caddr_t p) { headerCopy(p); }
++
++ /*!
++ * Copies WAV header from little-endian to host order
++ * \param p the memory address where the header is located
++ * \param nativeendian whether the struct is already in native byte ordering
++ */
++ void headerCopy(caddr_t p);
++ } __attribute__ ((__packed__));
+
+ //! pointer to the header (memory location where it is located)
+- struct header *header;
++ wavheader *header, *mappedheader;
+
+ public:
+
+@@ -58,6 +69,15 @@
+ */
+ qwavheader (caddr_t p, u_int32_t length=0);
+
++ /*! deep-copy */
++ qwavheader (const qwavheader& qwh)
++ :header(new wavheader(*qwh.header)), mappedheader(qwh.mappedheader) {}
++
++ /*!
++ * releases storage allocated for header
++ */
++ ~qwavheader();
++
+ /*!
+ * \brief gets the number of samples
+ * \return the number of samples
+@@ -147,11 +167,6 @@
+ * \return whether is valid or not
+ */
+ bool validLength(u_int32_t length);
+- /*!
+- * \brief write (copy) the header to the given address
+- * \param a the memory address where to write the header
+- */
+- void write(caddr_t );
+ };
+
+ # endif
diff --git a/audio/quelcom/files/patch-lib::qwavsample.cc b/audio/quelcom/files/patch-lib::qwavsample.cc
new file mode 100644
index 000000000000..e77a3cd2da75
--- /dev/null
+++ b/audio/quelcom/files/patch-lib::qwavsample.cc
@@ -0,0 +1,143 @@
+--- lib/qwavsample.cc.orig Fri Feb 23 21:29:12 2001
++++ lib/qwavsample.cc Fri Feb 13 19:17:38 2004
+@@ -4,7 +4,7 @@
+
+ # include "qwavsample.hh"
+ # include "qexception.hh"
+-
++# include "endian.hh"
+
+ #ifdef NLS
+ # include <locale.h>
+@@ -21,11 +21,14 @@
+ #endif
+
+
+-qwavsample::qwavsample (qwav *wav, u_int32_t s=1) {
++qwavsample::qwavsample (qwav *wav, u_int32_t s) {
+
+ sample = (union sample*) (wav->getMap()+wav->getOffset(s));
+
+ if (wav->getBitsPerSample()==16) {
++ if ((int)sample % sizeof(int16_t) != 0)
++ throw qexception(__PRETTY_FUNCTION__, _("misaligned 16-bit sample"));
++
+ if (wav->getChannels()==2) {
+ type = STEREO16;
+ }
+@@ -60,6 +63,8 @@
+ sample = (union sample*) pointer;
+
+ if (bitspersample==16) {
++ if ((int)sample % sizeof(int16_t) != 0)
++ throw qexception(__PRETTY_FUNCTION__, _("misaligned 16-bit sample"));
+ if (channels==2) {
+ type = STEREO16;
+ return;
+@@ -88,7 +93,7 @@
+ }
+
+
+-qwavsample::qwavsample(caddr_t pointer, enum type t=STEREO16) {
++qwavsample::qwavsample(caddr_t pointer, enum type t) {
+
+ sample = (union sample*) pointer;
+ type = t;
+@@ -99,9 +104,9 @@
+
+ switch (type) {
+ case MONO8: return sample->mono8;
+- case MONO16: return sample->mono16;
++ case MONO16: return letohs_s(sample->mono16);
+ case STEREO8: return sample->stereo8.left;
+- case STEREO16: return sample->stereo16.left;
++ case STEREO16: return letohs_s(sample->stereo16.left);
+ }
+
+ throw qexception(__PRETTY_FUNCTION__,_("quelcom internal error"));
+@@ -112,36 +117,36 @@
+
+ switch (type) {
+ case MONO8: return sample->mono8;
+- case MONO16: return sample->mono16;
++ case MONO16: return letohs_s(sample->mono16);
+ case STEREO8: return sample->stereo8.right;
+- case STEREO16: return sample->stereo16.right;
++ case STEREO16: return letohs_s(sample->stereo16.right);
+ }
+ throw qexception(__PRETTY_FUNCTION__,_("quelcom internal error"));
+ }
+
+-void qwavsample::set(int left, int right=0) {
++void qwavsample::set(int left, int right) {
+
+ switch (type) {
+ case MONO8: sample->mono8=left; break;
+- case MONO16: sample->mono16=left; break;
++ case MONO16: sample->mono16=htoles_s(left); break;
+ case STEREO8: sample->stereo8.left=left;sample->stereo8.right=right; break;
+- case STEREO16: sample->stereo16.left=left;sample->stereo16.right=right; break;
++ case STEREO16: sample->stereo16.left=htoles_s(left);sample->stereo16.right=htoles_s(right); break;
+ default:
+ throw qexception(__PRETTY_FUNCTION__,_("quelcom internal error"));
+ }
+ }
+
+-bool qwavsample::isSilence(u_int32_t threshold=0) {
++bool qwavsample::isSilence(u_int32_t threshold) {
+
+ switch (type) {
+ case MONO8: return (u_int32_t)abs(sample->mono8)<=threshold;
+- case MONO16: return (u_int32_t)abs(sample->mono16)<=threshold;
++ case MONO16: return (u_int32_t)abs(letohs_s(sample->mono16))<=threshold;
+ case STEREO8:
+ return ((u_int32_t)abs(sample->stereo8.left)<=threshold) &&
+ ((u_int32_t)abs(sample->stereo8.right)<=threshold);
+ case STEREO16:
+- return ((u_int32_t)abs(sample->stereo16.left)<=threshold) &&
+- ((u_int32_t)abs(sample->stereo16.right)<=threshold);
++ return ((u_int32_t)abs(letohs_s(sample->stereo16.left))<=threshold) &&
++ ((u_int32_t)abs(letohs_s(sample->stereo16.right))<=threshold);
+ }
+ throw qexception(__PRETTY_FUNCTION__,_("quelcom internal error"));
+ }
+@@ -173,10 +178,15 @@
+ void qwavsample::print(ostream &os) {
+
+ switch (type) {
+- case MONO8: os.form("(%d)",sample->mono8); break;
+- case MONO16: os.form("(%d)",sample->mono16); break;
+- case STEREO8: os.form("(%d,%d)",sample->stereo8.left,sample->stereo8.right); break;
+- case STEREO16: os.form("(%d,%d)",sample->stereo16.left,sample->stereo16.right); break;
++ case MONO8: os << '(' << sample->mono8 << ')'; break;
++ case MONO16: os << '(' << letohs_s(sample->mono16) << ')'; break;
++ case STEREO8:
++ os << '(' << sample->stereo8.left << ',' << sample->stereo8.right << ')';
++ break;
++ case STEREO16:
++ os << '(' << letohs_s(sample->stereo16.left) << ',' << letohs_s(sample->stereo16.right) << ')';
++ break;
++
+ default:
+ throw qexception(__PRETTY_FUNCTION__,_("quelcom internal error"));
+ }
+@@ -184,12 +194,16 @@
+
+
+ void qwavsample::prod(double d) {
+-
+ switch (type) {
+ case MONO8: sample->mono8*=d; break;
+- case MONO16: sample->mono16*=d; break;
++ case MONO16:
++ sample->mono16 = htoles_s(short(letohs_s(sample->mono16)*d));
++ break;
+ case STEREO8: sample->stereo8.left*=d; sample->stereo8.right*=d; break;
+- case STEREO16: sample->stereo16.left*=d; sample->stereo16.right*=d; break;
++ case STEREO16:
++ sample->stereo16.left = htoles_s(short(letohs_s(sample->stereo16.left)*d));
++ sample->stereo16.right = htoles_s(short(letohs_s(sample->stereo16.right)*d));
++ break;
+ default:
+ throw qexception(__PRETTY_FUNCTION__,_("quelcom internal error"));
+ }
diff --git a/audio/quelcom/pkg-plist b/audio/quelcom/pkg-plist
index b0d7bdff3618..ab2728c67d5f 100644
--- a/audio/quelcom/pkg-plist
+++ b/audio/quelcom/pkg-plist
@@ -9,3 +9,10 @@ bin/qwavheaderdump
bin/qwavinfo
bin/qwavjoin
bin/qwavsilence
+lib/libqextra.so
+lib/libqmp3.so
+lib/libqwav.so
+%%PORTDOCS%%%%DOCSDIR%%/quelcom.html
+share/locale/ca/LC_MESSAGES/quelcom.mo
+share/locale/es/LC_MESSAGES/quelcom.mo
+%%PORTDOCS%%@dirrm %%DOCSDIR%%