From 0e90bc3f09969b6887f83ef5b6c2e1916672b2f3 Mon Sep 17 00:00:00 2001 From: Henrik Backe Date: Sun, 21 Mar 2004 13:42:18 +0000 Subject: [PATCH] To many bookmarks could be delete when unique only was set git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4422 a1c6a512-1295-4272-9138-f99709370657 --- apps/bookmark.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index b4a2cd566a..e62448c64a 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -343,6 +343,7 @@ static bool add_bookmark(char* bookmark_file_name, char* bookmark) int bookmark_count = 0; char* playlist = NULL; char* cp; + char* tmp; int len = 0; bool unique = false; @@ -383,27 +384,15 @@ static bool add_bookmark(char* bookmark_file_name, char* bookmark) break; } - if (unique) + cp = strchr(global_read_buffer,'/'); + tmp = strrchr(global_read_buffer,';'); + if (check_bookmark(global_read_buffer) && + (!unique || len != tmp -cp || strncmp(playlist,cp,len))) { - cp=strchr(global_read_buffer,'/'); - if (check_bookmark(global_read_buffer) && - strncmp(playlist,cp,len)) - { - bookmark_count++; - write(temp_bookmark_file, global_read_buffer, - strlen(global_read_buffer)); - write(temp_bookmark_file, "\n", 1); - } - } - else - { - if (check_bookmark(global_read_buffer)) - { - bookmark_count++; - write(temp_bookmark_file, global_read_buffer, - strlen(global_read_buffer)); - write(temp_bookmark_file, "\n", 1); - } + bookmark_count++; + write(temp_bookmark_file, global_read_buffer, + strlen(global_read_buffer)); + write(temp_bookmark_file, "\n", 1); } } close(bookmark_file);