mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
playlist: Rewrite playlist_save(), optimization & fixes
playlist_save() was a poorly thought out mess. This fixes the glaring issues and hopefully ensures that saving the playlist never loses state (such as queued tracks or modified status) after save+resume. Indices are now updated on the fly, which is faster and needs no extra memory. But if an error occurs, the playlist will be corrupted. There is currently no attempt to handle this since errors should be unlikely, but some error handling needs to be added in the future. Change-Id: If8a5dbd6a596460be08ee0b7bab9f24337886ea4
This commit is contained in:
parent
1ee152b5a4
commit
90e35716e3
3 changed files with 291 additions and 265 deletions
|
|
@ -177,8 +177,7 @@ size_t playlist_get_required_bufsz(struct playlist_info* playlist,
|
|||
bool include_namebuf, int num_indices);
|
||||
int playlist_get_track_info(struct playlist_info* playlist, int index,
|
||||
struct playlist_track_info* info);
|
||||
int playlist_save(struct playlist_info* playlist, char *filename,
|
||||
void* temp_buffer, size_t temp_buffer_size);
|
||||
int playlist_save(struct playlist_info* playlist, char *filename);
|
||||
int playlist_directory_tracksearch(const char* dirname, bool recurse,
|
||||
int (*callback)(char*, void*),
|
||||
void* context);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue