diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-09-11 22:36:42 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2024-09-12 19:16:02 -0400 |
commit | 79bed1f422a79a18e40443b9ada647aeb1c0cc61 (patch) | |
tree | f9fe9e18e54c379bc67ded5e9569d43e799c580f /apps/gui/skin_engine | |
parent | 2a0f3c8276c397b384ffa8b57fa62f38f3cea6a9 (diff) | |
download | rockbox-79bed1f422a79a18e40443b9ada647aeb1c0cc61.tar.gz rockbox-79bed1f422a79a18e40443b9ada647aeb1c0cc61.zip |
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
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 19 |
1 files changed, 13 insertions, 6 deletions
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) | |||
556 | pid3 = state->nid3; | 556 | pid3 = state->nid3; |
557 | else | 557 | else |
558 | { | 558 | { |
559 | static char filename_buf[MAX_PATH + 1]; | 559 | static struct mp3entry tempid3; /* Note: path gets passed to outside fns */ |
560 | fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); | 560 | memset(&tempid3, 0, sizeof(struct mp3entry)); |
561 | /*static char filename_buf[MAX_PATH + 1];removed g#5926 */ | ||
562 | fname = playlist_peek(offset, tempid3.path, sizeof(tempid3.path)); | ||
561 | *filename = (char*)fname; | 563 | *filename = (char*)fname; |
562 | static struct mp3entry tempid3; | 564 | |
563 | if ( | 565 | if ( |
564 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | 566 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
565 | tagcache_fill_tags(&tempid3, fname) || | 567 | tagcache_fill_tags(&tempid3, NULL) || |
566 | #endif | 568 | #endif |
567 | audio_peek_track(&tempid3, offset) | 569 | audio_peek_track(&tempid3, offset) |
568 | ) | 570 | ) |
569 | { | 571 | { |
570 | pid3 = &tempid3; | 572 | pid3 = &tempid3; |
571 | } | 573 | } |
574 | else /* failed */ | ||
575 | { | ||
576 | /* ensure *filename gets the path, audio_peek_track() cleared it */ | ||
577 | fname = playlist_peek(offset, tempid3.path, sizeof(tempid3.path)); | ||
578 | *filename = (char*)fname; | ||
579 | } | ||
572 | } | 580 | } |
581 | |||
573 | return pid3; | 582 | return pid3; |
574 | } | 583 | } |
575 | 584 | ||
@@ -710,8 +719,6 @@ const char *get_token_value(struct gui_wps *gwps, | |||
710 | return NULL; | 719 | return NULL; |
711 | 720 | ||
712 | id3 = get_mp3entry_from_offset(token->next? 1: offset, &filename); | 721 | id3 = get_mp3entry_from_offset(token->next? 1: offset, &filename); |
713 | if (id3) | ||
714 | filename = id3->path; | ||
715 | 722 | ||
716 | #if CONFIG_RTC | 723 | #if CONFIG_RTC |
717 | struct tm* tm = NULL; | 724 | struct tm* tm = NULL; |