diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 082619432f..4bd1ffea31 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -556,20 +556,29 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) pid3 = state->nid3; else { - static char filename_buf[MAX_PATH + 1]; - fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); + static struct mp3entry tempid3; /* Note: path gets passed to outside fns */ + 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; - static struct mp3entry tempid3; + if ( #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) - tagcache_fill_tags(&tempid3, fname) || + tagcache_fill_tags(&tempid3, NULL) || #endif audio_peek_track(&tempid3, offset) ) { 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; } @@ -710,8 +719,6 @@ const char *get_token_value(struct gui_wps *gwps, return NULL; id3 = get_mp3entry_from_offset(token->next? 1: offset, &filename); - if (id3) - filename = id3->path; #if CONFIG_RTC struct tm* tm = NULL; diff --git a/apps/tagcache.c b/apps/tagcache.c index 1412647368..5bfeb82481 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -2085,13 +2085,18 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename) return false; /* 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); if (idx_id < 0) return false; entry = &tcramcache.hdr->indices[idx_id]; - - memset(id3, 0, sizeof(struct mp3entry)); + char* buf = id3->id3v2buf; ssize_t remaining = sizeof(id3->id3v2buf);