From 79bed1f422a79a18e40443b9ada647aeb1c0cc61 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 11 Sep 2024 22:36:42 -0400 Subject: 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 --- apps/gui/skin_engine/skin_tokens.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'apps/gui/skin_engine') 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; -- cgit v1.2.3