changeset 645:e0d131145768 trunk

[svn] - revise input_id3_get_string(). - make audmad_get_file_info() use mad_parse_genre() to obtain genre description.
author yaz
date Tue, 13 Feb 2007 22:10:05 -0800
parents 94ab06db73fa
children ede814584df9
files ChangeLog src/madplug/Makefile src/madplug/fileinfo.c src/madplug/input.c
diffstat 4 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 13 21:50:01 2007 -0800
+++ b/ChangeLog	Tue Feb 13 22:10:05 2007 -0800
@@ -1,3 +1,12 @@
+2007-02-14 05:50:01 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1374]
+  temporary fix for SIGSEGV in g_utf8_validate() when xmlURIEscape returns NULL.
+  thank nhjm449 for reporting.
+  
+  trunk/src/xspf/xspf.c |    4 +++-
+  1 file changed, 3 insertions(+), 1 deletion(-)
+
+
 2007-02-13 13:55:00 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1372]
   - switch from pseudo delete tag call back to genuine one.
--- a/src/madplug/Makefile	Tue Feb 13 21:50:01 2007 -0800
+++ b/src/madplug/Makefile	Tue Feb 13 22:10:05 2007 -0800
@@ -17,7 +17,7 @@
 
 OBJECTS = ${SOURCES:.c=.o}
 
-CFLAGS   += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(ARCH_DEFINES) $(MAD_CFLAGS) -I../../intl -I../..
+CFLAGS   += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(ARCH_DEFINES) $(MAD_CFLAGS) -I../../intl -I../.. -Wall
 
 LDFLAGS += -Wl,-rpath=$(plugindir)
 
--- a/src/madplug/fileinfo.c	Tue Feb 13 21:50:01 2007 -0800
+++ b/src/madplug/fileinfo.c	Tue Feb 13 22:10:05 2007 -0800
@@ -48,6 +48,7 @@
 static GList *genre_list = 0;
 static struct mad_info_t info;
 struct id3_frame *id3_frame_new(const char *str);
+id3_ucs4_t *mad_parse_genre(const id3_ucs4_t *string);
 
 #ifndef NOGUI
 static void
@@ -670,17 +671,20 @@
     /* work out the index of the genre in the list */
     {
         const id3_ucs4_t *string;
+        id3_ucs4_t *genre;
         struct id3_frame *frame;
         union id3_field *field;
         frame = id3_tag_findframe(info.tag, ID3_FRAME_GENRE, 0);
         if (frame) {
             field = id3_frame_field(frame, 1);
             string = id3_field_getstrings(field, 0);
-            string = id3_genre_name(string);
-            if (string)
+            genre = mad_parse_genre(string);
+            if (genre) {
                 gtk_list_select_item(GTK_LIST
                                      (GTK_COMBO(genre_combo)->list),
-                                     id3_genre_number(string));
+                                     id3_genre_number(genre));
+                g_free((void *)genre);
+            }
         }
     }
 
--- a/src/madplug/input.c	Tue Feb 13 21:50:01 2007 -0800
+++ b/src/madplug/input.c	Tue Feb 13 22:10:05 2007 -0800
@@ -123,7 +123,7 @@
     info->remote = info->size == 0 ? TRUE : FALSE;
 
 #ifdef DEBUG
-    g_message("i: info->size == %lu", info->size);
+    g_message("i: info->size == %lu", (long unsigned int)info->size);
     g_message("e: input_init");
 #endif
     return TRUE;
@@ -290,27 +290,25 @@
     if (!string_const)
         return NULL;
 
-    string = mad_ucs4dup((id3_ucs4_t *)string_const);
-
     if (!strcmp(frame_name, ID3_FRAME_GENRE)) {
-        id3_ucs4_t *string2 = NULL;
-        string2 = mad_parse_genre(string);
-        g_free((void *)string);
-        string = string2;
+        string = mad_parse_genre(string_const);
+    }
+    else {
+        string = mad_ucs4dup((id3_ucs4_t *)string_const);
     }
 
     switch (encoding) {
     case ID3_FIELD_TEXTENCODING_ISO_8859_1:
-        rtn0 = id3_ucs4_latin1duplicate(string);
+        rtn0 = (gchar *)id3_ucs4_latin1duplicate(string);
+        rtn = str_to_utf8(rtn0);
+        g_free(rtn0);
         break;
     case ID3_FIELD_TEXTENCODING_UTF_8:
     default:
-        rtn0 = id3_ucs4_utf8duplicate(string);
+        rtn = (gchar *)id3_ucs4_utf8duplicate(string);
         break;
     }
-
-    rtn = str_to_utf8(rtn0);
-    g_free(rtn0);
+    g_free((void *)string);
         
 #ifdef DEBUG
     g_print("i: string = %s\n", rtn);