summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-05-02 16:10:15 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-05-02 16:10:15 +0100
commite5e457b526f9fd18ae6c36c4afa12e3afd7f80ef (patch)
tree146cc059434e2feed90c6adb4b903d74cc472557
parent6b8c94a6e3094ab75fcfe319fa2bc100f4e329ec (diff)
downloadrockbox-e5e457b526f9fd18ae6c36c4afa12e3afd7f80ef.tar.gz
rockbox-e5e457b526f9fd18ae6c36c4afa12e3afd7f80ef.zip
apps: fix int/long mismatch in playlist.c
A couple of places use sizeof(int) for allocations and copying but the indices are longs, which causes bugs in the simulator on 64-bit. Change-Id: Ie101ac57d44217c4b1657cf0152c97e276bd7043
-rw-r--r--apps/playlist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 32b8383442..b1d5d5a4be 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2040,7 +2040,7 @@ void playlist_init(void)
playlist->control_fd = -1;
playlist->max_playlist_size = global_settings.max_files_in_playlist;
handle = core_alloc_ex("playlist idx",
- playlist->max_playlist_size * sizeof(int), &ops);
+ playlist->max_playlist_size * sizeof(*playlist->indices), &ops);
playlist->indices = core_get_data(handle);
playlist->buffer_size =
AVERAGE_FILENAME_LENGTH * global_settings.max_files_in_dir;
@@ -2981,7 +2981,7 @@ int playlist_set_current(struct playlist_info* playlist)
if (playlist->indices && playlist->indices != current_playlist.indices)
{
memcpy((void*)current_playlist.indices, (void*)playlist->indices,
- playlist->max_playlist_size*sizeof(int));
+ playlist->max_playlist_size*sizeof(*playlist->indices));
#ifdef HAVE_DIRCACHE
copy_filerefs(current_playlist.dcfrefs, playlist->dcfrefs,
playlist->max_playlist_size);