1
0
Fork 0
forked from len0rd/rockbox

audio_peek_track should copy the struct mp3entry instead of pointing directly into the buffer. Despite the dire warning, caller does in fact yield/sleep and its usage is too nonlocalized to control that reliably.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29275 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-02-10 10:26:07 +00:00
parent 6f9d2ad130
commit edfff8a5ef
3 changed files with 16 additions and 13 deletions

View file

@ -628,8 +628,8 @@ struct mp3entry* audio_next_track(void)
return NULL;
}
/* gets a pointer to the id3 data, Not thread safe!, DON'T yield()/sleep() */
bool audio_peek_track(struct mp3entry** id3, int offset)
/* gets a copy of the id3 data */
bool audio_peek_track(struct mp3entry* id3, int offset)
{
int next_idx;
int new_offset = ci.new_track + wps_offset + offset;
@ -640,8 +640,13 @@ bool audio_peek_track(struct mp3entry** id3, int offset)
if (tracks[next_idx].id3_hid >= 0)
{
return bufgetdata(tracks[next_idx].id3_hid, 0, (void**)id3)
== sizeof(struct mp3entry);
struct mp3entry *id3src;
if (bufgetdata(tracks[next_idx].id3_hid, 0, (void**)&id3src)
== sizeof(struct mp3entry))
{
copy_mp3entry(id3, id3src);
return true;
}
}
return false;
}