Found with -Wcast-qual.
---
addrbook.c | 8 ++++----
browser.c | 24 ++++++++++++------------
hash.c | 4 ++--
listmenu.c | 4 ++--
pager.c | 6 +++---
pgpkey.c | 16 ++++++++--------
rfc3676.c | 2 +-
sort.c | 43 ++++++++++++++++++++++---------------------
thread.c | 22 ++++++++++++----------
9 files changed, 66 insertions(+), 63 deletions(-)
diff --git a/addrbook.c b/addrbook.c
index 6175e39a..924a2c3e 100644
--- a/addrbook.c
+++ b/addrbook.c
@@ -95,8 +95,8 @@ static int alias_tag(MUTTMENU *menu, int n, int m)
static int alias_SortAlias(const void *a, const void *b)
{
- ALIAS *pa = *(ALIAS **) a;
- ALIAS *pb = *(ALIAS **) b;
+ const ALIAS *pa = *(const ALIAS * const *) a;
+ const ALIAS *pb = *(const ALIAS * const *) b;
int r = mutt_strcasecmp(pa->name, pb->name);
return (RSORT(r));
@@ -104,8 +104,8 @@ static int alias_SortAlias(const void *a, const void *b)
static int alias_SortAddress(const void *a, const void *b)
{
- ADDRESS *pa = (*(ALIAS **) a)->addr;
- ADDRESS *pb = (*(ALIAS **) b)->addr;
+ const ADDRESS *pa = (*(ALIAS * const *) a)->addr;
+ const ADDRESS *pb = (*(ALIAS * const *) b)->addr;
int r;
if (pa == pb)
diff --git a/browser.c b/browser.c
index 82f138ab..7f3498ce 100644
--- a/browser.c
+++ b/browser.c
@@ -86,8 +86,8 @@ static int sort_reverse_flag = 0;
static int browser_compare_order(const void *a, const void *b)
{
- struct folder_file *pa = (struct folder_file *) a;
- struct folder_file *pb = (struct folder_file *) b;
+ const struct folder_file *pa = (const struct folder_file *) a;
+ const struct folder_file *pb = (const struct folder_file *) b;
int r = mutt_numeric_cmp(pa->number, pb->number);
@@ -96,8 +96,8 @@ static int browser_compare_order(const void *a, const void *b)
static int browser_compare_subject(const void *a, const void *b)
{
- struct folder_file *pa = (struct folder_file *) a;
- struct folder_file *pb = (struct folder_file *) b;
+ const struct folder_file *pa = (const struct folder_file *) a;
+ const struct folder_file *pb = (const struct folder_file *) b;
int r = mutt_strcoll(pa->display_name, pb->display_name);
@@ -106,8 +106,8 @@ static int browser_compare_subject(const void *a, const
void *b)
static int browser_compare_date(const void *a, const void *b)
{
- struct folder_file *pa = (struct folder_file *) a;
- struct folder_file *pb = (struct folder_file *) b;
+ const struct folder_file *pa = (const struct folder_file *) a;
+ const struct folder_file *pb = (const struct folder_file *) b;
int r = mutt_numeric_cmp(pa->mtime, pb->mtime);
@@ -116,8 +116,8 @@ static int browser_compare_date(const void *a, const void
*b)
static int browser_compare_size(const void *a, const void *b)
{
- struct folder_file *pa = (struct folder_file *) a;
- struct folder_file *pb = (struct folder_file *) b;
+ const struct folder_file *pa = (const struct folder_file *) a;
+ const struct folder_file *pb = (const struct folder_file *) b;
int r = mutt_numeric_cmp(pa->size, pb->size);
@@ -126,8 +126,8 @@ static int browser_compare_size(const void *a, const void
*b)
static int browser_compare_count(const void *a, const void *b)
{
- struct folder_file *pa = (struct folder_file *) a;
- struct folder_file *pb = (struct folder_file *) b;
+ const struct folder_file *pa = (const struct folder_file *) a;
+ const struct folder_file *pb = (const struct folder_file *) b;
int r = mutt_numeric_cmp(pa->msg_count, pb->msg_count);
@@ -136,8 +136,8 @@ static int browser_compare_count(const void *a, const void
*b)
static int browser_compare_unread(const void *a, const void *b)
{
- struct folder_file *pa = (struct folder_file *) a;
- struct folder_file *pb = (struct folder_file *) b;
+ const struct folder_file *pa = (const struct folder_file *) a;
+ const struct folder_file *pb = (const struct folder_file *) b;
int r = mutt_numeric_cmp(pa->msg_unread, pb->msg_unread);
diff --git a/hash.c b/hash.c
index dff38e86..e0860aea 100644
--- a/hash.c
+++ b/hash.c
@@ -32,7 +32,7 @@
static unsigned int gen_string_hash(union hash_key key, unsigned int n)
{
unsigned int h = 0;
- unsigned char *s = (unsigned char *)key.strkey;
+ const unsigned char *s = (const unsigned char *)key.strkey;
while (*s)
h += (h << 7) + *s++;
@@ -49,7 +49,7 @@ static int cmp_string_key(union hash_key a, union hash_key b)
static unsigned int gen_case_string_hash(union hash_key key, unsigned int n)
{
unsigned int h = 0;
- unsigned char *s = (unsigned char *)key.strkey;
+ const unsigned char *s = (const unsigned char *)key.strkey;
while (*s)
h += (h << 7) + tolower(*s++);
diff --git a/listmenu.c b/listmenu.c
index 46bd8d8b..02bfc074 100644
--- a/listmenu.c
+++ b/listmenu.c
@@ -158,10 +158,10 @@ static void list_headers_free(struct list_headers
**p_lhdrs)
static void make_field_format(int max, char *dst)
{
int len = 0;
- struct mapping_t *action;
+ const struct mapping_t *action;
dst[--max] = '\0';
- for (action = (struct mapping_t *)ListActions; action->name; action++)
+ for (action = (const struct mapping_t *)ListActions; action->name; action++)
len = MAX(len, mutt_strwidth(_(action->name)));
/* n.b. not localized - is a metaformat */
diff --git a/pager.c b/pager.c
index c67eb3a8..a9c30dbd 100644
--- a/pager.c
+++ b/pager.c
@@ -425,7 +425,7 @@ classify_quote(struct q_class_t **QuoteList, const char
*qptr,
{
struct q_class_t *q_list = *QuoteList;
struct q_class_t *class = NULL, *tmp = NULL, *ptr, *save;
- char *tail_qptr;
+ const char *tail_qptr;
int offset, tail_lng;
int index = -1;
@@ -554,7 +554,7 @@ classify_quote(struct q_class_t **QuoteList, const char
*qptr,
q_list = q_list->down;
tail_lng = length - offset;
- tail_qptr = (char *) qptr + offset;
+ tail_qptr = qptr + offset;
while (q_list)
{
@@ -657,7 +657,7 @@ classify_quote(struct q_class_t **QuoteList, const char
*qptr,
q_list = q_list->down;
tail_lng = length - offset;
- tail_qptr = (char *) qptr + offset;
+ tail_qptr = qptr + offset;
continue;
}
diff --git a/pgpkey.c b/pgpkey.c
index dcbeee48..a6532e4c 100644
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -300,8 +300,8 @@ static int _pgp_compare_address(const void *a, const void
*b)
{
int r;
- pgp_uid_t **s = (pgp_uid_t **) a;
- pgp_uid_t **t = (pgp_uid_t **) b;
+ const pgp_uid_t * const *s = (const pgp_uid_t * const *) a;
+ const pgp_uid_t * const *t = (const pgp_uid_t * const *) b;
if ((r = mutt_strcasecmp((*s)->addr, (*t)->addr)))
return r;
@@ -322,8 +322,8 @@ static int _pgp_compare_keyid(const void *a, const void *b)
{
int r;
- pgp_uid_t **s = (pgp_uid_t **) a;
- pgp_uid_t **t = (pgp_uid_t **) b;
+ const pgp_uid_t * const *s = (const pgp_uid_t * const *) a;
+ const pgp_uid_t * const *t = (const pgp_uid_t * const *) b;
if ((r = mutt_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
pgp_fpr_or_lkeyid((*t)->parent))))
@@ -341,8 +341,8 @@ static int pgp_compare_keyid(const void *a, const void *b)
static int _pgp_compare_date(const void *a, const void *b)
{
int r;
- pgp_uid_t **s = (pgp_uid_t **) a;
- pgp_uid_t **t = (pgp_uid_t **) b;
+ const pgp_uid_t * const *s = (const pgp_uid_t * const *) a;
+ const pgp_uid_t * const *t = (const pgp_uid_t * const *) b;
if ((r = mutt_numeric_cmp((*s)->parent->gen_time, (*t)->parent->gen_time)))
return r;
@@ -359,8 +359,8 @@ static int _pgp_compare_trust(const void *a, const void *b)
{
int r;
- pgp_uid_t **s = (pgp_uid_t **) a;
- pgp_uid_t **t = (pgp_uid_t **) b;
+ const pgp_uid_t * const *s = (const pgp_uid_t * const *) a;
+ const pgp_uid_t * const *t = (const pgp_uid_t * const *) b;
if ((r = mutt_numeric_cmp(((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)),
((*t)->parent->flags & (KEYFLAG_RESTRICTIONS)))))
diff --git a/rfc3676.c b/rfc3676.c
index 48128a3d..ebb5cbdc 100644
--- a/rfc3676.c
+++ b/rfc3676.c
@@ -51,7 +51,7 @@ typedef struct flowed_state
static int get_quote_level(const char *line)
{
int quoted = 0;
- char *p = (char *) line;
+ const char *p = line;
while (p && *p == '>')
{
diff --git a/sort.c b/sort.c
index ce6f9e0e..f818a531 100644
--- a/sort.c
+++ b/sort.c
@@ -31,29 +31,29 @@
static int compare_score(const void *a, const void *b)
{
- HEADER **pa = (HEADER **) a;
- HEADER **pb = (HEADER **) b;
+ const HEADER * const *pa = (const HEADER * const *) a;
+ const HEADER * const *pb = (const HEADER * const *) b;
return mutt_numeric_cmp((*pb)->score, (*pa)->score); /* note that this is
reverse */
}
static int compare_size(const void *a, const void *b)
{
- HEADER **pa = (HEADER **) a;
- HEADER **pb = (HEADER **) b;
+ const HEADER * const *pa = (const HEADER * const *) a;
+ const HEADER * const *pb = (const HEADER * const *) b;
return mutt_numeric_cmp((*pa)->content->length, (*pb)->content->length);
}
static int compare_date_sent(const void *a, const void *b)
{
- HEADER **pa = (HEADER **) a;
- HEADER **pb = (HEADER **) b;
+ const HEADER * const *pa = (const HEADER * const *) a;
+ const HEADER * const *pb = (const HEADER * const *) b;
return mutt_numeric_cmp((*pa)->date_sent, (*pb)->date_sent);
}
static int compare_subject(const void *a, const void *b)
{
- HEADER **pa = (HEADER **) a;
- HEADER **pb = (HEADER **) b;
+ const HEADER * const *pa = (const HEADER * const *) a;
+ const HEADER * const *pb = (const HEADER * const *) b;
int rc;
if (!(*pa)->env->real_subj)
@@ -89,8 +89,8 @@ const char *mutt_get_name(ADDRESS *a)
static int compare_to(const void *a, const void *b)
{
- HEADER **ppa = (HEADER **) a;
- HEADER **ppb = (HEADER **) b;
+ const HEADER * const *ppa = (const HEADER * const *) a;
+ const HEADER * const *ppb = (const HEADER * const *) b;
char fa[SHORT_STRING];
const char *fb;
@@ -101,8 +101,8 @@ static int compare_to(const void *a, const void *b)
static int compare_from(const void *a, const void *b)
{
- HEADER **ppa = (HEADER **) a;
- HEADER **ppb = (HEADER **) b;
+ const HEADER * const *ppa = (const HEADER * const *) a;
+ const HEADER * const *ppb = (const HEADER * const *) b;
char fa[SHORT_STRING];
const char *fb;
@@ -113,23 +113,23 @@ static int compare_from(const void *a, const void *b)
static int compare_date_received(const void *a, const void *b)
{
- HEADER **pa = (HEADER **) a;
- HEADER **pb = (HEADER **) b;
+ const HEADER * const *pa = (const HEADER * const *) a;
+ const HEADER * const *pb = (const HEADER * const *) b;
return mutt_numeric_cmp((*pa)->received, (*pb)->received);
}
static int compare_order(const void *a, const void *b)
{
- HEADER **ha = (HEADER **) a;
- HEADER **hb = (HEADER **) b;
+ const HEADER * const *ha = (const HEADER * const *) a;
+ const HEADER * const *hb = (const HEADER * const *) b;
return mutt_numeric_cmp((*ha)->index, (*hb)->index);
}
static int compare_spam(const void *a, const void *b)
{
- HEADER **ppa = (HEADER **) a;
- HEADER **ppb = (HEADER **) b;
+ const HEADER * const *ppa = (const HEADER * const *) a;
+ const HEADER * const *ppb = (const HEADER * const *) b;
char *aptr, *bptr;
int ahas, bhas;
int result = 0;
@@ -176,8 +176,8 @@ static int compare_spam(const void *a, const void *b)
static int compare_label(const void *a, const void *b)
{
- HEADER **ppa = (HEADER **) a;
- HEADER **ppb = (HEADER **) b;
+ const HEADER * const *ppa = (const HEADER * const *) a;
+ const HEADER * const *ppb = (const HEADER * const *) b;
int ahas, bhas;
/* As with compare_spam, not all messages will have the x-label
@@ -251,7 +251,8 @@ static int compare_unthreaded(const void *a, const void *b)
if (rc)
return (SortAux & SORT_REVERSE) ? -rc : rc;
- rc = mutt_numeric_cmp((*((HEADER **)a))->index, (*((HEADER **)b))->index);
+ rc = mutt_numeric_cmp((*((const HEADER * const *) a))->index,
+ (*((const HEADER * const *) b))->index);
if (rc)
return (Sort & SORT_REVERSE) ? -rc : rc;
diff --git a/thread.c b/thread.c
index c67a3f78..4d388711 100644
--- a/thread.c
+++ b/thread.c
@@ -589,13 +589,13 @@ static int compare_aux_threads(const void *a, const void
*b)
return aux_func ? 1 : 0;
}
- rc = (*aux_func)(&(*((THREAD **) a))->sort_aux_key,
- &(*((THREAD **) b))->sort_aux_key);
+ rc = (*aux_func)(&(*((const THREAD * const *) a))->sort_aux_key,
+ &(*((const THREAD * const *) b))->sort_aux_key);
if (rc)
return (SortAux & SORT_REVERSE) ? -rc : rc;
- rc = mutt_numeric_cmp((*((THREAD **)a))->sort_aux_key->index,
- (*((THREAD **)b))->sort_aux_key->index);
+ rc = mutt_numeric_cmp((*((const THREAD * const *) a))->sort_aux_key->index,
+ (*((const THREAD * const *) b))->sort_aux_key->index);
if (rc)
return (SortAux & SORT_REVERSE) ? -rc : rc;
@@ -623,7 +623,8 @@ static int compare_aux_sortkeys(const void *a, const void
*b)
if (rc)
return rc;
- return mutt_numeric_cmp((*((HEADER **)a))->index, (*((HEADER **)b))->index);
+ return mutt_numeric_cmp((*((const HEADER * const *) a))->index,
+ (*((const HEADER * const *) b))->index);
}
static int compare_root_threads(const void *a, const void *b)
@@ -648,13 +649,13 @@ static int compare_root_threads(const void *a, const void
*b)
return sort_func ? 1 : 0;
}
- rc = (*sort_func)(&(*((THREAD **) a))->sort_group_key,
- &(*((THREAD **) b))->sort_group_key);
+ rc = (*sort_func)(&(*((const THREAD * const *) a))->sort_group_key,
+ &(*((const THREAD * const *) b))->sort_group_key);
if (rc)
return reverse ? -rc : rc;
- rc = mutt_numeric_cmp((*((THREAD **)a))->sort_group_key->index,
- (*((THREAD **)b))->sort_group_key->index);
+ rc = mutt_numeric_cmp((*((const THREAD * const *) a))->sort_group_key->index,
+ (*((const THREAD * const *)
b))->sort_group_key->index);
if (rc)
return reverse ? -rc : rc;
@@ -687,7 +688,8 @@ static int compare_group_sortkeys(const void *a, const void
*b)
if (rc)
return rc;
- return mutt_numeric_cmp((*((HEADER **)a))->index, (*((HEADER **)b))->index);
+ return mutt_numeric_cmp((*((const HEADER * const *) a))->index,
+ (*((const HEADER * const *) b))->index);
}
THREAD *mutt_sort_subthreads(THREAD *thread, int init)
--
2.51.0