Revision: 2280
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2280&view=rev
Author: teuf
Date: 2009-03-21 13:21:35 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
Patch from: Jorg Schuller
* src/itdb_itunesdb.c: simplify pos_comp, make get_playlist more
efficient
Modified Paths:
--------------
libgpod/trunk/ChangeLog
libgpod/trunk/src/itdb_itunesdb.c
Modified: libgpod/trunk/ChangeLog
===================================================================
--- libgpod/trunk/ChangeLog 2009-03-21 13:21:20 UTC (rev 2279)
+++ libgpod/trunk/ChangeLog 2009-03-21 13:21:35 UTC (rev 2280)
@@ -1,5 +1,12 @@
2009-03-21 Christophe Fergeau <[email protected]>
+ Patch from: Jorg Schuller
+
+ * src/itdb_itunesdb.c: simplify pos_comp, make get_playlist more
+ efficient
+
+2009-03-21 Christophe Fergeau <[email protected]>
+
* src/itdb_itunesdb.c: remove commented out code
(g_return_val_if_fail)
Modified: libgpod/trunk/src/itdb_itunesdb.c
===================================================================
--- libgpod/trunk/src/itdb_itunesdb.c 2009-03-21 13:21:20 UTC (rev 2279)
+++ libgpod/trunk/src/itdb_itunesdb.c 2009-03-21 13:21:35 UTC (rev 2280)
@@ -1853,17 +1853,13 @@
}
+/* sort in reverse order */
static gint pos_comp (gconstpointer a, gconstpointer b)
{
const PosEntry *pa = (const PosEntry*)a;
const PosEntry *pb = (const PosEntry*)b;
- if (pa->track_pos < pb->track_pos)
- return -1;
- else if (pa->track_pos > pb->track_pos)
- return 1;
- else
- return 0;
+ return pb->track_pos - pa->track_pos;
}
@@ -1978,7 +1974,6 @@
Itdb_Playlist *plitem = NULL;
FContents *cts;
GList *gl;
- gint32 pos_len = 0;
#if ITUNESDB_DEBUG
fprintf(stderr, "mhyp seek: %x\n", (int)mhyp_seek);
@@ -2167,6 +2162,7 @@
}
}
+ /* sort in reverse order */
fimp->pos_glist = g_list_sort (fimp->pos_glist, pos_comp);
for (gl = fimp->pos_glist; gl; gl = g_list_next (gl))
{
@@ -2174,8 +2170,8 @@
Itdb_Track *tr = itdb_track_id_tree_by_id (fimp->idtree, entry->trackid);
if (tr)
{
- itdb_playlist_add_track (plitem, tr, pos_len);
- ++pos_len;
+ /* preprend because we sorted in reverse order */
+ itdb_playlist_add_track (plitem, tr, 0);
}
else
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2