changeset 1594:44f67f556b60 trunk

[svn] - precision in title format is regarded as character count, not byte count.
author yaz
date Thu, 24 Aug 2006 23:08:22 -0700
parents 6647d5cc717c
children e6cc84e06444
files ChangeLog libaudacious/titlestring.c
diffstat 2 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 24 14:55:06 2006 -0700
+++ b/ChangeLog	Thu Aug 24 23:08:22 2006 -0700
@@ -1,3 +1,18 @@
+2006-08-24 21:55:06 +0000  Tony Vroon <chainsaw@gentoo.org>
+  revision [2109]
+  Additional (PPC?) warning squashing by Joseph Jezak from Gentoo.
+
+  Changes:        Modified:
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnactuator.c  
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnactuatorfactory.c  
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnbooleanoption.c  
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnfloatoption.c  
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnintegeroption.c  
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnlistoption.c  
+  +10 -3          trunk/Plugins/Visualization/paranormal/pn/pnscript.c  
+  +1 -1           trunk/Plugins/Visualization/paranormal/pn/pnstringoption.c  
+
+
 2006-08-24 19:23:54 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [2107]
   Actually cast variables to glib types before feeding them into glib compare functions. Resolves another 16 signedness warnings on PPC.
--- a/libaudacious/titlestring.c	Thu Aug 24 14:55:06 2006 -0700
+++ b/libaudacious/titlestring.c	Thu Aug 24 23:08:22 2006 -0700
@@ -261,8 +261,17 @@
 
             /* Insert string. */
             if (precision >= 0) {
-                while (precision-- > 0 && (c = *string++) != '\0')
-                    PUTCH(c);
+                glong offset_max = precision, offset;
+                gchar *uptr = NULL;
+                const gchar *tmpstring = string;
+                while (precision > 0) {
+                    offset = offset_max - precision;
+                    uptr = g_utf8_offset_to_pointer(tmpstring, offset);
+                    if (*uptr == '\0')
+                        break;
+                    g_string_append_unichar(outstr, g_utf8_get_char(uptr));
+                    precision--;
+                }
             }
             else {
                 while ((c = *string++) != '\0')