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
This commit is contained in:
Henrik Backe 2004-03-21 13:42:18 +00:00
parent 48ac52c7d1
commit 0e90bc3f09

View file

@ -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,11 +384,10 @@ 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) &&
strncmp(playlist,cp,len))
(!unique || len != tmp -cp || strncmp(playlist,cp,len)))
{
bookmark_count++;
write(temp_bookmark_file, global_read_buffer,
@ -395,17 +395,6 @@ static bool add_bookmark(char* bookmark_file_name, char* bookmark)
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);
}
}
}
close(bookmark_file);
}
close(temp_bookmark_file);