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
This commit is contained in:
Aidan MacDonald 2022-05-02 16:10:15 +01:00
parent 6b8c94a6e3
commit e5e457b526

View file

@ -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);