changeset 1971:4ead92d8e6c3

branch merge
author Ralf Ertzinger <ralf@skytale.net>
date Wed, 03 Oct 2007 15:37:04 +0200
parents e54d72373503 (current diff) 7ada85b64e90 (diff)
children 2bd85ddedf9e
files src/neon/neon.c
diffstat 129 files changed, 529 insertions(+), 619 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 03 15:35:56 2007 +0200
+++ b/ChangeLog	Wed Oct 03 15:37:04 2007 +0200
@@ -12007,7 +12007,7 @@
 
 2006-09-18 15:47:33 +0000  Jonathan Schleifer <js@h3c.de>
   revision [68]
-  #include "audacious/util.h"? WTF? Fixed.
+  #include <audacious/util.h>? WTF? Fixed.
 
   Changes:        Modified:
   +1 -1           trunk/src/modplug/gui/main.cxx  
--- a/src/CoreAudio/about.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/CoreAudio/about.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,7 +16,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include "coreaudio.h"
-#include "audacious/util.h"
+#include <audacious/util.h>
 
 void osx_about(void)
 {
--- a/src/CoreAudio/audio.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/CoreAudio/audio.c	Wed Oct 03 15:37:04 2007 +0200
@@ -18,7 +18,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include "coreaudio.h"
-#include "audacious/util.h"
+#include <audacious/util.h>
 #include <errno.h>
 #include <CoreAudio/CoreAudio.h>
 
--- a/src/CoreAudio/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/CoreAudio/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -18,7 +18,7 @@
  */
 
 #include "coreaudio.h"
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 #include <CoreAudio/CoreAudio.h>
 
 #include <audacious/i18n.h>
--- a/src/CoreAudio/coreaudio.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/CoreAudio/coreaudio.c	Wed Oct 03 15:37:04 2007 +0200
@@ -19,7 +19,7 @@
 
 #include "coreaudio.h"
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 #include <audacious/i18n.h>
 
 OutputPlugin osx_op =
--- a/src/CoreAudio/coreaudio.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/CoreAudio/coreaudio.h	Wed Oct 03 15:37:04 2007 +0200
@@ -40,7 +40,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 #ifdef WORDS_BIGENDIAN
 # define IS_BIG_ENDIAN TRUE
--- a/src/CoreAudio/init.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/CoreAudio/init.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,7 +16,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include "coreaudio.h"
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 
 OSXConfig osx_cfg;
 
--- a/src/OSS/OSS.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/OSS/OSS.h	Wed Oct 03 15:37:04 2007 +0200
@@ -32,7 +32,7 @@
 #include <soundcard.h>
 #endif
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 #define IS_BIG_ENDIAN (G_BYTE_ORDER == G_BIG_ENDIAN)
 
--- a/src/OSS/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/OSS/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -27,7 +27,6 @@
 #include <string.h>
 
 #include <audacious/configdb.h>
-#include <audacious/vfs.h>
 #include <audacious/i18n.h>
 
 
--- a/src/OSS4/OSS4.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/OSS4/OSS4.h	Wed Oct 03 15:37:04 2007 +0200
@@ -30,7 +30,7 @@
 #include <soundcard.h>
 #endif
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 #include <glib.h>
 
 #define IS_BIG_ENDIAN (G_BYTE_ORDER == G_BIG_ENDIAN)
--- a/src/aac/libfaad2/common.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/aac/libfaad2/common.h	Wed Oct 03 15:37:04 2007 +0200
@@ -40,9 +40,7 @@
 #define __STRICT_ANSI__
 #endif
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #define INLINE __inline
 #if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
--- a/src/aac/libmp4.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/aac/libmp4.c	Wed Oct 03 15:37:04 2007 +0200
@@ -6,18 +6,14 @@
 #include "mp4ff.h"
 #include "tagging.h"
 
-#include "audacious/plugin.h"
-#include "audacious/output.h"
-#include "audacious/util.h"
-#include "audacious/vfs.h"
-#include "audacious/i18n.h"
-#include "audacious/strings.h"
-#include "audacious/main.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
+#include <audacious/i18n.h>
+#include <audacious/strings.h>
+#include <audacious/main.h>
 
 #define MP4_VERSION VERSION
-
 #define SBR_DEC
 
 extern VFSFile *vfs_buffered_file_new_from_uri(gchar *uri);
--- a/src/aac/mp4_utils.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/aac/mp4_utils.c	Wed Oct 03 15:37:04 2007 +0200
@@ -9,8 +9,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "audacious/plugin.h"
-#include "audacious/util.h"
+#include <audacious/plugin.h>
+#include <audacious/util.h>
 
 const char *mp4AudioNames[]=
   {
--- a/src/aac/mp4ff/mp4ffint.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/aac/mp4ff/mp4ffint.h	Wed Oct 03 15:37:04 2007 +0200
@@ -107,9 +107,7 @@
 #define ATOM_SINF 24
 #define ATOM_SCHI 25
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifndef _WIN32
 #define stricmp strcasecmp
--- a/src/adplug/adplug-xmms.cc	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/adplug/adplug-xmms.cc	Wed Oct 03 15:37:04 2007 +0200
@@ -29,13 +29,13 @@
 #include "emuopl.h"
 #include "silentopl.h"
 #include "players.h"
-#include "audacious/i18n.h"
+#include <audacious/i18n.h>
 extern "C"
 {
-#include "audacious/plugin.h"
-#include "audacious/configdb.h"
-#include "audacious/output.h"
-#include "audacious/util.h"
+#include <audacious/plugin.h>
+#include <audacious/configdb.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
 }
 
 
--- a/src/alsa/audio.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/alsa/audio.c	Wed Oct 03 15:37:04 2007 +0200
@@ -158,7 +158,8 @@
 	 */
 	switch (err)
 	{
-	case -ESTRPIPE:   /* "suspend": wait until ALSA is "running" again. */
+	case -ESTRPIPE:
+	case ESTRPIPE:   /* "suspend": wait until ALSA is "running" again. */
 		while ((err2 = snd_pcm_resume(alsa_pcm)) == -EAGAIN)
 			g_usleep(100000);
 
@@ -167,10 +168,15 @@
 
 		break;
 
-	case -EPIPE:      /* under-run and the I/O pipe closed on us */
+	case -EPIPE:
+	case EPIPE:      /* under-run and the I/O pipe closed on us */
 		return snd_pcm_prepare(alsa_pcm);
 		break;
 
+	case EINTR:
+	case -EINTR:
+		break;
+
 	default:
 		g_warning("Unhandled ALSA exception code %d (%s), trying hard restart.", err, snd_strerror(err));
 		return snd_pcm_prepare(alsa_pcm);
@@ -701,7 +707,7 @@
 				alsa_recovery(wr);
 			}
 		}
-		else
+		else	/* XXX: why is this here? --nenolod */
 			g_usleep(10000);
 
 		if (pause_request != paused)
--- a/src/alsa/init.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/alsa/init.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,7 +17,7 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 #include <glib.h>
-#include "audacious/main.h"
+#include <audacious/main.h>
 #include "alsa.h"
 #include <dlfcn.h>
 #include <ctype.h>
--- a/src/arts/arts.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/arts/arts.c	Wed Oct 03 15:37:04 2007 +0200
@@ -10,7 +10,7 @@
  */
 
 #include "arts.h"
-#include "audacious/util.h"
+#include <audacious/util.h>
 
 static void about(void)
 {
--- a/src/arts/arts.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/arts/arts.h	Wed Oct 03 15:37:04 2007 +0200
@@ -24,8 +24,8 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "audacious/plugin.h"
-#include "audacious/configdb.h"
+#include <audacious/plugin.h>
+#include <audacious/configdb.h>
 #include <audacious/i18n.h>
 # include "config.h"
 
--- a/src/arts/convert.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/arts/convert.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,11 +16,9 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#if defined(HAVE_CONFIG_H)
 #include "config.h"
-#endif
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 #include <glib.h>
 
 #ifdef WORDS_BIGENDIAN
--- a/src/audiocompress/audacious-glue.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/audiocompress/audacious-glue.c	Wed Oct 03 15:37:04 2007 +0200
@@ -9,9 +9,9 @@
 #include <string.h>
 #include <gtk/gtk.h>
 #include <audacious/i18n.h>
-#include "audacious/plugin.h"
-#include "audacious/util.h"
-#include "audacious/configdb.h"
+#include <audacious/plugin.h>
+#include <audacious/util.h>
+#include <audacious/configdb.h>
 
 #include "config.h"
 #include "compress.h"
--- a/src/blur_scope/blur_scope.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/blur_scope/blur_scope.c	Wed Oct 03 15:37:04 2007 +0200
@@ -25,9 +25,9 @@
 #include <audacious/i18n.h>
 #include <gtk/gtk.h>
 #include <string.h>
-#include "audacious/plugin.h"
-#include "audacious/util.h"
-#include "audacious/configdb.h"
+#include <audacious/plugin.h>
+#include <audacious/util.h>
+#include <audacious/configdb.h>
 #include "blur_scope.h"
 #include "bscope_logo.xpm"
 
--- a/src/blur_scope/config.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/blur_scope/config.c	Wed Oct 03 15:37:04 2007 +0200
@@ -4,7 +4,7 @@
 #include <audacious/i18n.h>
 #include <gtk/gtk.h>
 
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 #include "blur_scope.h"
 
 
--- a/src/cdaudio-ng/cdaudio-ng.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/cdaudio-ng/cdaudio-ng.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,12 +16,14 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses>.
  */
 
+#include "config.h"
 
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <libgen.h>
+#include <stdarg.h>
 
 #include <cdio/cdio.h>
 #include <cdio/cdtext.h>
@@ -34,14 +36,13 @@
 
 #include <glib.h>
 
+#include <audacious/plugin.h>
 #include <audacious/configdb.h>
 #include <audacious/i18n.h>
 #include <audacious/output.h>
 #include <audacious/playlist.h>
-#include <audacious/plugin.h>
 #include <audacious/ui_plugin_menu.h>
 #include <audacious/util.h>
-#include "config.h"
 
 #include "cdaudio-ng.h"
 #include "configure.h"
@@ -60,7 +61,7 @@
 static gboolean			is_paused = FALSE;
 static int				playing_track = -1;
 static dae_params_t		*pdae_params = NULL;
-static gboolean			debug = FALSE;
+static gboolean			use_debug = FALSE;
 static char				cddb_server[DEF_STRING_LEN];
 static int				cddb_port;
 static InputPlayback	*pglobalinputplayback = NULL;
@@ -114,13 +115,34 @@
 DECLARE_PLUGIN(cdaudio, NULL, NULL, cdaudio_iplist, NULL, NULL, NULL, NULL, NULL);
 
 
-void cdaudio_init()
+void cdaudio_error(const char *fmt, ...)
+{
+	va_list ap;
+	fprintf(stderr, "cdaudio-ng: ");
+	va_start(ap, fmt);
+	vfprintf(stderr, fmt, ap);
+	va_end(ap);
+}
+
+
+void CDDEBUG(const char *fmt, ...)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_init()\n");
+	if (use_debug) {
+		va_list ap;
+		fprintf(stderr, "cdaudio-ng: ");
+		va_start(ap, fmt);
+		vfprintf(stderr, fmt, ap);
+		va_end(ap);
+	}
+}
+
+
+static void cdaudio_init()
+{
+	CDDEBUG("cdaudio_init()\n");
 
 	if (!cdio_init()) {
-		fprintf(stderr, "cdaudio-ng: failed to initialize cdio subsystem\n");
+		cdaudio_error("Failed to initialize cdio subsystem.\n");
 		cleanup_on_error();
 		return;
 	}
@@ -142,24 +164,23 @@
 	if (!bmp_cfg_db_get_bool(db, "CDDA", "use_cddb", &use_cddb))
 		use_cddb = TRUE;
 	if (!bmp_cfg_db_get_string(db, "CDDA", "cddbserver", &string))
-		strcpy(cddb_server, CDDA_DEFAULT_CDDB_SERVER);
+		strncpy(cddb_server, CDDA_DEFAULT_CDDB_SERVER, strlen(CDDA_DEFAULT_CDDB_SERVER) + 1);
 	else
-		strcpy(cddb_server, string);
+		strncpy(cddb_server, string, strlen(string) + 1);
 	if (!bmp_cfg_db_get_int(db, "CDDA", "cddbport", &cddb_port))
 		cddb_port = CDDA_DEFAULT_CDDB_PORT;
 	if (!bmp_cfg_db_get_string(db, "CDDA", "device", &string))
 		strcpy(device, "");
 	else
-		strcpy(device, string);
-	if (!bmp_cfg_db_get_bool(db, "CDDA", "debug", &debug))
-		debug = FALSE;
+		strncpy(device, string, strlen(device) + 1);
+	if (!bmp_cfg_db_get_bool(db, "CDDA", "debug", &use_debug))
+		use_debug = FALSE;
 
 	bmp_cfg_db_close(db);
 
-	if (debug)
-		printf("cdaudio-ng: configuration: "/*use_dae = %d, */"limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbport = %d, device = \"%s\", debug = %d\n", /*use_dae, */limitspeed, use_cdtext, use_cddb, cddb_server, cddb_port, device, debug);
+	CDDEBUG(/*use_dae = %d, */"limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbport = %d, device = \"%s\", debug = %d\n", /*use_dae, */limitspeed, use_cdtext, use_cddb, cddb_server, cddb_port, device, use_debug);
 
-	configure_set_variables(/*&use_dae, */&limitspeed, &use_cdtext, &use_cddb, device, &debug, cddb_server, &cddb_port);
+	configure_set_variables(/*&use_dae, */&limitspeed, &use_cdtext, &use_cddb, device, &use_debug, cddb_server, &cddb_port);
 	configure_create_gui();
 
 	main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text);
@@ -177,10 +198,9 @@
 	uri_set_plugin("cdda://", &inputplugin);
 }
 
-void cdaudio_about()
+static void cdaudio_about()
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_about()\n");
+	CDDEBUG("cdaudio_about()\n");
 
 	static GtkWidget* about_window = NULL;
 
@@ -188,22 +208,20 @@
         gdk_window_raise(about_window->window);
     }
 
-    char about_text[1000];
-	sprintf(about_text, _("Copyright (c) 2007, by Calin Crisan <ccrisan@gmail.com> and The Audacious Team.\n\n"
-						"Many thanks to libcdio developers <http://www.gnu.org/software/libcdio/>\n\tand to libcddb developers <http://libcddb.sourceforge.net/>.\n\n"
-						"Also thank you Tony Vroon for mentoring & guiding me.\n\n"
- 						"This was a Google Summer of Code 2007 project."));
-
-    about_window = audacious_info_dialog(_("About CD Audio Plugin NG"), about_text, _("OK"), FALSE, NULL, NULL);
+    about_window = audacious_info_dialog(_("About CD Audio Plugin NG"),
+    _("Copyright (c) 2007, by Calin Crisan <ccrisan@gmail.com> and The Audacious Team.\n\n"
+    "Many thanks to libcdio developers <http://www.gnu.org/software/libcdio/>\n"
+    "\tand to libcddb developers <http://libcddb.sourceforge.net/>.\n\n"
+    "Also thank you Tony Vroon for mentoring & guiding me.\n\n"
+    "This was a Google Summer of Code 2007 project."), _("OK"), FALSE, NULL, NULL);
 
     g_signal_connect(G_OBJECT(about_window), "destroy",
                      G_CALLBACK(gtk_widget_destroyed), &about_window);
 }
 
-void cdaudio_configure()
+static void cdaudio_configure()
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_configure()\n");
+	CDDEBUG("cdaudio_configure()\n");
 
 	/*
 	if (playing_track != -1)
@@ -213,61 +231,52 @@
 	configure_show_gui();
 }
 
-gint cdaudio_is_our_file(gchar *filename)
+static gint cdaudio_is_our_file(gchar *filename)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_is_our_file(\"%s\")\n", filename);
+	CDDEBUG("cdaudio_is_our_file(\"%s\")\n", filename);
 
 	if ((filename != NULL) && strlen(filename) > 4 && (!strcasecmp(filename + strlen(filename) - 4, ".cda"))) {
 			/* no CD information yet */
 		if (pcdio == NULL) {
-			if (debug)
-				printf("cdaudio-ng: no cd information, scanning\n");
+			CDDEBUG("no CD information, scanning\n");
 			cdaudio_scan_dir(CDDA_DEFAULT);
 		}
 
 			/* reload the cd information if the media has changed */
 		if (cdio_get_media_changed(pcdio) && pcdio != NULL) {
-			if (debug)
-				printf("cdaudio-ng: cd changed, rescanning\n");
+			CDDEBUG("CD changed, rescanning\n");
 			if (cdaudio_scan_dir(CDDA_DEFAULT) == NULL)
 				pcdio = NULL;
 		}
 
 		if (pcdio == NULL) {
-			if (debug)
-				printf("cdaudio-ng: \"%s\" is not our file\n", filename);
+			CDDEBUG("\"%s\" is not our file\n", filename);
 			return FALSE;
 		}
 
 			/* check if the requested track actually exists on the current audio cd */
-		int trackno = find_trackno_from_filename(filename);
+		gint trackno = find_trackno_from_filename(filename);
 		if (trackno < firsttrackno || trackno > lasttrackno) {
-			if (debug)
-				printf("cdaudio-ng: \"%s\" is not our file\n", filename);
+			CDDEBUG("\"%s\" is not our file\n", filename);
 			return FALSE;
 		}
-
-		if (debug)
-			printf("cdaudio-ng: \"%s\" is our file\n", filename);
+		
+		CDDEBUG("\"%s\" is our file\n", filename);
 		return TRUE;
 	}
 	else {
-		if (debug)
-			printf("cdaudio-ng: \"%s\" is not our file\n", filename);
+		CDDEBUG("\"%s\" is not our file\n", filename);
 		return FALSE;
 	}
 }
 
 GList *cdaudio_scan_dir(gchar *dirname)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_scan_dir(\"%s\")\n", dirname);
+	CDDEBUG("cdaudio_scan_dir(\"%s\")\n", dirname);
 
 		/* if the given dirname does not belong to us, we return NULL */
 	if (strstr(dirname, CDDA_DEFAULT) == NULL) {
-		if (debug)
-			printf("cdaudio-ng: \"%s\" directory does not belong to us\n", dirname);
+		CDDEBUG("\"%s\" directory does not belong to us\n", dirname);
 		return NULL;
 	}
 
@@ -275,25 +284,24 @@
 	if (device != NULL && strlen(device) > 0) {
 		pcdio = cdio_open(device, DRIVER_UNKNOWN);
 		if (pcdio == NULL) {
-			fprintf(stderr, "cdaudio-ng: failed to open cd device \"%s\"\n", device);
+			cdaudio_error("Failed to open CD device \"%s\".\n", device);
 			return NULL;
 		}
 	}
 	else {
-		char **ppcd_drives = cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false);
+		gchar **ppcd_drives = cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false);
 		pcdio = NULL;
 		if (ppcd_drives != NULL && *ppcd_drives != NULL) { /* we have at least one audio capable cd drive */
 			pcdio = cdio_open(*ppcd_drives, DRIVER_UNKNOWN);
 			if (pcdio == NULL) {
-				fprintf(stderr, "cdaudio-ng: failed to open cd\n");
+				cdaudio_error("Failed to open CD.\n");
 				cleanup_on_error();
 				return NULL;
 			}
-			if (debug)
-				printf("cdaudio-ng: found cd drive \"%s\" with audio capable media\n", *ppcd_drives);
+			CDDEBUG("found cd drive \"%s\" with audio capable media\n", *ppcd_drives);
 		}
 		else {
-			fprintf(stderr, "cdaudio-ng: unable find or access a cdda capable drive\n");
+			cdaudio_error("Unable to find or access a CDDA capable drive.\n");
 			cleanup_on_error();
 			return NULL;
 		}
@@ -303,10 +311,9 @@
 
 		/* limit read speed */
 	if (limitspeed > 0 && use_dae) {
-		if (debug)
-			printf("cdaudio-ng: setting drive speed limit to %dx\n", limitspeed);
+		CDDEBUG("setting drive speed limit to %dx\n", limitspeed);
 		if (cdio_set_speed(pcdio, limitspeed) != DRIVER_OP_SUCCESS)
-			fprintf(stderr, "cdaudio-ng: failed to set drive speed to %dx\n", limitspeed);
+			cdaudio_error("Failed to set drive speed to %dx.\n", limitspeed);
 	}
 
 		/* get general track initialization */
@@ -314,17 +321,15 @@
 	firsttrackno = cdio_get_first_track_num(pcdrom_drive->p_cdio);
 	lasttrackno = cdio_get_last_track_num(pcdrom_drive->p_cdio);
 	if (firsttrackno == CDIO_INVALID_TRACK || lasttrackno == CDIO_INVALID_TRACK) {
-		fprintf(stderr, "cdaudio-ng: failed to retrieve first/last track number\n");
+		cdaudio_error("Failed to retrieve first/last track number.\n");
 		cleanup_on_error();
 		return NULL;
 	}
-	if (debug)
-		printf("cdaudio-ng: first track is %d and last track is %d\n", firsttrackno, lasttrackno);
+	CDDEBUG("first track is %d and last track is %d\n", firsttrackno, lasttrackno);
 
-	if (trackinfo != NULL) /* if a previously allocated track information exists, we free it */
-		free(trackinfo);
-	trackinfo = (trackinfo_t *) malloc(sizeof(trackinfo_t) * (lasttrackno + 1));
-	int trackno;
+	g_free(trackinfo);
+	trackinfo = (trackinfo_t *) g_new(trackinfo_t, (lasttrackno + 1));
+	gint trackno;
 
 	trackinfo[0].startlsn = cdio_get_track_lsn(pcdrom_drive->p_cdio, 0);
 	trackinfo[0].endlsn = cdio_get_track_last_lsn(pcdrom_drive->p_cdio, CDIO_CDROM_LEADOUT_TRACK);
@@ -339,7 +344,7 @@
 		strcpy(trackinfo[trackno].genre, "");
 
 		if (trackinfo[trackno].startlsn == CDIO_INVALID_LSN || trackinfo[trackno].endlsn == CDIO_INVALID_LSN) {
-			fprintf(stderr, "cdaudio-ng: failed to retrieve stard/end lsn for track %d\n", trackno);
+			cdaudio_error("Failed to retrieve stard/end lsn for track %d.\n", trackno);
 			cleanup_on_error();
 			return NULL;
 		}
@@ -353,10 +358,9 @@
 	if (use_cddb) {
 		pcddb_conn = cddb_new();
 		if (pcddb_conn == NULL)
-			fprintf(stderr, "cdaudio-ng: failed to create the cddb connection\n");
+			cdaudio_error("Failed to create the cddb connection.\n");
 		else {
-			if (debug)
-				printf("cdaudio-ng: getting cddb info\n");
+			CDDEBUG("getting CDDB info\n");
 
 			cddb_set_server_name(pcddb_conn, cddb_server);
 			cddb_set_server_port(pcddb_conn, cddb_port);
@@ -375,13 +379,12 @@
 
 			int matches;
 			if ((matches = cddb_query(pcddb_conn, pcddb_disc)) == -1) {
-				fprintf(stderr, "cdaudio-ng: failed to query the cddb server: %s\n", cddb_error_str(cddb_errno(pcddb_conn)));
+				cdaudio_error("Failed to query the CDDB server: %s\n", cddb_error_str(cddb_errno(pcddb_conn)));
 				cddb_disc_destroy(pcddb_disc);
 				pcddb_disc = NULL;
 			}
 			else {
-				if (debug)
-					printf("cdaudio-ng: discid = %X, category = \"%s\"\n", cddb_disc_get_discid(pcddb_disc), cddb_disc_get_category_str(pcddb_disc));
+				CDDEBUG("discid = %X, category = \"%s\"\n", cddb_disc_get_discid(pcddb_disc), cddb_disc_get_category_str(pcddb_disc));
 
 				cddb_read(pcddb_conn, pcddb_disc);
 				if (cddb_errno(pcddb_conn) != CDDB_ERR_OK) {
@@ -390,12 +393,11 @@
 					pcddb_disc = NULL;
 				}
 				else {
-					if (debug)
-						printf("cdaudio-ng: we have got the cddb info\n");
+					CDDEBUG("we have got the cddb info\n");
 
-					strcpy(trackinfo[0].performer, cddb_disc_get_artist(pcddb_disc));
-					strcpy(trackinfo[0].name, cddb_disc_get_title(pcddb_disc));
-					strcpy(trackinfo[0].genre, cddb_disc_get_genre(pcddb_disc));
+					strncpy(trackinfo[0].performer, cddb_disc_get_artist(pcddb_disc), strlen(cddb_disc_get_artist(pcddb_disc)) + 1);
+					strncpy(trackinfo[0].name, cddb_disc_get_title(pcddb_disc), strlen(cddb_disc_get_title(pcddb_disc)) + 1);
+					strncpy(trackinfo[0].genre, cddb_disc_get_genre(pcddb_disc), strlen(cddb_disc_get_genre(pcddb_disc)) + 1);
 				}
 			}
 		}
@@ -403,17 +405,15 @@
 
 		/* adding trackinfo[0] information (the disc) */
 	if (use_cdtext) {
-		if (debug)
-			printf("cdaudio-ng: getting cd-text information for disc\n");
+		CDDEBUG("getting cd-text information for disc\n");
 		cdtext_t *pcdtext = cdio_get_cdtext(pcdrom_drive->p_cdio, 0);
 		if (pcdtext == NULL || pcdtext->field[CDTEXT_TITLE] == NULL) {
-			if (debug)
-				printf("cdaudio-ng: no cd-text available for disc\n");
+			CDDEBUG("no cd-text available for disc\n");
 		}
 		else {
-			strcpy(trackinfo[0].performer, pcdtext->field[CDTEXT_PERFORMER] != NULL ? pcdtext->field[CDTEXT_PERFORMER] : "");
-			strcpy(trackinfo[0].name, pcdtext->field[CDTEXT_TITLE] != NULL ? pcdtext->field[CDTEXT_TITLE] : "");
-			strcpy(trackinfo[0].genre, pcdtext->field[CDTEXT_GENRE] != NULL ? pcdtext->field[CDTEXT_GENRE] : "");
+			strncpy(trackinfo[0].performer, pcdtext->field[CDTEXT_PERFORMER] != NULL ? pcdtext->field[CDTEXT_PERFORMER] : "", strlen(pcdtext->field[CDTEXT_PERFORMER]) + 1);
+			strncpy(trackinfo[0].name, pcdtext->field[CDTEXT_TITLE] != NULL ? pcdtext->field[CDTEXT_TITLE] : "", strlen(pcdtext->field[CDTEXT_TITLE]) + 1);
+			strncpy(trackinfo[0].genre, pcdtext->field[CDTEXT_GENRE] != NULL ? pcdtext->field[CDTEXT_GENRE] : "", strlen(pcdtext->field[CDTEXT_GENRE]) + 1);
 		}
 	}
 
@@ -423,27 +423,25 @@
 		list = g_list_append(list, g_strdup_printf("track%02u.cda", trackno));
 		cdtext_t *pcdtext = NULL;
 		if (use_cdtext) {
-			if (debug)
-				printf("cdaudio-ng: getting cd-text information for track %d\n", trackno);
+			CDDEBUG("getting cd-text information for track %d\n", trackno);
 			pcdtext = cdio_get_cdtext(pcdrom_drive->p_cdio, trackno);
 			if (pcdtext == NULL || pcdtext->field[CDTEXT_PERFORMER] == NULL) {
-				if (debug)
-					printf("cdaudio-ng: no cd-text available for track %d\n", trackno);
+				CDDEBUG("no cd-text available for track %d\n", trackno);
 				pcdtext = NULL;
 			}
 		}
 
 		if (pcdtext != NULL) {
-			strcpy(trackinfo[trackno].performer, pcdtext->field[CDTEXT_PERFORMER] != NULL ? pcdtext->field[CDTEXT_PERFORMER] : "");
-			strcpy(trackinfo[trackno].name, pcdtext->field[CDTEXT_TITLE] != NULL ? pcdtext->field[CDTEXT_TITLE] : "");
-			strcpy(trackinfo[trackno].genre, pcdtext->field[CDTEXT_GENRE] != NULL ? pcdtext->field[CDTEXT_GENRE] : "");
+			strncpy(trackinfo[trackno].performer, pcdtext->field[CDTEXT_PERFORMER] != NULL ? pcdtext->field[CDTEXT_PERFORMER] : "", strlen(pcdtext->field[CDTEXT_PERFORMER]) + 1);
+			strncpy(trackinfo[trackno].name, pcdtext->field[CDTEXT_TITLE] != NULL ? pcdtext->field[CDTEXT_TITLE] : "", strlen(pcdtext->field[CDTEXT_TITLE]) + 1);
+			strncpy(trackinfo[trackno].genre, pcdtext->field[CDTEXT_GENRE] != NULL ? pcdtext->field[CDTEXT_GENRE] : "", strlen(pcdtext->field[CDTEXT_GENRE]) + 1);
 		}
 		else
 			if (pcddb_disc != NULL) {
 				cddb_track_t *pcddb_track = cddb_disc_get_track(pcddb_disc, trackno - 1);
-				strcpy(trackinfo[trackno].performer, cddb_track_get_artist(pcddb_track));
-				strcpy(trackinfo[trackno].name, cddb_track_get_title(pcddb_track));
-				strcpy(trackinfo[trackno].genre, cddb_disc_get_genre(pcddb_disc));
+				strncpy(trackinfo[trackno].performer, cddb_track_get_artist(pcddb_track), strlen(cddb_track_get_artist(pcddb_track)) + 1);
+				strncpy(trackinfo[trackno].name, cddb_track_get_title(pcddb_track), strlen(cddb_track_get_title(pcddb_track)) + 1);
+				strncpy(trackinfo[trackno].genre, cddb_disc_get_genre(pcddb_disc), strlen(cddb_disc_get_genre(pcddb_disc)) + 1);
 			}
 			else {
 				strcpy(trackinfo[trackno].performer, "");
@@ -452,15 +450,15 @@
 			}
 
 		if (strlen(trackinfo[trackno].name) == 0)
-			sprintf(trackinfo[trackno].name, "CD Audio Track %02u", trackno);
+			snprintf(trackinfo[trackno].name, trackno, "CD Audio Track %02u", sizeof(trackinfo[trackno].name));
 
 	}
 
-	if (debug) {
-		printf("cdaudio-ng: disc has : performer = \"%s\", name = \"%s\", genre = \"%s\"\n",
+	if (use_debug) {
+		CDDEBUG("disc has : performer = \"%s\", name = \"%s\", genre = \"%s\"\n",
 			   trackinfo[0].performer, trackinfo[0].name, trackinfo[0].genre);
 		for (trackno = firsttrackno; trackno <= lasttrackno; trackno++) {
-			printf("cdaudio-ng: track %d has : performer = \"%s\", name = \"%s\", genre = \"%s\", startlsn = %d, endlsn = %d\n",
+			CDDEBUG("track %d has : performer = \"%s\", name = \"%s\", genre = \"%s\", startlsn = %d, endlsn = %d\n",
 				trackno, trackinfo[trackno].performer, trackinfo[trackno].name, trackinfo[trackno].genre, trackinfo[trackno].startlsn, trackinfo[trackno].endlsn);
 		}
 	}
@@ -476,35 +474,31 @@
 void cdaudio_play_file(InputPlayback *pinputplayback)
 {
 	Tuple *tuple;
-	char *title;
-
-	if (debug)
-		printf("cdaudio-ng: cdaudio_play_file(\"%s\")\n", pinputplayback->filename);
+	gchar *title;
+	
+	CDDEBUG("cdaudio_play_file(\"%s\")\n", pinputplayback->filename);
 
 	pglobalinputplayback = pinputplayback;
 
 	if (trackinfo == NULL) {
-		if (debug)
-			printf("cdaudio-ng: no cd information, scanning\n");
+		CDDEBUG("no CD information, scanning\n");
 		cdaudio_scan_dir(CDDA_DEFAULT);
 	}
 
 	if (cdio_get_media_changed(pcdio)) {
-		if (debug)
-			printf("cdaudio-ng: cd changed, rescanning\n");
+		CDDEBUG("CD changed, rescanning\n");
 		cdaudio_scan_dir(CDDA_DEFAULT);
 	}
 
 	if (trackinfo == NULL) {
-		if (debug)
-			printf("cdaudio-ng: no cd information can be retrieved, aborting\n");
+		CDDEBUG("no CD information can be retrieved, aborting\n");
 		pinputplayback->playing = FALSE;
 		return;
 	}
 
 	int trackno = find_trackno_from_filename(pinputplayback->filename);
 	if (trackno < firsttrackno || trackno > lasttrackno) {
-		fprintf(stderr, "cdaudio-ng: trackno %d is out of range [%d..%d]\n", trackno, firsttrackno, lasttrackno);
+		cdaudio_error("Track #%d is out of range [%d..%d]\n", trackno, firsttrackno, lasttrackno);
 		cleanup_on_error();
 		return;
 	}
@@ -517,29 +511,27 @@
 	title = tuple_formatter_make_title_string(tuple, get_gentitle_format());
 
 	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 1411200, 44100, 2);
-	free(title); title = NULL;
-	tuple_free(tuple); tuple = NULL;
+	g_free(title);
+	tuple_free(tuple);
 
 	if (use_dae) {
-		if (debug)
-			printf("cdaudio-ng: using digital audio extraction\n");
+		CDDEBUG("using digital audio extraction\n");
 
 		if (pdae_params != NULL) {
-			fprintf(stderr, "cdaudio-ng: dae playback seems to be already started\n");
+			cdaudio_error("DAE playback seems to be already started.\n");
 			return;
 		}
 
 		if (pinputplayback->output->open_audio(FMT_S16_LE, 44100, 2) == 0) {
-			fprintf(stderr, "cdaudio-ng: failed open audio output\n");
+			cdaudio_error("Failed to open audio output.\n");
 			cleanup_on_error();
 			return;
 		}
 
 		/*
-		if (debug)
-			printf("cdaudio-ng: starting dae thread...\n");
+		CDDEBUG("starting dae thread...\n");
 		*/
-		pdae_params = (dae_params_t *) malloc(sizeof(dae_params_t));
+		pdae_params = (dae_params_t *) g_new(dae_params_t, 1);
 		pdae_params->startlsn = trackinfo[trackno].startlsn;
 		pdae_params->endlsn = trackinfo[trackno].endlsn;
 		pdae_params->pplayback = pinputplayback;
@@ -550,14 +542,13 @@
 		dae_play_loop(pdae_params);
 	}
 	else {
-		if (debug)
-			printf("cdaudio-ng: not using digital audio extraction\n");
+		CDDEBUG("not using digital audio extraction\n");
 
 		msf_t startmsf, endmsf;
 		cdio_lsn_to_msf(trackinfo[trackno].startlsn, &startmsf);
 		cdio_lsn_to_msf(trackinfo[trackno].endlsn, &endmsf);
 		if (cdio_audio_play_msf(pcdio, &startmsf, &endmsf) != DRIVER_OP_SUCCESS) {
-			fprintf(stderr, "cdaudio-ng: failed to play analog audio cd\n");
+			cdaudio_error("Failed to play analog audio CD.\n");
 			cleanup_on_error();
 			return;
 		}
@@ -566,8 +557,7 @@
 
 void cdaudio_stop(InputPlayback *pinputplayback)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_stop(\"%s\")\n", pinputplayback != NULL ? pinputplayback->filename : "N/A");
+	CDDEBUG("cdaudio_stop(\"%s\")\n", pinputplayback != NULL ? pinputplayback->filename : "N/A");
 
 	pglobalinputplayback = NULL;
 
@@ -582,13 +572,13 @@
 	if (use_dae) {
 		if (pdae_params != NULL) {
 			g_thread_join(pdae_params->thread);
-			free(pdae_params);
+			g_free(pdae_params);
 			pdae_params = NULL;
 		}
 	}
 	else {
 		if (cdio_audio_stop(pcdio) != DRIVER_OP_SUCCESS) {
-			fprintf(stderr, "cdaudio-ng: failed to stop analog cd\n");
+			cdaudio_error("Failed to stop analog CD.\n");
 			return;
 		}
 	}
@@ -596,14 +586,13 @@
 
 void cdaudio_pause(InputPlayback *pinputplayback, gshort paused)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_pause(\"%s\", %d)\n", pinputplayback->filename, paused);
+	CDDEBUG("cdaudio_pause(\"%s\", %d)\n", pinputplayback->filename, paused);
 
 	if (!is_paused) {
 		is_paused = TRUE;
 		if (!use_dae)
 			if (cdio_audio_pause(pcdio) != DRIVER_OP_SUCCESS) {
-				fprintf(stderr, "cdaudio-ng: failed to pause analog cd\n");
+				cdaudio_error("Failed to pause analog CD!\n");
 				cleanup_on_error();
 				return;
 			}
@@ -612,7 +601,7 @@
 		is_paused = FALSE;
 		if (!use_dae)
 			if (cdio_audio_resume(pcdio) != DRIVER_OP_SUCCESS) {
-				fprintf(stderr, "cdaudio-ng: failed to resume analog cd\n");
+				cdaudio_error("Failed to resume analog CD!\n");
 				cleanup_on_error();
 				return;
 			}
@@ -621,8 +610,7 @@
 
 void cdaudio_seek(InputPlayback *pinputplayback, gint time)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_seek(\"%s\", %d)\n", pinputplayback->filename, time);
+	CDDEBUG("cdaudio_seek(\"%s\", %d)\n", pinputplayback->filename, time);
 
 	if (playing_track == -1)
 		return;
@@ -633,13 +621,13 @@
 		}
 	}
 	else {
-		int newstartlsn = trackinfo[playing_track].startlsn + time * 75;
+		gint newstartlsn = trackinfo[playing_track].startlsn + time * 75;
 		msf_t startmsf, endmsf;
 		cdio_lsn_to_msf(newstartlsn, &startmsf);
 		cdio_lsn_to_msf(trackinfo[playing_track].endlsn, &endmsf);
 
 		if (cdio_audio_play_msf(pcdio, &startmsf, &endmsf) != DRIVER_OP_SUCCESS) {
-			fprintf(stderr, "cdaudio-ng: failed to play analog cd\n");
+			cdaudio_error("Failed to play analog CD\n");
 			cleanup_on_error();
 			return;
 		}
@@ -656,11 +644,11 @@
 	if (!use_dae) {
 		cdio_subchannel_t subchannel;
 		if (cdio_audio_read_subchannel(pcdio, &subchannel) != DRIVER_OP_SUCCESS) {
-			fprintf(stderr, "cdaudio-ng: failed to read analog cd subchannel\n");
+			cdaudio_error("Failed to read analog CD subchannel.\n");
 			cleanup_on_error();
 			return 0;
 		}
-		int currlsn = cdio_msf_to_lsn(&subchannel.abs_addr);
+		gint currlsn = cdio_msf_to_lsn(&subchannel.abs_addr);
 
 			/* check to see if we have reached the end of the song */
 		if (currlsn == trackinfo[playing_track].endlsn)
@@ -690,7 +678,7 @@
 	else {
 		cdio_audio_volume_t volume;
 		if (cdio_audio_get_volume(pcdio, &volume) != DRIVER_OP_SUCCESS) {
-			fprintf(stderr, "cdaudio-ng: failed to retrieve analog cd volume\n");
+			cdaudio_error("Failed to retrieve analog CD volume.\n");
 			cleanup_on_error();
 			*l = *r = 0;
 			return FALSE;
@@ -704,8 +692,7 @@
 
 gint cdaudio_set_volume(gint l, gint r)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_set_volume(%d, %d)\n", l, r);
+	CDDEBUG("cdaudio_set_volume(%d, %d)\n", l, r);
 
 	if (use_dae) {
 		return FALSE;
@@ -724,8 +711,7 @@
 
 void cdaudio_cleanup()
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_cleanup()\n");
+	CDDEBUG("cdaudio_cleanup()\n");
 
 	libcddb_shutdown();
 
@@ -736,7 +722,7 @@
 		pcdio = NULL;
 	}
 	if (trackinfo != NULL) {
-		free(trackinfo);
+		g_free(trackinfo);
 		trackinfo = NULL;
 	}
 	playing_track = -1;
@@ -751,16 +737,15 @@
 	bmp_cfg_db_set_string(db, "CDDA", "cddbserver", cddb_server);
 	bmp_cfg_db_set_int(db, "CDDA", "cddbport", cddb_port);
 	bmp_cfg_db_set_string(db, "CDDA", "device", device);
-	bmp_cfg_db_set_bool(db, "CDDA", "debug", debug);
+	bmp_cfg_db_set_bool(db, "CDDA", "debug", use_debug);
 	bmp_cfg_db_close(db);
 }
 
 void cdaudio_get_song_info(gchar *filename, gchar **title, gint *length)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_get_song_info(\"%s\")\n", filename);
+	CDDEBUG("cdaudio_get_song_info(\"%s\")\n", filename);
 
-	int trackno = find_trackno_from_filename(filename);
+	gint trackno = find_trackno_from_filename(filename);
 	Tuple *tuple = create_tuple_from_trackinfo(filename);
 
 	if(tuple) {
@@ -773,8 +758,7 @@
 
 Tuple *cdaudio_get_song_tuple(gchar *filename)
 {
-	if (debug)
-		printf("cdaudio-ng: cdaudio_get_song_tuple(\"%s\")\n", filename);
+	CDDEBUG("cdaudio_get_song_tuple(\"%s\")\n", filename);
 
 	return create_tuple_from_trackinfo(filename);
 }
@@ -819,7 +803,7 @@
 		return NULL;
 
 	Tuple *tuple = tuple_new_from_filename(filename);
-	int trackno = find_trackno_from_filename(filename);
+	gint trackno = find_trackno_from_filename(filename);
 
 	if (trackno < firsttrackno || trackno > lasttrackno)
 		return NULL;
@@ -847,14 +831,13 @@
 
 void dae_play_loop(dae_params_t *pdae_params)
 {
-	unsigned char *buffer = (unsigned char *) malloc(CDDA_DAE_FRAMES * CDIO_CD_FRAMESIZE_RAW);
+	guchar *buffer = g_new(guchar, CDDA_DAE_FRAMES * CDIO_CD_FRAMESIZE_RAW);
 
-	if (debug)
-		printf("cdaudio-ng: dae started\n");
+	CDDEBUG("dae started\n");
 	cdio_lseek(pcdio, pdae_params->startlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET);
 
 	gboolean output_paused = FALSE;
-	int read_error_counter = 0;
+	gint read_error_counter = 0;
 
 	//pdae_params->endlsn += 75 * 3;
 
@@ -862,18 +845,16 @@
 			/* handle pause status */
 		if (is_paused) {
 			if (!output_paused) {
-				if (debug)
-					printf("cdaudio-ng: playback was not paused, pausing\n");
+				CDDEBUG("playback was not paused, pausing\n");
 				pdae_params->pplayback->output->pause(TRUE);
 				output_paused = TRUE;
 			}
-			usleep(1000);
+			g_usleep(1000);
 			continue;
 		}
 		else {
 			if (output_paused) {
-				if (debug)
-					printf("cdaudio-ng: playback was paused, resuming\n");
+				CDDEBUG("playback was paused, resuming\n");
 				pdae_params->pplayback->output->pause(FALSE);
 				output_paused = FALSE;
 			}
@@ -881,9 +862,8 @@
 
 			/* check if we have to seek */
 		if (pdae_params->seektime != -1) {
-			if (debug)
-				printf("cdaudio-ng: requested seek to %d ms\n", pdae_params->seektime);
-			int newlsn = pdae_params->startlsn + pdae_params->seektime * 75 / 1000;
+			CDDEBUG("requested seek to %d ms\n", pdae_params->seektime);
+			gint newlsn = pdae_params->startlsn + ((pdae_params->seektime * 75) / 1000);
 			cdio_lseek(pcdio, newlsn * CDIO_CD_FRAMESIZE_RAW, SEEK_SET);
 			pdae_params->pplayback->output->flush(pdae_params->seektime);
 			pdae_params->currlsn = newlsn;
@@ -891,7 +871,7 @@
 		}
 
 			/* compute the actual number of sectors to read */
-		int lsncount = CDDA_DAE_FRAMES <= (pdae_params->endlsn - pdae_params->currlsn + 1) ? CDDA_DAE_FRAMES : (pdae_params->endlsn - pdae_params->currlsn + 1);
+		gint lsncount = CDDA_DAE_FRAMES <= (pdae_params->endlsn - pdae_params->currlsn + 1) ? CDDA_DAE_FRAMES : (pdae_params->endlsn - pdae_params->currlsn + 1);
 			/* check too see if we have reached the end of the song */
 		if (lsncount <= 0) {
 			sleep(3);
@@ -899,22 +879,22 @@
 		}
 
 		if (cdio_read_audio_sectors(pcdio, buffer, pdae_params->currlsn, lsncount) != DRIVER_OP_SUCCESS) {
-			fprintf(stderr, "cdaudio-ng: failed to read audio sector\n");
+			CDDEBUG("failed to read audio sector\n");
 			read_error_counter++;
 			if (read_error_counter >= 2) {
 				read_error_counter = 0;
-				fprintf(stderr, "cdaudio-ng: this cd can no longer be played, stopping\n");
+				cdaudio_error("This CD can no longer be played, stopping.\n");
 				break;
 			}
 		}
 		else
 			read_error_counter = 0;
 
-		int remainingbytes = lsncount * CDIO_CD_FRAMESIZE_RAW;
-		unsigned char *bytebuff = buffer;
+		gint remainingbytes = lsncount * CDIO_CD_FRAMESIZE_RAW;
+		guchar *bytebuff = buffer;
 		while (pdae_params->pplayback->playing && remainingbytes > 0 && pdae_params->seektime == -1) {
 				/* compute the actual number of bytes to play */
-			int bytecount = CDIO_CD_FRAMESIZE_RAW <= remainingbytes ? CDIO_CD_FRAMESIZE_RAW : remainingbytes;
+			gint bytecount = CDIO_CD_FRAMESIZE_RAW <= remainingbytes ? CDIO_CD_FRAMESIZE_RAW : remainingbytes;
 				/* wait until the output buffer has enough room */
 			while (pdae_params->pplayback->playing && pdae_params->pplayback->output->buffer_free() < bytecount && pdae_params->seektime == -1)
 				usleep(1000);
@@ -926,41 +906,40 @@
 		}
 		pdae_params->currlsn += lsncount;
 	}
-	if (debug)
-		printf("cdaudio-ng: dae ended\n");
+	CDDEBUG("dae ended\n");
 
 	pdae_params->pplayback->playing = FALSE;
 	pdae_params->pplayback->output->close_audio();
 	is_paused = FALSE;
 
 	pdae_params->pplayback->output->close_audio();
-	free(buffer);
+	g_free(buffer);
 }
 
-int calculate_track_length(int startlsn, int endlsn)
+static gint calculate_track_length(gint startlsn, gint endlsn)
 {
 	return ((endlsn - startlsn + 1) * 1000) / 75;
 }
 
-int find_trackno_from_filename(char *filename)
+static gint find_trackno_from_filename(gchar *filename)
 {
+	gchar tracknostr[DEF_STRING_LEN];
 	if ((filename == NULL) || strlen(filename) <= 6)
 		return -1;
 
-	char tracknostr[3];
 	strncpy(tracknostr, filename + strlen(filename) - 6, 2);
 	tracknostr[2] = '\0';
 	return strtol(tracknostr, NULL, 10);
 }
 
-void cleanup_on_error()
+static void cleanup_on_error()
 {
 	if (playing_track != -1) {
 		playing_track = -1;
 	}
 
 	if (trackinfo != NULL) {
-		free(trackinfo);
+		g_free(trackinfo);
 		trackinfo = NULL;
 	}
 }
--- a/src/cdaudio-ng/cdaudio-ng.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/cdaudio-ng/cdaudio-ng.h	Wed Oct 03 15:37:04 2007 +0200
@@ -30,9 +30,9 @@
 
 typedef struct {
 
-	char				performer[DEF_STRING_LEN];
-	char				name[DEF_STRING_LEN];
-	char				genre[DEF_STRING_LEN];
+	gchar				performer[DEF_STRING_LEN];
+	gchar				name[DEF_STRING_LEN];
+	gchar				genre[DEF_STRING_LEN];
 	lsn_t				startlsn;
 	lsn_t				endlsn;
 
--- a/src/cdaudio-ng/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/cdaudio-ng/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -49,7 +49,7 @@
 static void				gui_to_values();
 
 
-void configure_set_variables(/*gboolean *_usedae, */int *_limitspeed, gboolean *_usecdtext, gboolean *_usecddb, char *_device, gboolean *_debug, char *_cddbserver, int *_cddbport)
+void configure_set_variables(/*gboolean *_usedae, */gint *_limitspeed, gboolean *_usecdtext, gboolean *_usecddb, gchar *_device, gboolean *_debug, gchar *_cddbserver, gint *_cddbport)
 {
 	/*usedae = _usedae;*/
 	limitspeed = _limitspeed;
@@ -214,6 +214,8 @@
 
 void values_to_gui()
 {
+	gchar portstr[16];
+
 	/*gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usedaecheckbutton), *usedae);*/
 
 	/*gtk_widget_set_sensitive(limitcheckbutton, *usedae);*/
@@ -225,8 +227,7 @@
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usecdtextcheckbutton), *usecdtext);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton), *usecddb);
 
-	char portstr[10];
-	sprintf(portstr, "%d", *cddbport);
+	g_snprintf(portstr, sizeof(portstr), "%d", *cddbport);
 	gtk_entry_set_text(GTK_ENTRY(cddbserverentry), cddbserver);
 	gtk_entry_set_text(GTK_ENTRY(cddbportentry), portstr);
 	gtk_widget_set_sensitive(cddbserverentry, *usecddb);
@@ -249,10 +250,10 @@
 		*limitspeed = 0;
 	*usecdtext = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecdtextcheckbutton));
 	*usecddb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton));
-	strcpy(cddbserver, gtk_entry_get_text(GTK_ENTRY(cddbserverentry)));
+	strncpy(cddbserver, gtk_entry_get_text(GTK_ENTRY(cddbserverentry)), strlen(gtk_entry_get_text(GTK_ENTRY(cddbserverentry))) + 1);
 	*cddbport = strtol(gtk_entry_get_text(GTK_ENTRY(cddbportentry)), NULL, 10);
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usedevicecheckbutton)))
-		strcpy(device, gtk_entry_get_text(GTK_ENTRY(deviceentry)));
+		strncpy(device, gtk_entry_get_text(GTK_ENTRY(deviceentry)), strlen(gtk_entry_get_text(GTK_ENTRY(deviceentry))) + 1);
 	else
 		strcpy(device, "");
 	*debug = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(debugcheckbutton));
--- a/src/cdaudio-ng/configure.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/cdaudio-ng/configure.h	Wed Oct 03 15:37:04 2007 +0200
@@ -2,7 +2,7 @@
 #ifndef CONFIGURE_H
 #define CONFIGURE_H
 
-void				configure_set_variables(/*gboolean *usedae, */int *limitspeed, gboolean *usecdtext, gboolean *usecddb, char *device, gboolean *debug, char *cddbserver, int *cddbport);
+void				configure_set_variables(/*gboolean *usedae, */gint *limitspeed, gboolean *usecdtext, gboolean *usecddb, char *device, gboolean *debug, gchar *cddbserver, gint *cddbport);
 void				configure_create_gui();
 void				configure_show_gui();
 
--- a/src/console/Audacious_Config.cxx	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/console/Audacious_Config.cxx	Wed Oct 03 15:37:04 2007 +0200
@@ -12,8 +12,9 @@
 
 #include <glib.h>
 #include <audacious/i18n.h>
+#include <audacious/plugin.h>
 #include <gtk/gtk.h>
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 #include "Audacious_Config.h"
 
 // TODO: add UI for echo
--- a/src/console/Audacious_Driver.cxx	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/console/Audacious_Driver.cxx	Wed Oct 03 15:37:04 2007 +0200
@@ -12,11 +12,10 @@
 #include <audacious/i18n.h>
 #include <gtk/gtk.h>
 extern "C" {
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
-#include "audacious/util.h"
-#include "audacious/output.h"
-#include "audacious/playlist.h"
+#include <audacious/plugin.h>
+#include <audacious/util.h>
+#include <audacious/output.h>
+#include <audacious/playlist.h>
 }
 #include <string.h>
 #include <stdlib.h>
--- a/src/console/Blip_Buffer.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/console/Blip_Buffer.h	Wed Oct 03 15:37:04 2007 +0200
@@ -121,9 +121,7 @@
 	friend class Blip_Reader;
 };
 
-#ifdef HAVE_CONFIG_H
-	#include "config.h"
-#endif
+#include "config.h"
 
 // Number of bits in resample ratio fraction. Higher values give a more accurate ratio
 // but reduce maximum buffer size.
--- a/src/console/Vfs_File.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/console/Vfs_File.h	Wed Oct 03 15:37:04 2007 +0200
@@ -5,7 +5,7 @@
 
 #include "Data_Reader.h"
 
-#include "audacious/vfs.h"
+#include <audacious/vfs.h>
 
 class Vfs_File_Reader : public File_Reader {
 public:
--- a/src/console/abstract_file.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/console/abstract_file.h	Wed Oct 03 15:37:04 2007 +0200
@@ -5,7 +5,7 @@
 #define ABSTRACT_FILE_H
 
 #include <stdio.h>
-#include "audacious/vfs.h"
+#include <audacious/vfs.h>
 
 // Supports reading and finding out how many bytes are remaining
 class Data_Reader {
--- a/src/cue/cuesheet.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/cue/cuesheet.c	Wed Oct 03 15:37:04 2007 +0200
@@ -26,7 +26,6 @@
 #include <audacious/plugin.h>
 #include <audacious/output.h>
 #include <audacious/playlist.h>
-#include <audacious/vfs.h>
 #include <audacious/util.h>
 #include <audacious/strings.h>
 #include <audacious/main.h>
--- a/src/curl/curl.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/curl/curl.c	Wed Oct 03 15:37:04 2007 +0200
@@ -18,7 +18,6 @@
 
 #include "config.h"
 
-#include <audacious/vfs.h>
 #include <audacious/plugin.h>
 #include <audacious/configdb.h>
 
--- a/src/daap/daap.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/daap/daap.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,7 +20,6 @@
 
 #include <glib.h>
 
-#include <audacious/vfs.h>
 #include <audacious/plugin.h>
 #include <audacious/discovery.h>
 
--- a/src/dockalbumart/dockalbumart.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/dockalbumart/dockalbumart.c	Wed Oct 03 15:37:04 2007 +0200
@@ -30,7 +30,6 @@
 #include <audacious/plugin.h>
 #include <audacious/util.h>
 #include <audacious/playlist.h>
-#include <audacious/tuple.h>
 
 #include "audacious_player.xpm"
 
--- a/src/echo_plugin/echo.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/echo_plugin/echo.c	Wed Oct 03 15:37:04 2007 +0200
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <gtk/gtk.h>
 #include <audacious/i18n.h>
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 #include "echo.h"
 
 #include "../../config.h"
--- a/src/echo_plugin/gui.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/echo_plugin/gui.c	Wed Oct 03 15:37:04 2007 +0200
@@ -2,8 +2,8 @@
 
 #include <gtk/gtk.h>
 #include <audacious/i18n.h>
-#include "audacious/util.h"
-#include "audacious/configdb.h"
+#include <audacious/util.h>
+#include <audacious/configdb.h>
 #include "echo.h"
 
 static const char *echo_about_text =
--- a/src/esd/esdout.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/esd/esdout.h	Wed Oct 03 15:37:04 2007 +0200
@@ -26,7 +26,7 @@
 
 #include <glib.h>
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 
 extern OutputPlugin op;
--- a/src/flacng/flacng.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/flacng/flacng.h	Wed Oct 03 15:37:04 2007 +0200
@@ -19,12 +19,11 @@
 #ifndef FLACNG_H
 #define FLACNG_H
 
+#include "config.h"
 #include <glib.h>
 #include <audacious/plugin.h>
 #include <audacious/main.h>
-#include <audacious/vfs.h>
 #include <audacious/i18n.h>
-# include "config.h"
 
 #define OUTPUT_BLOCK_SIZE (8192u)
 #define MAX_SUPPORTED_CHANNELS (2u)
--- a/src/flacng/plugin.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/flacng/plugin.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,10 +17,10 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include "flacng.h"
 #include <audacious/util.h>
 #include <audacious/output.h>
 #include <glib/gi18n.h>
-#include "flacng.h"
 #include "tools.h"
 #include "plugin.h"
 #include "seekable_stream_callbacks.h"
--- a/src/jack/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/jack/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -24,7 +24,7 @@
 
 #include "jack.h"
 
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 #include <audacious/i18n.h>
 # include "config.h"
 
--- a/src/jack/jack.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/jack/jack.c	Wed Oct 03 15:37:04 2007 +0200
@@ -6,8 +6,8 @@
  *	This code maps xmms calls into the jack translation library
  */
 
-#include "audacious/configdb.h"
-#include "audacious/util.h"
+#include <audacious/configdb.h>
+#include <audacious/util.h>
 #include <dlfcn.h>
 #include <gtk/gtk.h>
 #include <audacious/i18n.h>
--- a/src/jack/xconvert.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/jack/xconvert.h	Wed Oct 03 15:37:04 2007 +0200
@@ -6,7 +6,7 @@
 
 
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 void convert_free_buffer(void);
 
--- a/src/ladspa/ladspa.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/ladspa/ladspa.c	Wed Oct 03 15:37:04 2007 +0200
@@ -18,6 +18,8 @@
 
 /* BMP-ladspa port by Giacomo Lozito <city_hunter@users.sf.net> */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -31,7 +33,6 @@
 #include <audacious/configdb.h>
 #include <audacious/i18n.h>
 
-#include "../../config.h"
 #include "ladspa.h"
 
 #ifndef PATH_MAX
--- a/src/m3u/m3u.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/m3u/m3u.c	Wed Oct 03 15:37:04 2007 +0200
@@ -31,13 +31,12 @@
 #include <sys/stat.h>
 #include <sys/errno.h>
 
-#include "audacious/vfs.h"
-#include "audacious/main.h"
-#include "audacious/util.h"
-#include "audacious/playlist.h"
-#include "audacious/playlist_container.h"
-#include "audacious/plugin.h"
-#include "audacious/strings.h"
+#include <audacious/plugin.h>
+#include <audacious/main.h>
+#include <audacious/util.h>
+#include <audacious/playlist.h>
+#include <audacious/playlist_container.h>
+#include <audacious/strings.h>
 
 static void
 parse_extm3u_info(const gchar * info, gchar ** title, gint * length)
--- a/src/madplug/plugin.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/madplug/plugin.h	Wed Oct 03 15:37:04 2007 +0200
@@ -40,7 +40,6 @@
 #include <audacious/main.h>
 #include <audacious/util.h>
 #include <audacious/strings.h>
-#include <audacious/vfs.h>
 #include <audacious/i18n.h>
 #include <audacious/id3tag.h>
 #include <mad.h>
--- a/src/metronom/metronom.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/metronom/metronom.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,10 +17,10 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
 #include <audacious/plugin.h>
 #include <audacious/util.h>
 #include <audacious/i18n.h>
-#include "../../config.h"
 #include <glib.h>
 #include <string.h>
 
--- a/src/mms/mms.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/mms/mms.c	Wed Oct 03 15:37:04 2007 +0200
@@ -18,7 +18,6 @@
 
 #include <glib.h>
 
-#include <audacious/vfs.h>
 #include <audacious/plugin.h>
 #include <stdio.h>
 
--- a/src/modplug/gui/main.cxx	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/gui/main.cxx	Wed Oct 03 15:37:04 2007 +0200
@@ -8,8 +8,8 @@
 #include <gtk/gtk.h>
 #include <libintl.h>
 extern "C" {
-#include "audacious/util.h"
-#include "audacious/strings.h"
+#include <audacious/util.h>
+#include <audacious/strings.h>
 }
 
 #include "interface.h"
--- a/src/modplug/modplugbmp.cxx	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/modplugbmp.cxx	Wed Oct 03 15:37:04 2007 +0200
@@ -14,12 +14,9 @@
 #include "stddefs.h"
 #include "archive/open.h"
 extern "C" {
-#include "audacious/configdb.h"
-#include "audacious/output.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
-#include "audacious/vfs.h"
-#include "audacious/strings.h"
+#include <audacious/configdb.h>
+#include <audacious/output.h>
+#include <audacious/strings.h>
 }
 
 static char* format_and_free_ti( Tuple* ti, int* length )
@@ -506,7 +503,7 @@
 {
 	CSoundFile* lSoundFile;
 	Archive* lArchive;
-	gchar* tmps;
+	std::string tmps;
 	
 	//open and mmap the file
         lArchive = OpenArchive(aFilename);
@@ -545,7 +542,7 @@
 	case MOD_TYPE_PSM:	tmps = "Protracker Studio Module"; break;
 	default:		tmps = "ModPlug unknown"; break;
 	}
-	tuple_associate_string(ti, FIELD_CODEC, NULL, tmps);
+	tuple_associate_string(ti, FIELD_CODEC, NULL, tmps.c_str());
 	tuple_associate_string(ti, FIELD_QUALITY, NULL, "sequenced");
 	tuple_associate_int(ti, FIELD_LENGTH, NULL, lSoundFile->GetSongTime() * 1000);
 
@@ -553,9 +550,9 @@
 	 * an arbitrary module file uses .. typically it is some DOS CP-variant,
 	 * except for true Amiga modules.
 	 */
-	tmps = str_to_utf8(lSoundFile->GetTitle());
-	tuple_associate_string(ti, FIELD_TITLE, NULL, lSoundFile->GetTitle());
-	g_free(tmps);
+	gchar *tmps2 = str_to_utf8(lSoundFile->GetTitle());
+	tuple_associate_string(ti, FIELD_TITLE, NULL, tmps2);
+	g_free(tmps2);
 	
 	//unload the file
 	lSoundFile->Destroy();
--- a/src/modplug/modplugbmp.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/modplugbmp.h	Wed Oct 03 15:37:04 2007 +0200
@@ -15,9 +15,7 @@
 #endif
 
 extern "C" {
-#include "audacious/plugin.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
+#include <audacious/plugin.h>
 }
 
 /* Module files have their magic deep inside the file, at offset 1080; source: http://www.onicos.com/staff/iz/formats/mod.html and information by Michael Doering from UADE */
--- a/src/modplug/plugin.cxx	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/plugin.cxx	Wed Oct 03 15:37:04 2007 +0200
@@ -7,9 +7,7 @@
 #include "modplug.h"
 #include "gui/main.h"
 extern "C" {
-#include "audacious/plugin.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
+#include <audacious/plugin.h>
 }
 
 extern InputPlugin gModPlug;
--- a/src/modplug/sndfile.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/sndfile.h	Wed Oct 03 15:37:04 2007 +0200
@@ -5,9 +5,7 @@
  *          Adam Goode       <adam@evdebs.org> (endian and char fixes for PPC)
 */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #ifndef __SNDFILE_H
 #define __SNDFILE_H
--- a/src/modplug/sndmix.cxx	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/sndmix.cxx	Wed Oct 03 15:37:04 2007 +0200
@@ -307,7 +307,6 @@
 		} else
 		{
 			m_nMixStat += CreateStereoMix(lCount);
-			if (nMaxPlugins) ProcessPlugins(lCount);
 			ProcessStereoDSP(lCount);
 			X86_MonoFromStereo(MixSoundBuffer, lCount);
 		}
--- a/src/modplug/stdafx.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/modplug/stdafx.h	Wed Oct 03 15:37:04 2007 +0200
@@ -19,8 +19,6 @@
 #include <mmsystem.h>
 #include <stdio.h>
 
-inline void ProcessPlugins(int n) {}
-
 #elif defined(__x86_64__) || defined(__powerpc64__)
 
 #include <stdlib.h>
@@ -74,8 +72,6 @@
   return p;
 }
 
-inline void ProcessPlugins(int n) {}
-
 #define GlobalFreePtr(p) free((void *)(p))
 
 #define strnicmp(a,b,c)		strncasecmp(a,b,c)
@@ -152,8 +148,6 @@
   return p;
 }
 
-inline void ProcessPlugins(int n) {}
-
 #define GlobalFreePtr(p) free((void *)(p))
 
 #define strnicmp(a,b,c)		strncasecmp(a,b,c)
--- a/src/musepack/libmpc.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/musepack/libmpc.h	Wed Oct 03 15:37:04 2007 +0200
@@ -1,17 +1,17 @@
 #ifndef XMMS_MUSEPACK
 #define XMMS_MUSEPACK
 
+#include "config.h"
+
 //xmms headers
 extern "C"
 {
-#include "audacious/plugin.h"
-#include "audacious/output.h"
-#include "audacious/util.h"
-#include "audacious/configdb.h"
-#include "audacious/main.h"
-#include "audacious/vfs.h"
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
+#include <audacious/configdb.h>
+#include <audacious/main.h>
 #include <audacious/i18n.h>
-#include "../../config.h"
 }
 
 //stdlib headers
--- a/src/neon/debug.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/neon/debug.h	Wed Oct 03 15:37:04 2007 +0200
@@ -22,7 +22,7 @@
 
 #define _ENTER _DEBUG("enter")
 #define _LEAVE _DEBUG("leave"); return
-#define _MESSAGE(tag, string, ...) do { fprintf(stderr, "%s: libneonsrc.so: %s:%d (%s): " string "\n", \
+#define _MESSAGE(tag, string, ...) do { fprintf(stderr, "%s: neon: %s:%d (%s): " string "\n", \
     tag, __FILE__, __LINE__, __func__, ##__VA_ARGS__); } while(0)
 
 #define _ERROR(...) _MESSAGE("ERROR", __VA_ARGS__)
--- a/src/neon/neon.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/neon/neon.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,7 +17,8 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include <audacious/vfs.h>
+#include "neon.h"
+
 #include <audacious/plugin.h>
 #include <audacious/configdb.h>
 
@@ -28,7 +29,6 @@
 #include <ne_auth.h>
 
 #include "debug.h"
-#include "neon.h"
 #include "rb.h"
 
 #define NBUFSIZ (128u*1024u)
--- a/src/neon/neon.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/neon/neon.h	Wed Oct 03 15:37:04 2007 +0200
@@ -20,6 +20,8 @@
 #ifndef _NEON_PLUGIN_H
 #define _NEON_PLUGIN_H
 
+#include "config.h"
+
 #include <glib.h>
 #include <audacious/vfs.h>
 #include <ne_session.h>
--- a/src/paranormal/actuators.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/actuators.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <glib.h>
 
--- a/src/paranormal/builtins.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/builtins.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include "actuators.h"
 
--- a/src/paranormal/cfg.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/cfg.c	Wed Oct 03 15:37:04 2007 +0200
@@ -24,7 +24,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <audacious/configdb.h>
+#include <audacious/plugin.h>
 
 #include <math.h>
 
--- a/src/paranormal/cmaps.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/cmaps.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <glib.h>
 
--- a/src/paranormal/containers.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/containers.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <stdio.h>
 
--- a/src/paranormal/freq.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/freq.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <stdlib.h>
 #include <stdio.h>
--- a/src/paranormal/general.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/general.c	Wed Oct 03 15:37:04 2007 +0200
@@ -19,9 +19,7 @@
 
 /* FIXME: what to name this file? */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include "paranormal.h"
 #include "actuators.h"
--- a/src/paranormal/misc.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/misc.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <stdlib.h>
 #include <stdio.h>
--- a/src/paranormal/presets.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/presets.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,9 +20,7 @@
 /* FIXME: add documentation support to preset files */
 /* FIXME: add multiple-presets-per-file support (maybe) */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <stdlib.h>
 #include <ctype.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/paranormal/presets/aerdan_-_stonervision.pnv	Wed Oct 03 15:37:04 2007 +0200
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+
+<paranormal_preset>
+ <container_simple>
+  <container_once>
+   <wave_smooth>
+    <channels> 0 </channels>
+   </wave_smooth>
+   <cmap_dynamic>
+    <low_index> 5 </low_index>
+    <high_index> 250 </high_index>
+    <script> red = red + 0.05; blue = blue + 0.03; green = green + 0.01; </script>
+   </cmap_dynamic>
+  </container_once>
+  <general_blur>
+  </general_blur>
+  <general_fade>
+   <amount> 1 </amount>
+  </general_fade>
+  <wave_radial>
+   <base_radius> -1.00000 </base_radius>
+   <value> 253 </value>
+  </wave_radial>
+  <xform_ripple>
+   <angle> 0.00000 </angle>
+   <ripples> 8.00000 </ripples>
+   <base_speed> 2.00000 </base_speed>
+   <mod_speed> 5.00000 </mod_speed>
+  </xform_ripple>
+  <misc_floater>
+   <value> 256 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <misc_floater>
+   <value> 255 </value>
+  </misc_floater>
+  <wave_scope>
+   <init_script> n = 800; t = -0.05; </init_script>
+   <frame_script> t = t + 0.05; </frame_script>
+   <sample_script> d = index + value; r = t + index * 3.141952924 * 4; x = cos(r) * d; y = sin(r) * d; </sample_script>
+   <lines> TRUE </lines>
+  </wave_scope>
+ </container_simple>
+</paranormal_preset>
\ No newline at end of file
--- a/src/paranormal/wave.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/wave.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,9 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <math.h>
 
--- a/src/paranormal/xform.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/paranormal/xform.c	Wed Oct 03 15:37:04 2007 +0200
@@ -22,9 +22,7 @@
    so that only 1 apply_xform needs to be done for as many
    of these as someone wants to use */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include <math.h>
 
--- a/src/pls/pls.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/pls/pls.c	Wed Oct 03 15:37:04 2007 +0200
@@ -31,13 +31,12 @@
 #include <sys/stat.h>
 #include <sys/errno.h>
 
-#include "audacious/main.h"
-#include "audacious/util.h"
-#include "audacious/playlist.h"
-#include "audacious/playlist_container.h"
-#include "audacious/plugin.h"
-#include "audacious/vfs.h"
-#include "audacious/strings.h"
+#include <audacious/main.h>
+#include <audacious/util.h>
+#include <audacious/playlist.h>
+#include <audacious/playlist_container.h>
+#include <audacious/plugin.h>
+#include <audacious/strings.h>
 
 static void
 playlist_load_pls(const gchar * filename, gint pos)
--- a/src/projectm/main.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/projectm/main.c	Wed Oct 03 15:37:04 2007 +0200
@@ -50,9 +50,8 @@
 #include "sdltoprojectM.h"
 #include "video_init.h"
 
-#if HAVE_CONFIG_H
 #include <config.h>
-#endif
+
 #define CONFIG_FILE "/config"
 #define PRESETS_DIR "/presets"
 #define FONTS_DIR "/fonts"
--- a/src/rocklight/rocklight.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/rocklight/rocklight.c	Wed Oct 03 15:37:04 2007 +0200
@@ -21,7 +21,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 #include "rocklight.h"
 
 enum type {
--- a/src/scrobbler/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/scrobbler/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -1,11 +1,9 @@
 #include "settings.h"
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/util.h"
-#include "audacious/configdb.h"
+#include <audacious/util.h>
+#include <audacious/configdb.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
--- a/src/scrobbler/gtkstuff.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/scrobbler/gtkstuff.c	Wed Oct 03 15:37:04 2007 +0200
@@ -1,5 +1,5 @@
-#include "audacious/util.h"
-#include "audacious/configdb.h"
+#include <audacious/util.h>
+#include <audacious/configdb.h>
 
 #include <glib.h>
 #include <audacious/i18n.h>
--- a/src/sexypsf/Misc.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sexypsf/Misc.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,7 +16,7 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "audacious/vfs.h"
+#include <audacious/vfs.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
--- a/src/sexypsf/plugin.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sexypsf/plugin.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,13 +16,10 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "audacious/output.h"
-#include "audacious/plugin.h"
-#include "audacious/main.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
-#include "audacious/util.h"
-#include "audacious/vfs.h"
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/main.h>
+#include <audacious/util.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
--- a/src/shnplug/id3v2.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/shnplug/id3v2.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,13 +20,10 @@
  * $Id: id3v2.c,v 1.6 2007/03/23 05:49:48 jason Exp $
  */
 
+#include "config.h"
 #include <stdio.h>
 #include "shorten.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #define ID3V2_MAGIC "ID3"
 
 typedef struct {
--- a/src/shnplug/shorten.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/shnplug/shorten.h	Wed Oct 03 15:37:04 2007 +0200
@@ -13,9 +13,7 @@
 #ifndef _SHORTEN_H
 #define _SHORTEN_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdlib.h>
 #include <pthread.h>
--- a/src/sid/xmms-sid.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sid/xmms-sid.c	Wed Oct 03 15:37:04 2007 +0200
@@ -289,7 +289,7 @@
 {
 	t_xs_tuneinfo *tmpTune;
 	gboolean audioOpen = FALSE;
-	gint audioGot, tmpLength, i, subTune;
+	gint audioGot, tmpLength, subTune;
 	gchar *tmpFilename, *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle;
 	Tuple *tmpTuple;
 
@@ -548,8 +548,9 @@
 /*
  * A stub seek function (Audacious will crash if seek is NULL)
  */
-void xs_seek(InputPlayback *pb, gint iTime)
+void xs_seek(InputPlayback *pb, gint time)
 {
+	(void) pb; (void) time;
 }
 
 
--- a/src/sid/xs_config.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sid/xs_config.c	Wed Oct 03 15:37:04 2007 +0200
@@ -522,7 +522,6 @@
 	return TRUE;
 }
 
-
 /* Get the configuration (from file or default)
  */
 void xs_read_configuration(void)
@@ -755,6 +754,19 @@
 }
 
 
+/* Confirmation window
+ */
+gboolean xs_confirmwin_delete(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+	(void) widget;
+	(void) event;
+	(void) user_data;
+	
+	return FALSE;
+}
+
+
+
 /* HVSC songlength-database file selector response-functions
  */
 void xs_cfg_sldb_browse(GtkButton * button, gpointer user_data)
--- a/src/sid/xs_curve.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sid/xs_curve.c	Wed Oct 03 15:37:04 2007 +0200
@@ -169,22 +169,22 @@
 
 	switch (prop_id) {
 	case PROP_MIN_X:
-		gtk_curve_set_range(curve,
+		xs_curve_set_range(curve,
 			g_value_get_float(value), curve->max_x,
 			curve->min_y, curve->max_y);
 		break;
 	case PROP_MAX_X:
-		gtk_curve_set_range(curve,
+		xs_curve_set_range(curve,
 			curve->min_x, g_value_get_float(value),
 			curve->min_y, curve->max_y);
 		break;
 	case PROP_MIN_Y:
-		gtk_curve_set_range(curve,
+		xs_curve_set_range(curve,
 			curve->min_x, curve->max_x,
 			g_value_get_float(value), curve->max_y);
 		break;
 	case PROP_MAX_Y:
-		gtk_curve_set_range(curve,
+		xs_curve_set_range(curve,
 			curve->min_x, curve->max_x,
 			curve->min_y, g_value_get_float(value));
 		break;
--- a/src/sid/xs_genui.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sid/xs_genui.c	Wed Oct 03 15:37:04 2007 +0200
@@ -8,14 +8,3 @@
 #include "xs_interface.h"
 #include "xs_glade.h"
 
-
-
-gboolean
-xs_confirmwin_delete                   (GtkWidget       *widget,
-                                        GdkEvent        *event,
-                                        gpointer         user_data)
-{
-
-  return FALSE;
-}
-
--- a/src/smb/smb.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/smb/smb.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,7 +16,7 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <audacious/vfs.h>
+#include "config.h"
 #include <audacious/plugin.h>
 #include <stdio.h>
 
--- a/src/sndstretch/sndstretch_xmms.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sndstretch/sndstretch_xmms.c	Wed Oct 03 15:37:04 2007 +0200
@@ -25,8 +25,8 @@
 #include "FB_logo.xpm"
 
 #include "config.h"
-#include "audacious/configdb.h"
-#include "audacious/plugin.h"
+#include <audacious/configdb.h>
+#include <audacious/plugin.h>
 #include <audacious/i18n.h>
 #include <gtk/gtk.h>
 #include <math.h>
--- a/src/song_change/song_change.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/song_change/song_change.c	Wed Oct 03 15:37:04 2007 +0200
@@ -15,11 +15,11 @@
 
 #include <string.h>
 
-#include "audacious/plugin.h"
-#include "audacious/ui_preferences.h"
-#include "audacious/configdb.h"
-#include "audacious/auddrct.h"
-#include "audacious/formatter.h"
+#include <audacious/plugin.h>
+#include <audacious/ui_preferences.h>
+#include <audacious/configdb.h>
+#include <audacious/auddrct.h>
+#include <audacious/formatter.h>
 #include <audacious/i18n.h>
 #include <audacious/hook.h>
 #include <audacious/playlist.h>
--- a/src/stdio/Makefile	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/stdio/Makefile	Wed Oct 03 15:37:04 2007 +0200
@@ -8,4 +8,4 @@
 
 CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${ARCH_DEFINES} ${XML_CPPFLAGS} -I../../intl -I../..
 CFLAGS += ${PLUGIN_CFLAGS}
-LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} ${XML_LIBS} -lmagic
+LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} ${XML_LIBS}
--- a/src/stdio/stdio.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/stdio/stdio.c	Wed Oct 03 15:37:04 2007 +0200
@@ -16,9 +16,9 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <audacious/vfs.h>
+#include "config.h"
 #include <audacious/plugin.h>
-#include "audacious/strings.h"
+#include <audacious/strings.h>
 #include <stdio.h>
 
 #include <unistd.h>
@@ -27,8 +27,6 @@
 
 #include <string.h>
 
-#include <magic.h>
-
 static gchar *
 vfs_stdio_urldecode_path(const gchar * encoded_path)
 {
@@ -251,43 +249,20 @@
     return s.st_size;
 }
 
-static magic_t mdb_handle = NULL;
-
-gchar *
-stdio_vfs_metadata_impl(VFSFile *file, const gchar *field)
-{
-    if (!g_ascii_strcasecmp(field, "content-type"))
-    {
-        gchar *decpath;
-        const gchar *out;
-
-        if (mdb_handle == NULL)
-            mdb_handle = magic_open(MAGIC_MIME);
-
-        decpath = vfs_stdio_urldecode_path(file->uri);
-        out = magic_file(mdb_handle, decpath);
-
-        return g_strdup(out);
-    }
-
-    return NULL;
-}
-
 VFSConstructor file_const = {
-	"file://",
-	stdio_vfs_fopen_impl,
-	stdio_vfs_fclose_impl,
-	stdio_vfs_fread_impl,
-	stdio_vfs_fwrite_impl,
-	stdio_vfs_getc_impl,
-	stdio_vfs_ungetc_impl,
-	stdio_vfs_fseek_impl,
-	stdio_vfs_rewind_impl,
-	stdio_vfs_ftell_impl,
-	stdio_vfs_feof_impl,
-	stdio_vfs_truncate_impl,
-	stdio_vfs_fsize_impl,
-	stdio_vfs_metadata_impl
+	.uri_id = "file://",
+	.vfs_fopen_impl = stdio_vfs_fopen_impl,
+	.vfs_fclose_impl = stdio_vfs_fclose_impl,
+	.vfs_fread_impl = stdio_vfs_fread_impl,
+	.vfs_fwrite_impl = stdio_vfs_fwrite_impl,
+	.vfs_getc_impl = stdio_vfs_getc_impl,
+	.vfs_ungetc_impl = stdio_vfs_ungetc_impl,
+	.vfs_fseek_impl = stdio_vfs_fseek_impl,
+	.vfs_rewind_impl = stdio_vfs_rewind_impl,
+	.vfs_ftell_impl = stdio_vfs_ftell_impl,
+	.vfs_feof_impl = stdio_vfs_feof_impl,
+	.vfs_truncate_impl = stdio_vfs_truncate_impl,
+	.vfs_fsize_impl = stdio_vfs_fsize_impl
 };
 
 static void init(void)
--- a/src/stereo_plugin/stereo.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/stereo_plugin/stereo.c	Wed Oct 03 15:37:04 2007 +0200
@@ -1,6 +1,6 @@
 #include <gtk/gtk.h>
 #include <audacious/i18n.h>
-#include "audacious/util.h"
+#include <audacious/util.h>
 
 #include <audacious/plugin.h>
 #include <audacious/configdb.h>
--- a/src/sun/about.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sun/about.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,7 +20,7 @@
 #include <glib.h>
 
 #include "sun.h"
-#include "audacious/util.h"
+#include <audacious/util.h>
 #include <audacious/i18n.h>
 
 void sun_about(void)
--- a/src/sun/audio.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sun/audio.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,7 +20,7 @@
 /* FIXME: g_error() is used several places, it will exit xmms */
 
 #include <errno.h>
-#include "audacious/util.h"
+#include <audacious/util.h>
 #include "sun.h"
 #include "resample.h"
 
--- a/src/sun/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sun/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -22,8 +22,8 @@
 #include <errno.h>
 
 #include "sun.h"
-#include "audacious/util.h"
-#include "audacious/configdb.h"
+#include <audacious/util.h>
+#include <audacious/configdb.h>
 #include <audacious/i18n.h>
 
 #include "mixer.h"
--- a/src/sun/sun.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sun/sun.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,7 +20,7 @@
 #include <glib.h>
 
 #include "sun.h"
-#include "audacious/configdb.h"
+#include <audacious/configdb.h>
 #include <audacious/i18n.h>
 
 #include <errno.h>
--- a/src/sun/sun.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/sun/sun.h	Wed Oct 03 15:37:04 2007 +0200
@@ -35,8 +35,8 @@
 
 #include "audioio.h"
 
-#include "audacious/plugin.h"
-#include "audacious/configdb.h"
+#include <audacious/plugin.h>
+#include <audacious/configdb.h>
 
 /* Default path to audio device. */
 #ifndef SUN_DEV_AUDIO
--- a/src/timidity/libtimidity/common.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/common.c	Wed Oct 03 15:37:04 2007 +0200
@@ -21,11 +21,8 @@
 
    */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <stdlib.h>
 #include <string.h>
 
--- a/src/timidity/libtimidity/instrum.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/instrum.c	Wed Oct 03 15:37:04 2007 +0200
@@ -23,11 +23,8 @@
 
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <string.h>
 #include <stdlib.h>
 
--- a/src/timidity/libtimidity/mix.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/mix.c	Wed Oct 03 15:37:04 2007 +0200
@@ -21,11 +21,8 @@
 
     mix.c */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <math.h>
 #include <stdlib.h>
 
--- a/src/timidity/libtimidity/output.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/output.c	Wed Oct 03 15:37:04 2007 +0200
@@ -22,9 +22,7 @@
     Audio output (to file / device) functions.
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include "timidity.h"
 #include "timidity_internal.h"
--- a/src/timidity/libtimidity/playmidi.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/playmidi.c	Wed Oct 03 15:37:04 2007 +0200
@@ -21,11 +21,8 @@
 
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <stdlib.h>
 #include <string.h>
 
--- a/src/timidity/libtimidity/readmidi.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/readmidi.c	Wed Oct 03 15:37:04 2007 +0200
@@ -19,11 +19,8 @@
 
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <stdlib.h>
 #include <string.h>
 
--- a/src/timidity/libtimidity/resample.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/resample.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,11 +20,8 @@
     resample.c
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <math.h>
 #include <stdlib.h>
 
--- a/src/timidity/libtimidity/stream.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/stream.c	Wed Oct 03 15:37:04 2007 +0200
@@ -1,6 +1,4 @@
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
 #include "string.h"
 
--- a/src/timidity/libtimidity/tables.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/tables.c	Wed Oct 03 15:37:04 2007 +0200
@@ -19,11 +19,7 @@
 
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include "audacious/vfs.h"
+#include <config.h>
 
 #include "timidity.h"
 #include "tables.h"
--- a/src/timidity/libtimidity/timidity.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/timidity.c	Wed Oct 03 15:37:04 2007 +0200
@@ -19,11 +19,8 @@
 
 */
 
-#if HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <config.h>
 
-#include "audacious/vfs.h"
 #include <stdlib.h>
 #include <string.h>
 
--- a/src/timidity/libtimidity/timidity.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/libtimidity/timidity.h	Wed Oct 03 15:37:04 2007 +0200
@@ -23,7 +23,7 @@
 #ifndef TIMIDITY_H
 #define TIMIDITY_H
 
-#include "audacious/vfs.h"
+#include <audacious/vfs.h>
 #include <stdlib.h>
 
 #ifdef __cplusplus
--- a/src/timidity/xmms-timidity.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/xmms-timidity.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,18 +17,17 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <config.h>
+#include "config.h"
 
-#include "audacious/util.h"
-#include "audacious/configdb.h"
-#include "audacious/main.h"
-#include "audacious/vfs.h"
+#include <audacious/util.h>
+#include <audacious/configdb.h>
+#include <audacious/main.h>
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <string.h>
 #include <timidity.h>
 #include <stdio.h>
-#include "audacious/output.h"
+#include <audacious/output.h>
 #include <audacious/i18n.h>
 
 #include "xmms-timidity.h"
--- a/src/timidity/xmms-timidity.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/timidity/xmms-timidity.h	Wed Oct 03 15:37:04 2007 +0200
@@ -21,20 +21,19 @@
 #define XMMS_TIMIDITY_H
 
 #include <audacious/plugin.h>
-#include <audacious/vfs.h>
 
 extern InputPlugin xmmstimid_ip;
 
 static void xmmstimid_init(void);
 static void xmmstimid_about(void);
 static void xmmstimid_configure(void);
-static int xmmstimid_is_our_fd( char * filename, VFSFile * fp );
+static int xmmstimid_is_our_fd(gchar * filename, VFSFile * fp );
 static void xmmstimid_play_file(InputPlayback * playback);
 static void xmmstimid_stop(InputPlayback * playback);
 static void xmmstimid_pause(InputPlayback * playback, short p);
 static void xmmstimid_seek(InputPlayback * playback, int time);
 static int xmmstimid_get_time(InputPlayback * playback);
 static void xmmstimid_cleanup(void);
-static void xmmstimid_get_song_info(char *filename, char **title, int *length);
+static void xmmstimid_get_song_info(gchar *filename, gchar **title, gint *length);
 
 #endif
--- a/src/tonegen/tonegen.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/tonegen/tonegen.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,11 +17,11 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "audacious/plugin.h"
-#include "audacious/output.h"
-#include "audacious/util.h"
+#include "config.h"
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
 #include <audacious/i18n.h>
-#include "config.h"
 #include <glib.h>
 #include <stdlib.h>
 #include <string.h>
--- a/src/tta/libtta.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/tta/libtta.c	Wed Oct 03 15:37:04 2007 +0200
@@ -39,14 +39,12 @@
 #include <glib.h>
 #include <string.h>
 
+#include <audacious/plugin.h>
 #include <audacious/util.h>
-#include <audacious/plugin.h>
 #include <audacious/main.h>
-#include <audacious/vfs.h>
 #include <audacious/output.h>
 #include <audacious/strings.h>
 #include <audacious/i18n.h>
-
 #include <audacious/id3tag.h>
 
 #define  PLUGIN_VERSION "1.4"
--- a/src/voice_removal/voice_removal.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/voice_removal/voice_removal.c	Wed Oct 03 15:37:04 2007 +0200
@@ -20,11 +20,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  *
  */
+#include "config.h"
 
 #include <gtk/gtk.h>
 #include <audacious/plugin.h>
 
-#include "../../config.h"
 
 static int apply_effect (gpointer *d, gint length, AFormat afmt,
 			gint srate, gint nch);
--- a/src/vorbis/configure.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vorbis/configure.c	Wed Oct 03 15:37:04 2007 +0200
@@ -7,9 +7,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "audacious/configdb.h"
-#include "audacious/util.h"
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
+#include <audacious/configdb.h>
+#include <audacious/util.h>
 #include <audacious/i18n.h>
 
 extern GMutex *vf_mutex;
--- a/src/vorbis/fileinfo.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vorbis/fileinfo.c	Wed Oct 03 15:37:04 2007 +0200
@@ -37,7 +37,6 @@
 
 #include <audacious/strings.h>
 #include <audacious/util.h>
-#include <audacious/vfs.h>
 #include <audacious/i18n.h>
 
 #include "vorbis.h"
--- a/src/vorbis/vcedit.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vorbis/vcedit.c	Wed Oct 03 15:37:04 2007 +0200
@@ -17,7 +17,6 @@
 #include <vorbis/codec.h>
 
 #include "vcedit.h"
-#include <audacious/vfs.h>
 
 #define CHUNKSIZE 4096
 
--- a/src/vorbis/vorbis.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vorbis/vorbis.c	Wed Oct 03 15:37:04 2007 +0200
@@ -50,11 +50,11 @@
 #include <vorbis/codec.h>
 #include <vorbis/vorbisfile.h>
 
-#include "audacious/plugin.h"
-#include "audacious/output.h"
-#include "audacious/util.h"
-#include "audacious/configdb.h"
-#include "audacious/main.h"
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
+#include <audacious/configdb.h>
+#include <audacious/main.h>
 #include <audacious/i18n.h>
 #include <audacious/strings.h>
 
--- a/src/vorbis/vorbis.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vorbis/vorbis.h	Wed Oct 03 15:37:04 2007 +0200
@@ -3,7 +3,7 @@
 
 #include <vorbis/vorbisfile.h>
 
-#include "audacious/vfs.h"
+#include <audacious/vfs.h>
 
 typedef struct {
     VFSFile *fd;
--- a/src/vtx/config.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vtx/config.c	Wed Oct 03 15:37:04 2007 +0200
@@ -1,7 +1,7 @@
 /*
  *    Plugin configure dialog.
  */
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 void vtx_config(void)
 {
--- a/src/vtx/vtx.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/vtx/vtx.h	Wed Oct 03 15:37:04 2007 +0200
@@ -9,7 +9,7 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 void vtx_init(void);
 void vtx_about(void);
--- a/src/wav/wav-sndfile.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wav/wav-sndfile.c	Wed Oct 03 15:37:04 2007 +0200
@@ -34,13 +34,11 @@
 #include <string.h>
 #include <math.h>
 
-#include "audacious/plugin.h"
-#include "audacious/util.h"
-#include "audacious/i18n.h"
-#include "audacious/main.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
-#include "audacious/output.h"
+#include <audacious/plugin.h>
+#include <audacious/util.h>
+#include <audacious/i18n.h>
+#include <audacious/main.h>
+#include <audacious/output.h>
 #include "wav-sndfile.h"
 
 #include <sndfile.h>
@@ -498,14 +496,14 @@
 }
 
 static void
-file_seek (InputPlayback *playback, int time)
+file_seek (InputPlayback *playback, gint time)
 {
 	gulong millisecond = time * 1000;
 	file_mseek(playback, millisecond);
 }
 
 static void
-get_song_info (char *filename, char **title, int *length)
+get_song_info (gchar *filename, gchar **title, gint *length)
 {
 	(*length) = get_song_length(filename);
 	(*title) = get_title(filename);
--- a/src/wav/wav-sndfile.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wav/wav-sndfile.h	Wed Oct 03 15:37:04 2007 +0200
@@ -29,8 +29,8 @@
 static	int	is_our_file (char *filename);
 static	void 	play_start (InputPlayback *playback);
 static	void 	play_stop (InputPlayback *playback);
-static	void 	file_seek (InputPlayback *playback, int time);
-static	void 	get_song_info (char *filename, char **title, int *length);
+static	void 	file_seek (InputPlayback *playback, gint time);
+static	void 	get_song_info (gchar *filename, gchar **title, gint *length);
 static	Tuple*  get_song_tuple (gchar *filename);
 static  void    wav_about (void);
 static	void	play_pause (InputPlayback *playback, gshort p);
--- a/src/wav/wav.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wav/wav.c	Wed Oct 03 15:37:04 2007 +0200
@@ -28,9 +28,7 @@
 
 #include <audacious/util.h>
 #include <audacious/main.h>
-#include <audacious/tuple.h>
-#include <audacious/tuple_formatter.h>
-#include "audacious/output.h"
+#include <audacious/output.h>
 #include <audacious/i18n.h>
 
 gchar *wav_fmts[] = { "wav", "raw", "pcm", NULL };
--- a/src/wav/wav.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wav/wav.h	Wed Oct 03 15:37:04 2007 +0200
@@ -21,11 +21,8 @@
 #include "config.h"
 
 #include <glib.h>
-
 #include <sys/types.h>
-
-#include <audacious/vfs.h>
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
 
 #define	WAVE_FORMAT_UNKNOWN		(0x0000)
 #define	WAVE_FORMAT_PCM			(0x0001)
--- a/src/wma/Makefile	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wma/Makefile	Wed Oct 03 15:37:04 2007 +0200
@@ -25,6 +25,6 @@
 include ../../buildsys.mk
 include ../../extra.mk
 
-CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} -I../.. -I./libffwma -std=c99 ${GCC42_CFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${SIMD_CFLAGS} -I../.. -I./libffwma -std=c99 ${GCC42_CFLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 CFLAGS += ${PLUGIN_CFLAGS}
 LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS}
--- a/src/wma/libffwma/common.h	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wma/libffwma/common.h	Wed Oct 03 15:37:04 2007 +0200
@@ -6,9 +6,7 @@
 #ifndef COMMON_H
 #define COMMON_H
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #define TUNECPU generic
 #undef HAVE_MMX
--- a/src/wma/libffwma/fft.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wma/libffwma/fft.c	Wed Oct 03 15:37:04 2007 +0200
@@ -25,10 +25,7 @@
 #include "dsputil.h"
 
 #ifdef HAVE_ALTIVEC
-
-#ifdef HAVE_ALTIVEC_H
 #include <altivec.h>
-#endif
 
 #ifdef CONFIG_DARWIN
 #include <sys/sysctl.h>
--- a/src/wma/libffwma/file.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wma/libffwma/file.c	Wed Oct 03 15:37:04 2007 +0200
@@ -22,7 +22,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
-#include "audacious/vfs.h"
+#include <audacious/vfs.h>
 
 /* standard file protocol */
 
--- a/src/wma/wma.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/wma/wma.c	Wed Oct 03 15:37:04 2007 +0200
@@ -35,15 +35,12 @@
 #include <strings.h>
 #include <glib.h>
 
-#include "audacious/plugin.h"
-#include "audacious/output.h"
-#include "audacious/util.h"
-#include "audacious/vfs.h"
-#include "audacious/strings.h"
-#include "audacious/i18n.h"
-#include "audacious/main.h"
-#include "audacious/tuple.h"
-#include "audacious/tuple_formatter.h"
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
+#include <audacious/strings.h>
+#include <audacious/i18n.h>
+#include <audacious/main.h>
 
 #include "avcodec.h"
 #include "avformat.h"
--- a/src/xspf/xspf.c	Wed Oct 03 15:35:56 2007 +0200
+++ b/src/xspf/xspf.c	Wed Oct 03 15:37:04 2007 +0200
@@ -30,11 +30,11 @@
 #include <sys/stat.h>
 #include <sys/errno.h>
 
-#include "audacious/main.h"
-#include "audacious/util.h"
-#include "audacious/playlist.h"
-#include "audacious/playlist_container.h"
-#include "audacious/plugin.h"
+#include <audacious/plugin.h>
+#include <audacious/main.h>
+#include <audacious/util.h>
+#include <audacious/playlist.h>
+#include <audacious/playlist_container.h>
 
 #include <libxml/tree.h>
 #include <libxml/parser.h>
@@ -78,14 +78,22 @@
 static const gint xspf_nentries = (sizeof(xspf_entries) / sizeof(xspf_entry_t));
 
 
+#ifdef DEBUG
+#  define XSDEBUG(...) { fprintf(stderr, "xspf[%s:%d]: ", __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); }
+#else
+#  define XSDEBUG(...) /* stub */
+#endif
+
+
 static gboolean is_uri(gchar *uri)
 {
-    if(strstr(uri, "://"))
+    if (strstr(uri, "://"))
         return TRUE;
     else
         return FALSE;
 }
 
+
 /* This function is taken from libxml2-2.6.27.
  */
 static xmlChar *xspf_path_to_uri(const xmlChar *path)
@@ -115,7 +123,8 @@
 }
 
 
-static void xspf_add_file(xmlNode *track, const gchar *filename, gint pos, const gchar *base)
+static void xspf_add_file(xmlNode *track, const gchar *filename,
+            gint pos, const gchar *base)
 {
     xmlNode *nptr;
     Tuple *tuple;
@@ -196,10 +205,9 @@
 
         tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, strrchr(location, '.'));
 
-#ifdef DEBUG
-        printf("xspf: tuple->file_name = %s\n", tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
-        printf("xspf: tuple->file_path = %s\n", tuple_get_string(tuple, FIELD_FILE_PATH, NULL));
-#endif
+        XSDEBUG("tuple->file_name = %s\n", tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
+        XSDEBUG("tuple->file_path = %s\n", tuple_get_string(tuple, FIELD_FILE_PATH, NULL));
+
         // add file to playlist
         uri = g_filename_to_uri(location, NULL, NULL);
         // uri would be NULL if location is already uri. --yaz
@@ -212,7 +220,8 @@
 }
 
 
-static void xspf_find_track(xmlNode *tracklist, const gchar *filename, gint pos, const gchar *base)
+static void xspf_find_track(xmlNode *tracklist, const gchar *filename,
+            gint pos, const gchar *base)
 {
     xmlNode *nptr;
 
@@ -242,7 +251,6 @@
                 playlist->attribute ^= PLAYLIST_STATIC;
 
             xmlFree(opt);
-            opt = NULL;
         }
     }
 }
@@ -252,39 +260,37 @@
 {
     xmlDocPtr doc;
     xmlNode *nptr, *nptr2;
-    gchar *tmp = NULL, *base = NULL;
 
     g_return_if_fail(filename != NULL);
 
-#ifdef DEBUG
-    printf("playlist_load_xspf: filename = %s\n", filename);
-#endif
+    XSDEBUG("filename='%s', pos=%d\n", filename, pos);
 
     doc = xmlRecoverFile(filename);
-    if(doc == NULL)
+    if (doc == NULL)
         return;
 
     // find trackList
     for (nptr = doc->children; nptr != NULL; nptr = nptr->next) {
         if (nptr->type == XML_ELEMENT_NODE &&
             !xmlStrcmp(nptr->name, (xmlChar *)"playlist")) {
+            gchar *tmp, *base;
+            
             base = (gchar *)xmlNodeGetBase(doc, nptr);
-#ifdef DEBUG
-            printf("playlist_load_xspf: base @1 = %s\n", base);
-#endif
+
+            XSDEBUG("base @1 = %s\n", base);
+            
             // if filename is specified as a base, ignore it.
             tmp = xmlURIUnescapeString(base, -1, NULL);
-            if(tmp) {
-                if(!strcmp(tmp, filename)) {   
+            if (tmp) {
+                if (!strcmp(tmp, filename)) {   
                     xmlFree(base);
                     base = NULL;
                 }
                 g_free(tmp);
-                tmp = NULL;
             }
-#ifdef DEBUG
-            printf("playlist_load_xspf: base @2 = %s\n", base);
-#endif
+            
+            XSDEBUG("base @2 = %s\n", base);
+            
             for (nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) {
 
                 if (nptr2->type == XML_ELEMENT_NODE &&
@@ -306,7 +312,7 @@
                     }
                     xmlFree(title);
                 } else
-                if(nptr2->type == XML_ELEMENT_NODE &&
+                if (nptr2->type == XML_ELEMENT_NODE &&
                     !xmlStrcmp(nptr2->name, (xmlChar *)"trackList")) {
                     xspf_find_track(nptr2, filename, pos, base);
                 }
@@ -317,9 +323,9 @@
 }
 
 
-static void xspf_add_node(
-        xmlNodePtr node, TupleValueType type, gboolean isMeta,
-        const gchar *xspfName, const gchar *strVal, const gint intVal)
+static void xspf_add_node(xmlNodePtr node, TupleValueType type,
+        gboolean isMeta, const gchar *xspfName, const gchar *strVal,
+        const gint intVal)
 {
     gchar tmps[64];
     xmlNodePtr tmp;
@@ -357,9 +363,7 @@
     gchar *base = NULL;
     Playlist *playlist = playlist_get_active();
 
-#ifdef DEBUG
-    printf("playlist_save_xspf: filename = %s\n", filename);
-#endif
+    XSDEBUG("filename='%s', pos=%d\n", filename, pos);
 
     doc = xmlNewDoc((xmlChar *)"1.0");
     doc->charset = XML_CHAR_ENCODING_UTF8;
@@ -381,15 +385,13 @@
             gint tmplen = 0;
 
             if (!is_uri(entry->filename)) { //obsolete
-                gchar *tmp2;
-                tmp2 = g_path_get_dirname(entry->filename);
+                gchar *tmp2 = g_path_get_dirname(entry->filename);
                 tmp = g_strdup_printf("%s/", tmp2);
                 g_free(tmp2);
-            } else {
+            } else
                 tmp = g_strdup(entry->filename);
-            }
 
-            if(!base) {
+            if (!base) {
                 base = strdup(tmp);
                 baselen = strlen(base);
             }
@@ -409,43 +411,34 @@
                 g_free(base);
                 base = tmp;
                 baselen = tmplen;
-#ifdef DEBUG
-                printf("base = \"%s\" baselen = %d\n", base, baselen);
-#endif
-            }
-            else {
+                XSDEBUG("base='%s', baselen=%d\n", base, baselen);
+            } else
                 g_free(tmp);
-                tmp = NULL;
-            }
         }
         
         /* set base URI */
         if (base) {
             gchar *tmp;
-            if(!is_uri(base)) {
+            if (!is_uri(base)) {
                 tmp = (gchar *) xspf_path_to_uri((xmlChar *)base);
-                if(tmp) {
+                if (tmp) {
                     g_free(base);
                     base = tmp;
                 }
             }
 
-            if(!is_uri(base)) {
-#ifdef DEBUG
-                printf("base is not uri. something is wrong.\n");
-#endif
+            if (!is_uri(base)) {
+                XSDEBUG("base is not uri. something is wrong.\n");
                 tmp = g_strdup_printf("file://%s", base);
                 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp);
                 g_free(tmp);
-            }
-            else
+            } else
                 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)base);
         }
     }                           /* USE_RELATIVE */
 
     /* common */
     xmlDocSetRootElement(doc, rootnode);
-
     xspf_add_node(rootnode, TUPLE_STRING, FALSE, "creator", PACKAGE "-" VERSION, 0);
 
     /* add staticlist marker */
@@ -471,7 +464,7 @@
     tracklist = xmlNewNode(NULL, (xmlChar *)"trackList");
     xmlAddChild(rootnode, tracklist);
 
-    for(node = playlist->entries; node != NULL; node = g_list_next(node)) {
+    for (node = playlist->entries; node != NULL; node = g_list_next(node)) {
         PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
         xmlNodePtr track, location;
         gchar *filename = NULL;
@@ -481,26 +474,21 @@
         track = xmlNewNode(NULL, (xmlChar *)"track");
         location = xmlNewNode(NULL, (xmlChar *)"location");
 
-        if(is_uri(entry->filename)) {   /* uri */
-#ifdef DEBUG
-            printf("filename is uri\n");
-#endif
+        if (is_uri(entry->filename)) {   /* uri */
+            XSDEBUG("filename is uri\n");
             filename = g_strdup(entry->filename + baselen); // entry->filename is always uri now.
-        }
-        else {                  /* local file (obsolete) */
+        } else {                  /* local file (obsolete) */
             gchar *tmp = (gchar *) xspf_path_to_uri((const xmlChar *)entry->filename + baselen);
-            if(base) { /* relative */
+            if (base) { /* relative */
                 filename = g_strdup_printf("%s", tmp);
             } else {
-#ifdef DEBUG
-                printf("absolute and local (obsolete)\n");
-#endif
+                XSDEBUG("absolute and local (obsolete)\n");
                 filename = g_filename_to_uri(tmp, NULL, NULL);
             }
-            g_free(tmp); tmp = NULL;
+            g_free(tmp);
         } /* obsolete */
 
-        if(!g_utf8_validate(filename, -1, NULL))
+        if (!g_utf8_validate(filename, -1, NULL))
             continue;
 
         xmlAddChild(location, xmlNewText((xmlChar *)filename));
@@ -557,17 +545,13 @@
         }
 
         g_free(filename);
-        filename = NULL;
     }
 
     PLAYLIST_UNLOCK(playlist);
 
     xmlSaveFormatFile(filename, doc, 1);
     xmlFreeDoc(doc);
-    doc = NULL;
-
     xmlFree(base);
-    base = NULL;
 }
 
 
@@ -578,14 +562,17 @@
     .plc_write = xspf_playlist_save,
 };
 
+
 static void xspf_init(void)
 {
     playlist_container_register(&plc_xspf);
 }
 
+
 static void xspf_cleanup(void)
 {
     playlist_container_unregister(&plc_xspf);
 }
 
+
 DECLARE_PLUGIN(xspf, xspf_init, xspf_cleanup, NULL, NULL, NULL, NULL, NULL, NULL);