summaryrefslogtreecommitdiffstats
path: root/fixes/zinf-fixes/zinf-ds.patch
diff options
context:
space:
mode:
Diffstat (limited to 'fixes/zinf-fixes/zinf-ds.patch')
-rw-r--r--fixes/zinf-fixes/zinf-ds.patch229
1 files changed, 229 insertions, 0 deletions
diff --git a/fixes/zinf-fixes/zinf-ds.patch b/fixes/zinf-fixes/zinf-ds.patch
new file mode 100644
index 0000000..4e4b839
--- /dev/null
+++ b/fixes/zinf-fixes/zinf-ds.patch
@@ -0,0 +1,229 @@
+diff -dPNur zinf-2.2.5/plm/metadata/id3lib/id3lib.cpp zinf-2.2.5-new/plm/metadata/id3lib/id3lib.cpp
+--- zinf-2.2.5/plm/metadata/id3lib/id3lib.cpp 2004-01-30 13:06:02.000000000 +0100
++++ zinf-2.2.5-new/plm/metadata/id3lib/id3lib.cpp 2005-07-19 23:37:11.000000000 +0200
+@@ -304,10 +304,45 @@
+ }
+
+
++static int rccGetCurrentEncoding(char *result, unsigned int n) {
++ unsigned int i;
++ char *l;
++
++ if ((!result)||(!n)) return -1;
++
++ l = getenv("CHARSET");
++#ifdef HAVE_CODESET
++ if (!l) l = nl_langinfo(CODESET);
++#endif
++ if (l) {
++ if (strlen(l)>=n) return -1;
++ strcpy(result, l);
++ return 0;
++ }
++
++ l = setlocale(LC_CTYPE, NULL);
++ if (!l) return -1;
++
++ for (i=0;((l[i])&&(l[i]!='.')&&(l[i]!='_'));i++);
++ if (i>=n) return -1;
++
++ l = strrchr(l, '.');
++ if (!l) return -1;
++
++ for (i=0;((l[i])&&(l[i]!='@'));i++);
++ if (i>=n) return -1;
++
++ strncpy(result,l+1,i-1);
++ result[i]=0;
++
++ return 0;
++}
++
+ static
+ bool getTag(ID3_Tag&tag, ID3_FrameID frameid, string &result)
+ {
+- static char buffer[1024];
++ int err;
++ static char buffer[1024], locale[64];
+ #ifdef HAVE_GLIB
+ gchar *utfbuffer;
+ #endif
+@@ -326,7 +361,8 @@
+ return true;
+ }
+ else {
+- utfbuffer=g_convert(buffer, sizeof buffer, "UTF-8", charset.c_str(), NULL, NULL, NULL);
++ err = rccGetCurrentEncoding(locale, 64);
++ utfbuffer=g_convert(buffer, sizeof buffer, "UTF-8", err?charset.c_str():locale, NULL, NULL, NULL);
+ result=utfbuffer;
+ g_free(utfbuffer);
+ return true;
+diff -dPNur zinf-2.2.5/ui/ncurses/Makefile.am zinf-2.2.5-new/ui/ncurses/Makefile.am
+--- zinf-2.2.5/ui/ncurses/Makefile.am 2003-09-16 19:35:31.000000000 +0200
++++ zinf-2.2.5-new/ui/ncurses/Makefile.am 2005-07-19 23:51:02.000000000 +0200
+@@ -3,11 +3,11 @@
+ plugin_LTLIBRARIES = ncurses-ui.la
+
+ ncurses_ui_la_SOURCES = ncursesUI.cpp
+-ncurses_ui_la_LIBADD = $(NCURSES_LIBS)
++ncurses_ui_la_LIBADD = $(NCURSES_LIBS) $(GLIB_LIBS)
+ ncurses_ui_la_LDFLAGS = $(plugin_ldflags)
+
+ noinst_HEADERS = ncursesUI.h
+
+-AM_CPPFLAGS = $(THREAD_CFLAGS) $(base_includes)
++AM_CPPFLAGS = $(THREAD_CFLAGS) $(base_includes) $(GLIB_CFLAGS)
+
+ # arch-tag: 19b44c0b-0802-4cfc-9d47-519f9049c888
+diff -dPNur zinf-2.2.5/ui/ncurses/Makefile.in zinf-2.2.5-new/ui/ncurses/Makefile.in
+--- zinf-2.2.5/ui/ncurses/Makefile.in 2004-02-09 01:48:25.000000000 +0100
++++ zinf-2.2.5-new/ui/ncurses/Makefile.in 2005-07-20 00:23:03.823574339 +0200
+@@ -231,7 +231,7 @@
+
+ noinst_HEADERS = ncursesUI.h
+
+-AM_CPPFLAGS = $(THREAD_CFLAGS) $(base_includes)
++AM_CPPFLAGS = $(THREAD_CFLAGS) $(base_includes) $(GLIB_CFLAGS)
+ subdir = ui/ncurses
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+diff -dPNur zinf-2.2.5/ui/ncurses/ncursesUI.cpp zinf-2.2.5-new/ui/ncurses/ncursesUI.cpp
+--- zinf-2.2.5/ui/ncurses/ncursesUI.cpp 2003-09-16 19:35:31.000000000 +0200
++++ zinf-2.2.5-new/ui/ncurses/ncursesUI.cpp 2005-07-20 00:03:31.000000000 +0200
+@@ -32,6 +32,7 @@
+ #include <termios.h>
+ #include <signal.h>
+
++
+ using namespace std;
+ #include "config.h"
+ #include "i18n.h"
+@@ -41,6 +42,10 @@
+ #include "thread.h"
+ #include "eventdata.h"
+
++#ifdef HAVE_GLIB
++#include <glib.h>
++#endif
++
+ #define stdinfd 0
+
+ extern "C" {
+@@ -262,6 +267,40 @@
+
+ }
+
++static int rccGetCurrentEncoding(char *result, unsigned int n) {
++ unsigned int i;
++ char *l;
++
++ if ((!result)||(!n)) return -1;
++
++ l = getenv("CHARSET");
++#ifdef HAVE_CODESET
++ if (!l) l = nl_langinfo(CODESET);
++#endif
++ if (l) {
++ if (strlen(l)>=n) return -1;
++ strcpy(result, l);
++ return 0;
++ }
++
++ l = setlocale(LC_CTYPE, NULL);
++ if (!l) return -1;
++
++ for (i=0;((l[i])&&(l[i]!='.')&&(l[i]!='_'));i++);
++ if (i>=n) return -1;
++
++ l = strrchr(l, '.');
++ if (!l) return -1;
++
++ for (i=0;((l[i])&&(l[i]!='@'));i++);
++ if (i>=n) return -1;
++
++ strncpy(result,l+1,i-1);
++ result[i]=0;
++
++ return 0;
++}
++
+ Error ncursesUI::AcceptEvent(Event *e) {
+ if (e) {
+ switch (e->Type()) {
+@@ -342,36 +381,69 @@
+ break;
+ md = pItem->GetMetaData();
+
++ char *recoded;
++ char locale[64];
++#ifdef HAVE_GLIB
++ if (rccGetCurrentEncoding(locale, 64)) strcpy(locale, "UTF-8");
++#else
++ recoded = NULL;
++#endif
++
++
+ clear();
+ move(0,0);
+ showInfo();
+ move(2, 0);
+ addstr(_("Title : "));
+- if (md.Title().c_str()[0] != '\0')
+- addstr((char *)md.Title().c_str());
+- else
++ if (md.Title().c_str()[0] != '\0') {
++#ifdef HAVE_GLIB
++ recoded = g_convert(md.Title().c_str(), -1, locale, "UTF-8", NULL, NULL, NULL);
++#endif
++ addstr(recoded?recoded:(char *)md.Title().c_str());
++ } else
+ addstr(pmvi->m_filename.c_str());
++
++#ifdef HAVE_GLIB
++ if (recoded) free(recoded);
++ recoded = g_convert(md.Artist().c_str(), -1, locale, "UTF-8", NULL, NULL, NULL);
++#endif
+ addstr(_("\nArtist : "));
+- addstr((char *)md.Artist().c_str());
++ addstr(recoded?recoded:(char *)md.Artist().c_str());
++#ifdef HAVE_GLIB
++ if (recoded) free(recoded);
++ recoded = g_convert(md.Album().c_str(), -1, locale, "UTF-8", NULL, NULL, NULL);
++#endif
+ addstr(_("\nAlbum : "));
+- addstr((char *)md.Album().c_str());
++ addstr(recoded?recoded:(char *)md.Album().c_str());
+ addstr(_("\nYear : "));
+ if (md.Year() != 0)
+ {
+ sprintf(buf, "%d", md.Year());
+ addstr(buf);
+ }
++#ifdef HAVE_GLIB
++ if (recoded) free(recoded);
++ recoded = g_convert(md.Genre().c_str(), -1, locale, "UTF-8", NULL, NULL, NULL);
++#endif
+ addstr(_("\nGenre : "));
+- addstr((char *)md.Genre().c_str());
++ addstr(recoded?recoded:(char *)md.Genre().c_str());
+ addstr(_("\nTrack : "));
+ if (md.Track() != 0)
+ {
+ sprintf(buf, "%d", md.Track());
+ addstr(buf);
+ }
++#ifdef HAVE_GLIB
++ if (recoded) free(recoded);
++ recoded = g_convert(md.Comment().c_str(), -1, locale, "UTF-8", NULL, NULL, NULL);
++#endif
+ addstr(_("\nComment: "));
+- addstr((char *)md.Comment().c_str());
++ addstr(recoded?recoded:(char *)md.Comment().c_str());
+ addstr("\n");
++
++#ifdef HAVE_GLIB
++ if (recoded) free(recoded);
++#endif
+ refresh();
+
+ counter = 0;