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; int bookmark_count = 0;
char* playlist = NULL; char* playlist = NULL;
char* cp; char* cp;
char* tmp;
int len = 0; int len = 0;
bool unique = false; bool unique = false;
@ -383,27 +384,15 @@ static bool add_bookmark(char* bookmark_file_name, char* bookmark)
break; 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,'/'); bookmark_count++;
if (check_bookmark(global_read_buffer) && write(temp_bookmark_file, global_read_buffer,
strncmp(playlist,cp,len)) 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);
}
}
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(bookmark_file);