changeset 35487:58a221f73d75

Enhance PLAYLIST_ITEM_GET_POS to provide total number of items.
author ib
date Mon, 03 Dec 2012 14:43:42 +0000
parents 7b090d0f253b
children 9ef9131adfe5
files gui/util/list.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/list.c	Mon Dec 03 14:40:20 2012 +0000
+++ b/gui/util/list.c	Mon Dec 03 14:43:42 2012 +0000
@@ -45,7 +45,8 @@
  *         pointer to current list item (ITEM command) or
  *         NULL (DELETE or unknown command)
  *
- * @note PLAYLIST_ITEM_GET_POS returns the position number as pointer,
+ * @note PLAYLIST_ITEM_GET_POS returns the position number as pointer
+ *       (if @a data is NULL the last position number, i.e. number of items),
  *       and position 0 means "not found"
  */
 void *listMgr(int cmd, void *data)
@@ -138,6 +139,9 @@
 
                 item = item->next;
             } while (item);
+
+            if (!pdat)
+                pos = i;
         }
 
         return (void *)pos;