From 90e35716e312b9446515263f75e9e7cb66483c2c Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 30 Mar 2023 12:24:02 +0100 Subject: 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 --- apps/playlist.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apps/playlist.h') diff --git a/apps/playlist.h b/apps/playlist.h index 101a3c1207..0dc5148acd 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -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); -- cgit v1.2.3