changeset 2121:8f1c26966b61

Assume DOS codepage 850 to be the default charset used in most modules.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 23 Oct 2007 09:03:55 +0300
parents 447da61804f1
children 1be75b01ded3
files src/modplug/gui/main.cxx src/modplug/modplugbmp.cxx src/modplug/modplugbmp.h src/modplug/stddefs.h
diffstat 4 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/modplug/gui/main.cxx	Tue Oct 23 08:58:15 2007 +0300
+++ b/src/modplug/gui/main.cxx	Tue Oct 23 09:03:55 2007 +0300
@@ -182,7 +182,7 @@
 
 	lInfo = lShortFN;
 	lInfo += '\n';
-	tmps = aud_str_to_utf8(lSoundFile->GetTitle());
+	tmps = MODPLUG_CONVERT(lSoundFile->GetTitle());
 	lInfo += tmps;
 	g_free(tmps);
 	lInfo += '\n';
@@ -282,7 +282,7 @@
 	for(i = 0; i < lNumSamples; i++)
 	{
 		lSoundFile->GetSampleName(i, lBuffer);
-		tmps = aud_str_to_utf8(lBuffer);
+		tmps = MODPLUG_CONVERT(lBuffer);
 		lInfo += tmps;
 		g_free(tmps);
 		lInfo += '\n';
@@ -293,7 +293,7 @@
 	for(i = 0; i < lNumInstruments; i++)
 	{
 		lSoundFile->GetInstrumentName(i, lBuffer);
-		tmps = aud_str_to_utf8(lBuffer);
+		tmps = MODPLUG_CONVERT(lBuffer);
 		lInfo += tmps;
 		g_free(tmps);
 		lInfo += '\n';
@@ -307,7 +307,7 @@
 	//gtk_text_backward_delete(textbox, length);
 	length = lSoundFile->GetSongComments(message, MAX_MESSAGE_LENGTH, 80);
 	if (length != 0) {
-		tmps = aud_str_to_utf8(message);
+		tmps = MODPLUG_CONVERT(message);
 		gtk_label_set_text((GtkLabel*)lookup_widget(InfoWin, "info_message"), tmps);
 		g_free(tmps);
 	}
--- a/src/modplug/modplugbmp.cxx	Tue Oct 23 08:58:15 2007 +0300
+++ b/src/modplug/modplugbmp.cxx	Tue Oct 23 09:03:55 2007 +0300
@@ -504,7 +504,7 @@
 {
 	CSoundFile* lSoundFile;
 	Archive* lArchive;
-	std::string tmps;
+	const gchar *tmps;
 	
 	//open and mmap the file
         lArchive = OpenArchive(aFilename);
@@ -543,15 +543,11 @@
 	case MOD_TYPE_PSM:	tmps = "Protracker Studio Module"; break;
 	default:		tmps = "ModPlug unknown"; break;
 	}
-	aud_tuple_associate_string(ti, FIELD_CODEC, NULL, tmps.c_str());
+	aud_tuple_associate_string(ti, FIELD_CODEC, NULL, tmps);
 	aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "sequenced");
 	aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, lSoundFile->GetSongTime() * 1000);
-
-	/* NOTICE! FIXME? This is actually incorrect. We _cannot_ know what charset
-	 * an arbitrary module file uses .. typically it is some DOS CP-variant,
-	 * except for true Amiga modules.
-	 */
-	gchar *tmps2 = aud_str_to_utf8(lSoundFile->GetTitle());
+	
+	gchar *tmps2 = MODPLUG_CONVERT(lSoundFile->GetTitle());
 	aud_tuple_associate_string(ti, FIELD_TITLE, NULL, tmps2);
 	g_free(tmps2);
 	
--- a/src/modplug/modplugbmp.h	Tue Oct 23 08:58:15 2007 +0300
+++ b/src/modplug/modplugbmp.h	Tue Oct 23 09:03:55 2007 +0300
@@ -18,8 +18,6 @@
 #include <audacious/plugin.h>
 }
 
-#define MODPLUG_CFGID	"modplug"
-
 /* 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 */
 #define MOD_MAGIC_PROTRACKER4	(unsigned char [4]) { 0x4D, 0x2E, 0x4B, 0x2E }  // "M.K." - Protracker 4 channel
 #define MOD_MAGIC_PROTRACKER4X	(unsigned char [4]) { 0x4D, 0x21, 0x4B, 0x21 }  // "M!K!" - Protracker 4 channel
--- a/src/modplug/stddefs.h	Tue Oct 23 08:58:15 2007 +0300
+++ b/src/modplug/stddefs.h	Tue Oct 23 09:03:55 2007 +0300
@@ -11,6 +11,9 @@
 #if !defined(__MODPLUGXMMS_STDDEFS_H__INCLUDED__)
 #define __MODPLUGXMMS_STDDEFS_H__INCLUDED__
 
+#define MODPLUG_CFGID		"modplug"
+#define MODPLUG_CONVERT(X)	g_convert(X, -1, "UTF-8", "CP850", NULL, NULL, NULL)
+
 //Invalid pointer
 #ifndef NULL
 #define NULL 0