From 8768266d27616ec58278c980558dffcba2a1ef18 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 2 May 2026 23:01:00 -0400 Subject: [PATCH] Simpler const fix for fill_metadata_from_path() Make sure the output of strchr(const*) is assinged to a const* This way the filename argument can stay const Change-Id: Ie46be936491eb62ba2a7e729b8cd7881e205bba7 --- lib/rbcodec/metadata/metadata.c | 8 ++++---- lib/skin_parser/skin_debug.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index fafd227c14..00c6bfd581 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c @@ -381,7 +381,7 @@ bool format_buffers_with_offset(int afmt) /* Simple file type probing by looking at the filename extension. */ unsigned int probe_file_format(const char *filename) { - char *suffix; + const char *suffix; unsigned int i; suffix = strrchr(filename, '.'); @@ -418,7 +418,7 @@ unsigned int probe_file_format(const char *filename) * file that would prevent playback. supply a filedescriptor <0 and the file will be opened * and closed automatically within the get_metadata call * get_metadata_ex allows flags to change the way get_metadata behaves - * METADATA_EXCLUDE_ID3_PATH won't copy filename path to the id3 path buffer + * METADATA_EXCLUDE_ID3_PATH won't copy filename path to the id3 path buffer * METADATA_CLOSE_FD_ON_EXIT closes the open filedescriptor on exit */ bool get_metadata_ex(struct mp3entry* id3, int fd, const char* trackname, int flags) @@ -554,8 +554,8 @@ void fill_metadata_from_path(struct mp3entry *id3, const char *trackname) wipe_mp3entry(id3); /* Find the filename portion of the path */ - p = strrchr(trackname, '/'); - strlcpy(id3->id3v2buf, p ? ++p : id3->path, ID3V2_BUF_SIZE); + const char *pt = strrchr(trackname, '/'); + strlcpy(id3->id3v2buf, pt ? ++pt : id3->path, ID3V2_BUF_SIZE); /* Get the format from the extension and trim it off */ p = strrchr(id3->id3v2buf, '.'); diff --git a/lib/skin_parser/skin_debug.c b/lib/skin_parser/skin_debug.c index b9e57d9573..44fba90445 100644 --- a/lib/skin_parser/skin_debug.c +++ b/lib/skin_parser/skin_debug.c @@ -317,7 +317,7 @@ void skin_error_format_message(void) char text[128]; if (!error_line_start) return; - char* line_end = strchr(error_line_start, '\n'); + const char* line_end = strchr(error_line_start, '\n'); int len = MIN(line_end - error_line_start, 80); if (!line_end) len = strlen(error_line_start);