changeset 3783:9ae0a88420e5

Automated merge with ssh://hg.atheme.org//hg/audacious
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 18 Oct 2007 17:07:09 +0300
parents a3fc112b10f1 (diff) e0da46ca4c0b (current diff)
children 2c92b8947057
files
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Thu Oct 18 14:51:10 2007 +0200
+++ b/src/audacious/playlist.c	Thu Oct 18 17:07:09 2007 +0300
@@ -679,15 +679,18 @@
         nsubtunes = tuple->nsubtunes;
         if (nsubtunes > 0)
             parent_tuple = tuple;
-    } else
+        subtune = 1;
+    } else {
         nsubtunes = 0;
-
-    for (subtune = 0; add_flag && subtune < nsubtunes; subtune++) {
+        subtune = 0;
+    }
+
+    for (; add_flag && subtune <= nsubtunes; subtune++) {
         gchar *filename_entry;
         
         if (nsubtunes > 0) {
             filename_entry = g_strdup_printf("%s?%d", filename,
-                parent_tuple->subtunes ? parent_tuple->subtunes[subtune] : subtune + 1);
+                parent_tuple->subtunes ? parent_tuple->subtunes[subtune - 1] : subtune);
             
             /* We're dealing with subtune, let's ask again tuple information
              * to plugin, by passing the ?subtune suffix; this way we get
@@ -708,7 +711,7 @@
 
         PLAYLIST_LOCK(playlist);
 
-        if (pos == -1 && subtune < 1 && nsubtunes < 1) { // the common case
+        if (pos == -1) { // the common case
             GList *element;
             element = g_list_alloc();
             element->data = entry;
@@ -725,12 +728,9 @@
                 } else
                     add_flag = FALSE;
             }
-        } else {
-            playlist->entries = g_list_insert(playlist->entries, entry, pos);
-        }
-
-        PLAYLIST_UNLOCK(playlist);
-
+        } else
+            playlist->entries = g_list_insert(playlist->entries, entry, pos++);
+        
         if (tuple != NULL) {
             const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL);
             entry->title = tuple_formatter_make_title_string(tuple,
@@ -738,7 +738,10 @@
             entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL);
             entry->tuple = tuple;
         }
+        
+        PLAYLIST_UNLOCK(playlist);
     }
+
     
     if (parent_tuple)
         tuple_free(parent_tuple);