summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-09-11 22:36:42 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2024-09-12 19:16:02 -0400
commit79bed1f422a79a18e40443b9ada647aeb1c0cc61 (patch)
treef9fe9e18e54c379bc67ded5e9569d43e799c580f /apps
parent2a0f3c8276c397b384ffa8b57fa62f38f3cea6a9 (diff)
downloadrockbox-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')
-rw-r--r--apps/gui/skin_engine/skin_tokens.c19
-rw-r--r--apps/tagcache.c9
2 files changed, 20 insertions, 8 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;
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)
2085 return false; 2085 return false;
2086 2086
2087 /* Find the corresponding entry in tagcache. */ 2087 /* Find the corresponding entry in tagcache. */
2088
2089 if (filename != NULL)
2090 memset(id3, 0, sizeof(struct mp3entry));
2091 else /* Note: caller clears id3 prior to call */
2092 filename = id3->path;
2093
2088 idx_id = find_entry_ram(filename); 2094 idx_id = find_entry_ram(filename);
2089 if (idx_id < 0) 2095 if (idx_id < 0)
2090 return false; 2096 return false;
2091 2097
2092 entry = &tcramcache.hdr->indices[idx_id]; 2098 entry = &tcramcache.hdr->indices[idx_id];
2093 2099
2094 memset(id3, 0, sizeof(struct mp3entry));
2095 char* buf = id3->id3v2buf; 2100 char* buf = id3->id3v2buf;
2096 ssize_t remaining = sizeof(id3->id3v2buf); 2101 ssize_t remaining = sizeof(id3->id3v2buf);
2097 2102