[totem-pl-parser/gnome-2-28] Fix PLS parsing when some numbered entries are missing



commit b99a510f8a5c8be46a29180b616f8c1bb2143357
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jun 1 18:49:33 2010 +0100

    Fix PLS parsing when some numbered entries are missing
    
    Fix missing entries when parsing a PLS file which has "holes"
    in its numbering.

 plparse/totem-pl-parser-pls.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/plparse/totem-pl-parser-pls.c b/plparse/totem-pl-parser-pls.c
index db57617..c15da67 100644
--- a/plparse/totem-pl-parser-pls.c
+++ b/plparse/totem-pl-parser-pls.c
@@ -157,6 +157,7 @@ totem_pl_parser_add_pls_with_contents (TotemPlParser *parser,
 	char *playlist_title;
 	gboolean fallback;
 	GHashTable *entries;
+	guint found_entries;
 
 	entries = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
@@ -226,7 +227,8 @@ totem_pl_parser_add_pls_with_contents (TotemPlParser *parser,
 
 	retval = TOTEM_PL_PARSER_RESULT_SUCCESS;
 
-	for (i = 1; i <= num_entries; i++) {
+	found_entries = 0;
+	for (i = 1; found_entries < num_entries; i++) {
 		char *file_str, *title, *genre, *length;
 		char *file_key, *title_key, *genre_key, *length_key;
 		gint64 length_num;
@@ -250,6 +252,7 @@ totem_pl_parser_add_pls_with_contents (TotemPlParser *parser,
 
 		if (file_str == NULL)
 			continue;
+		found_entries++;
 
 		fallback = parse_data->fallback;
 		if (parse_data->recurse)



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