On Wed, Feb 25, 2026 at 01:40:36PM +0800, Kevin J. McCarthy wrote: > On Tue, Feb 24, 2026 at 03:15:00PM +0100, Rene Kita wrote: > > I silenced all warnings on Arch by casting just to get a list of places > > where the error did occur. So the following is not meant as a solution, > > but as a list of other places we might have the same problem: > > The browser.c fix was more serious, so I fixed it in stable and merged > into master already. > > For the other warnings, I've cleaned them up as follows. (Will clean up > commit message and commit later tonight, so please comment if you have > feedback). > > I prefer not to add the casts, so instead I've disentangled shared usage and > retyped the pointers to const char * where possible.
Agreed. Overall the patch looks good to me, unfortunately git am reports a corrupt patch so I did not compile it (patch itself also complaint). Two nits below. > From 2e4bd26cbc1938ba31870e7af489d771e9f29070 Mon Sep 17 00:00:00 2001 > From: "Kevin J. McCarthy" <[email protected]> > Date: Wed, 25 Feb 2026 13:36:04 +0800 > Subject: [PATCH] wip. > > --- > mh.c | 6 ++++-- > muttlib.c | 3 ++- > parse.c | 4 ++-- > rfc1524.c | 7 ++++--- > sendlib.c | 3 ++- > url.c | 10 ++++++---- > 6 files changed, 20 insertions(+), 13 deletions(-) > > diff --git a/mh.c b/mh.c > index 4c4c9695..40115db2 100644 > --- a/mh.c > +++ b/mh.c > @@ -684,7 +684,8 @@ static void maildir_free_maildir (struct maildir **md) > static void maildir_parse_flags (HEADER * h, const char *path) > { > - char *p, *q = NULL; > + const char *p; > + char *q = NULL; > h->flagged = 0; > h->read = 0; > @@ -2117,7 +2118,8 @@ err: > static void maildir_canon_filename (BUFFER *dest, const char *src) > { > - char *t, *u; > + const char *t; > + char *u; > if ((t = strrchr (src, '/'))) > src = t + 1; > diff --git a/muttlib.c b/muttlib.c > index 18f3ebf0..d0459bb2 100644 > --- a/muttlib.c > +++ b/muttlib.c > @@ -510,7 +510,8 @@ void _mutt_buffer_expand_path (BUFFER *src, int flags) > else > { > struct passwd *pw; > - if ((t = strchr (s + 1, '/'))) > + /* NB: this is temporarily modify src but is restoring it below */ ^^^^^^ Should this be "modifying"? > + if ((t = strchr (src->data + 1, '/'))) > *t = 0; > if ((pw = getpwnam (s + 1))) > diff --git a/parse.c b/parse.c > index 141947f4..6bce009b 100644 > --- a/parse.c > +++ b/parse.c > @@ -825,7 +825,7 @@ BODY *mutt_parse_multipart (FILE *fp, const char > *boundary, LOFF_T end_off, int > static const char *uncomment_timezone (char *buf, size_t buflen, const char > *tz) > { > - char *p; > + const char *p; > size_t len; > if (*tz != '(') > @@ -1001,7 +1001,7 @@ time_t mutt_parse_date (const char *s, HEADER *h) > { > struct tz_t *tz; > - tz = bsearch (ptz, TimeZones, sizeof TimeZones/sizeof (struct > tz_t), > + tz = (struct tz_t *)bsearch (ptz, TimeZones, sizeof > TimeZones/sizeof (struct tz_t), As we are already folding that function call, maybe also break it before the first sizeof. > sizeof (struct tz_t), > (int (*)(const void *, const void *)) > ascii_strcasecmp > /* This is safe to do: A pointer to a struct equals > diff --git a/rfc1524.c b/rfc1524.c > index 273614b1..758e380a 100644 > --- a/rfc1524.c > +++ b/rfc1524.c > @@ -208,6 +208,7 @@ static int rfc1524_mailcap_parse (BODY *a, > FILE *fp; > char *buf = NULL; > size_t buflen; > + const char *typeslash; > char *ch; > char *field; > int found = FALSE; > @@ -230,9 +231,9 @@ static int rfc1524_mailcap_parse (BODY *a, > */ > /* find length of basetype */ > - if ((ch = strchr (type, '/')) == NULL) > + if ((typeslash = strchr (type, '/')) == NULL) > return FALSE; > - btlen = ch - type; > + btlen = typeslash - type; > if ((fp = fopen (filename, "r")) != NULL) > { > @@ -499,7 +500,7 @@ void mutt_rfc1524_expand_filename (const char > *nametemplate, > BUFFER *newfile) > { > int i, j, k, ps; > - char *s; > + const char *s; > short lmatch = 0, rmatch = 0; > BUFFER *left = NULL; > BUFFER *right = NULL; > diff --git a/sendlib.c b/sendlib.c > index f0e34d99..a700d500 100644 > --- a/sendlib.c > +++ b/sendlib.c > @@ -2100,7 +2100,8 @@ static int write_one_header (FILE *fp, int pfxw, int > max, int wraplen, > const char *pfx, const char *start, const char > *end, > int flags) > { > - char *tagbuf, *valbuf, *t; > + char *tagbuf, *valbuf; > + const char *t; > int is_from = ((end - start) > 5 && > ascii_strncasecmp (start, "from ", 5) == 0); > diff --git a/url.c b/url.c > index c1578f42..dfe8bff7 100644 > --- a/url.c > +++ b/url.c > @@ -78,7 +78,8 @@ static int url_pct_decode (char *s) > url_scheme_t url_check_scheme (const char *s) > { > char sbuf[STRING]; > - char *t; > + const char *t; > + char *sbufp; > int i; > if (!s || !(t = strchr (s, ':'))) > @@ -87,8 +88,8 @@ url_scheme_t url_check_scheme (const char *s) > return U_UNKNOWN; > strfcpy (sbuf, s, t - s + 1); > - for (t = sbuf; *t; t++) > - *t = ascii_tolower (*t); > + for (sbufp = sbuf; *sbufp; sbufp++) > + *sbufp = ascii_tolower (*sbufp); > if ((i = mutt_getvaluebyname (sbuf, UrlMap)) == -1) > return U_UNKNOWN; > @@ -292,7 +293,8 @@ static int url_mailto_header_allowed (const char *header) > int url_parse_mailto (ENVELOPE *e, char **body, const char *src) > { > - char *t, *p; > + const char *t; > + char *p; > char *tmp; > char *headers; > char *tag, *value; > -- > 2.53.0 > > -- > Kevin J. McCarthy > GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
