[easytag/easytag-2-2] Fix incorrect track duration in CDDB results



commit e3047946426a561c6cf6afef5dcc8de3e06a4e75
Author: David King <amigadave amigadave com>
Date:   Mon Nov 3 18:43:38 2014 +0000

    Fix incorrect track duration in CDDB results

 src/cddb.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/cddb.c b/src/cddb.c
index 0854255..2736121 100644
--- a/src/cddb.c
+++ b/src/cddb.c
@@ -3790,16 +3790,12 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
                 g_free(cddbtrackalbum);
             }else
             {
-                GList *l;
-
-                for (l = TrackOffsetList; l != NULL; l = g_list_next (l))
+                if (TrackOffsetList && TrackOffsetList->next)
                 {
-                    if (l->next)
-                    {
-                        cddbtrackalbum->duration = (((CddbTrackFrameOffset *)l->next->data)->offset
-                                                     - ((CddbTrackFrameOffset *)l->data)->offset)
-                                                    / 75; /* Calculate time in seconds. */
-                    }
+                    cddbtrackalbum->duration = (((CddbTrackFrameOffset *)TrackOffsetList->next->data)->offset
+                                                 - ((CddbTrackFrameOffset *)TrackOffsetList->data)->offset)
+                                                / 75; /* Calculate time in seconds. */
+                    TrackOffsetList = g_list_next (TrackOffsetList);
                 }
                 cddbalbum->track_list = g_list_append(cddbalbum->track_list,cddbtrackalbum);
             }
@@ -3849,7 +3845,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
 
     Cddb_Show_Album_Info(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView)),NULL);
 
-    g_list_free_full (TrackOffsetList, (GDestroyNotify)g_free);
+    g_list_free_full (g_list_first (TrackOffsetList), (GDestroyNotify)g_free);
     return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]