misc: Address issues uncovered with GCC 16 + binutils 2.46 (1/N)

* Funky macro-based definitions for memchr and strstr
   which require an #undef before we use our own in codecs & plugins
 * Return value of of strstr is const

Still have several more warnings and link failure with some plugins
but this is a good start.

Change-Id: Ife1f2d3e6f0e0629e3125a9058abc39c6102f452
This commit is contained in:
Solomon Peachy 2026-05-01 22:42:58 -04:00
parent 8e8206f6d5
commit f886bfc572
8 changed files with 19 additions and 11 deletions

View file

@ -46,7 +46,8 @@ static bool search_for_cuesheet(const char *path, struct cuesheet_file *cue_file
{
size_t len;
char cuepath[MAX_PATH];
char *dot, *slash, *slash_cuepath;
char *dot, *slash_cuepath;
const char *slash;
cue_file->pos = 0;
cue_file->size = 0;

View file

@ -525,7 +525,7 @@ static void read_config_init(int fd)
static int file_find_extension(const char* file)
{
char *extension = strrchr(file, '.');
const char *extension = strrchr(file, '.');
if (extension)
extension++;
return find_extension(extension);
@ -704,7 +704,7 @@ int filetype_load_plugin(const char* plugin, const char* file)
{
int i;
char plugin_name[MAX_PATH];
char *s;
const char *s;
for (i=1;i<filetype_count;i++)
{

View file

@ -2676,7 +2676,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
if (isfile)
{
/* get the bitmap dir */
char *dot = strrchr(buf, '.');
const char *dot = strrchr(buf, '.');
strmemccpy(bmpdir, buf, dot - buf + 1);
}
else

View file

@ -315,7 +315,7 @@ static void pl_close_control(struct playlist_info *playlist)
/* Check if the filename suggests M3U or M3U8 format. */
static bool is_m3u8_name(const char* filename)
{
char *dot = strrchr(filename, '.');
const char *dot = strrchr(filename, '.');
/* Default to M3U8 unless explicitly told otherwise. */
return (!dot || strcasecmp(dot, ".m3u") != 0);

View file

@ -497,7 +497,7 @@ static void format_name(char* dest, const char* src, size_t bufsz)
default:
{
/* Only display the filename */
char* p = strrchr(src, '/');
const char* p = strrchr(src, '/');
strlcpy(dest, p+1, bufsz);
/* Remove the extension */
strrsplt(dest, '.');

View file

@ -45,6 +45,8 @@
#undef strcmp
#undef strncmp
#undef strchr
#undef strstr
#undef strrchr
#undef strtok_r
#ifdef __APPLE__
#undef strncpy

View file

@ -51,6 +51,10 @@ int splash_scroller(int timeout, const char* str);
#define floor lfloor
#define pow lpow
/* Just in case */
#undef memchr
#undef strstr
/* Simple substitutions */
#define malloc tlsf_malloc
#define realloc tlsf_realloc

View file

@ -136,6 +136,7 @@ int memcmp(const void *s1, const void *s2, size_t n)
return(ci->memcmp(s1,s2,n));
}
#undef memchr
void* memchr(const void *s, int c, size_t n)
{
return(ci->memchr(s,c,n));