mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
RFC skin_tokens remove a static buffer
it was hard to hit this branch, I had to comment out: ln 555 else if (offset == 1) ln 556 pid3 = state->nid3; as far as I can tell the reason for the separate filename buffer was due to the failure mode of audio_peek_track() wiping the id3->path, stands to reason for me that we can just fill it again -Already found a gotcha playlist_peek() mutates the buffer makes me like this solution less, might rework tagcache_fill_tags() instead --Fixed Change-Id: I4a2ee71a8e2d0739c9e141948b71c2ed36296e3b
This commit is contained in:
parent
2a0f3c8276
commit
79bed1f422
2 changed files with 20 additions and 8 deletions
|
@ -556,20 +556,29 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename)
|
||||||
pid3 = state->nid3;
|
pid3 = state->nid3;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static char filename_buf[MAX_PATH + 1];
|
static struct mp3entry tempid3; /* Note: path gets passed to outside fns */
|
||||||
fname = playlist_peek(offset, filename_buf, sizeof(filename_buf));
|
memset(&tempid3, 0, sizeof(struct mp3entry));
|
||||||
|
/*static char filename_buf[MAX_PATH + 1];removed g#5926 */
|
||||||
|
fname = playlist_peek(offset, tempid3.path, sizeof(tempid3.path));
|
||||||
*filename = (char*)fname;
|
*filename = (char*)fname;
|
||||||
static struct mp3entry tempid3;
|
|
||||||
if (
|
if (
|
||||||
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
||||||
tagcache_fill_tags(&tempid3, fname) ||
|
tagcache_fill_tags(&tempid3, NULL) ||
|
||||||
#endif
|
#endif
|
||||||
audio_peek_track(&tempid3, offset)
|
audio_peek_track(&tempid3, offset)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pid3 = &tempid3;
|
pid3 = &tempid3;
|
||||||
}
|
}
|
||||||
|
else /* failed */
|
||||||
|
{
|
||||||
|
/* ensure *filename gets the path, audio_peek_track() cleared it */
|
||||||
|
fname = playlist_peek(offset, tempid3.path, sizeof(tempid3.path));
|
||||||
|
*filename = (char*)fname;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid3;
|
return pid3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,8 +719,6 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
id3 = get_mp3entry_from_offset(token->next? 1: offset, &filename);
|
id3 = get_mp3entry_from_offset(token->next? 1: offset, &filename);
|
||||||
if (id3)
|
|
||||||
filename = id3->path;
|
|
||||||
|
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
struct tm* tm = NULL;
|
struct tm* tm = NULL;
|
||||||
|
|
|
@ -2085,13 +2085,18 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Find the corresponding entry in tagcache. */
|
/* Find the corresponding entry in tagcache. */
|
||||||
|
|
||||||
|
if (filename != NULL)
|
||||||
|
memset(id3, 0, sizeof(struct mp3entry));
|
||||||
|
else /* Note: caller clears id3 prior to call */
|
||||||
|
filename = id3->path;
|
||||||
|
|
||||||
idx_id = find_entry_ram(filename);
|
idx_id = find_entry_ram(filename);
|
||||||
if (idx_id < 0)
|
if (idx_id < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
entry = &tcramcache.hdr->indices[idx_id];
|
entry = &tcramcache.hdr->indices[idx_id];
|
||||||
|
|
||||||
memset(id3, 0, sizeof(struct mp3entry));
|
|
||||||
char* buf = id3->id3v2buf;
|
char* buf = id3->id3v2buf;
|
||||||
ssize_t remaining = sizeof(id3->id3v2buf);
|
ssize_t remaining = sizeof(id3->id3v2buf);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue