changeset 2455:50ae65a59351

patch by chrome
author mf0102 <0102@gmx.at>
date Mon, 17 Mar 2008 21:38:04 +0100
parents 2c8bb51ba9cd
children e67bce91d70c
files src/xspf/xspf.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/xspf/xspf.c	Fri Mar 14 15:13:40 2008 +0200
+++ b/src/xspf/xspf.c	Mon Mar 17 21:38:04 2008 +0100
@@ -367,7 +367,7 @@
     if (playlist->attribute & PLAYLIST_USE_RELATIVE) {
         /* prescan to determine base uri */
         for (node = playlist->entries; node != NULL; node = g_list_next(node)) {
-            gchar *ptr1, *ptr2;
+            gchar *ptr1, *ptr2, *ptrslash;
             PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
             gchar *tmp;
             gint tmplen = 0;
@@ -385,15 +385,18 @@
             }
             
             ptr1 = base;
-            ptr2 = tmp;
+            ptrslash = ptr2 = tmp;
 
             while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) {
+                if (*ptr2 == '/') ptrslash = ptr2 + 1;
+
                 ptr1++;
                 ptr2++;
             }
             
-            *ptr2 = '\0';       //terminate
-            tmplen = ptr2 - tmp;
+            if (!(*ptrslash)) ptrslash--;
+            *ptrslash = '\0';       //terminate
+            tmplen = ptrslash - tmp;
 
             if (tmplen <= baselen) {
                 g_free(base);