changeset 766:53f63f43663f trunk

[svn] - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
author giacomo
date Thu, 01 Mar 2007 18:22:51 -0800
parents 2430c9773fa7
children 96b884703411
files ChangeLog src/aosd/aosd_trigger.c
diffstat 2 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 01 06:31:20 2007 -0800
+++ b/ChangeLog	Thu Mar 01 18:22:51 2007 -0800
@@ -1,3 +1,12 @@
+2007-03-01 14:31:20 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1628]
+  - determine whether stream is seekable or not by checking duration. it is safe to use with proxy.
+  
+  trunk/src/madplug/input.c  |   14 +++++++++++---
+  trunk/src/madplug/plugin.c |    2 +-
+  2 files changed, 12 insertions(+), 4 deletions(-)
+
+
 2007-03-01 12:33:43 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1626]
   - revert r1624 due to the fact that it breaks
--- a/src/aosd/aosd_trigger.c	Thu Mar 01 06:31:20 2007 -0800
+++ b/src/aosd/aosd_trigger.c	Thu Mar 01 18:22:51 2007 -0800
@@ -164,10 +164,13 @@
       title = playlist_get_songtitle(active, pos);
     }
     gchar *utf8_title = str_to_utf8( title );
-    gchar *utf8_title_markup = g_markup_printf_escaped(
-      "<span font_desc='%s'>%s</span>" , global_config->osd->text.fonts_name[0] , utf8_title );
-    aosd_display( utf8_title_markup , global_config->osd , FALSE );
-    g_free( utf8_title_markup );
+    if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE )
+    {
+      gchar *utf8_title_markup = g_markup_printf_escaped(
+        "<span font_desc='%s'>%s</span>" , global_config->osd->text.fonts_name[0] , utf8_title );
+      aosd_display( utf8_title_markup , global_config->osd , FALSE );
+      g_free( utf8_title_markup );
+    }
     g_free( utf8_title );
     g_free( title );
   }
@@ -228,10 +231,13 @@
         {
           /* string formatting is done here a.t.m. - TODO - improve this area */
           gchar *utf8_title = str_to_utf8( pl_entry->title );
-          gchar *utf8_title_markup = g_markup_printf_escaped(
-            "<span font_desc='%s'>%s</span>" , global_config->osd->text.fonts_name[0] , utf8_title );
-          aosd_display( utf8_title_markup , global_config->osd , FALSE );
-          g_free( utf8_title_markup );
+          if ( g_utf8_validate( utf8_title , -1 , NULL ) == TRUE )
+          {
+            gchar *utf8_title_markup = g_markup_printf_escaped(
+              "<span font_desc='%s'>%s</span>" , global_config->osd->text.fonts_name[0] , utf8_title );
+            aosd_display( utf8_title_markup , global_config->osd , FALSE );
+            g_free( utf8_title_markup );
+          }
           g_free( utf8_title );
           g_free( prevs->title );
           prevs->title = g_strdup(pl_entry->title);