*/
static int alias_sort_alias(const void *a, const void *b)
{
- struct Alias *pa = *(struct Alias **) a;
- struct Alias *pb = *(struct Alias **) b;
+ const struct Alias *pa = *(struct Alias const *const *) a;
+ const struct Alias *pb = *(struct Alias const *const *) b;
int r = mutt_str_strcasecmp(pa->name, pb->name);
return RSORT(r);
*/
static int alias_sort_address(const void *a, const void *b)
{
- struct AddressList *pal = &(*(struct Alias **) a)->addr;
- struct AddressList *pbl = &(*(struct Alias **) b)->addr;
+ const struct AddressList *pal = &(*(struct Alias const *const *) a)->addr;
+ const struct AddressList *pbl = &(*(struct Alias const *const *) b)->addr;
int r;
if (pal == pbl)
r = 1;
else
{
- struct Address *pa = TAILQ_FIRST(pal);
- struct Address *pb = TAILQ_FIRST(pbl);
+ const struct Address *pa = TAILQ_FIRST(pal);
+ const struct Address *pb = TAILQ_FIRST(pbl);
if (pa->personal)
{
if (pb->personal)
*/
static int browser_compare_subject(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
/* inbox should be sorted ahead of its siblings */
int r = mutt_inbox_cmp(pa->name, pb->name);
*/
static int browser_compare_desc(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
int r = mutt_str_strcoll(pa->desc, pb->desc);
*/
static int browser_compare_date(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
int r = pa->mtime - pb->mtime;
*/
static int browser_compare_size(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
int r = pa->size - pb->size;
*/
static int browser_compare_count(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
int r = 0;
if (pa->has_mailbox && pb->has_mailbox)
*/
static int browser_compare_count_new(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
int r = 0;
if (pa->has_mailbox && pb->has_mailbox)
*/
static int browser_compare(const void *a, const void *b)
{
- struct FolderFile *pa = (struct FolderFile *) a;
- struct FolderFile *pb = (struct FolderFile *) b;
+ const struct FolderFile *pa = (const struct FolderFile *) a;
+ const struct FolderFile *pb = (const struct FolderFile *) b;
if ((mutt_str_strcoll(pa->desc, "../") == 0) || (mutt_str_strcoll(pa->desc, "..") == 0))
return -1;
if (!a || !b)
return 0;
- const struct HashElem *hea = *(struct HashElem **) a;
- const struct HashElem *heb = *(struct HashElem **) b;
+ const struct HashElem *hea = *(struct HashElem const *const *) a;
+ const struct HashElem *heb = *(struct HashElem const *const *) b;
return mutt_str_strcasecmp(hea->key.strkey, heb->key.strkey);
}
if (a && b)
{
- return (*sort_func)(&(*((struct MuttThread **) a))->sort_key,
- &(*((struct MuttThread **) b))->sort_key);
+ return (*sort_func)(&(*((struct MuttThread const *const *) a))->sort_key,
+ &(*((struct MuttThread const *const *) b))->sort_key);
}
/* a hack to let us reset sort_func even though we can't
* have extra arguments because of qsort */
{
int r;
- struct PgpUid **s = (struct PgpUid **) a;
- struct PgpUid **t = (struct PgpUid **) b;
+ struct PgpUid const *const *s = (struct PgpUid const *const *) a;
+ struct PgpUid const *const *t = (struct PgpUid const *const *) b;
r = mutt_str_strcasecmp((*s)->addr, (*t)->addr);
if (r != 0)
{
int r;
- struct PgpUid **s = (struct PgpUid **) a;
- struct PgpUid **t = (struct PgpUid **) b;
+ struct PgpUid const *const *s = (struct PgpUid const *const *) a;
+ struct PgpUid const *const *t = (struct PgpUid const *const *) b;
r = mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent));
if (r != 0)
static int compare_key_date(const void *a, const void *b)
{
int r;
- struct PgpUid **s = (struct PgpUid **) a;
- struct PgpUid **t = (struct PgpUid **) b;
+ struct PgpUid const *const *s = (struct PgpUid const *const *) a;
+ struct PgpUid const *const *t = (struct PgpUid const *const *) b;
r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
if (r != 0)
{
int r;
- struct PgpUid **s = (struct PgpUid **) a;
- struct PgpUid **t = (struct PgpUid **) b;
+ struct PgpUid const *const *s = (struct PgpUid const *const *) a;
+ struct PgpUid const *const *t = (struct PgpUid const *const *) b;
r = (((*s)->parent->flags & KEYFLAG_RESTRICTIONS) -
((*t)->parent->flags & KEYFLAG_RESTRICTIONS));
*/
static int cb_qsort_sbe(const void *a, const void *b)
{
- const struct SbEntry *sbe1 = *(const struct SbEntry **) a;
- const struct SbEntry *sbe2 = *(const struct SbEntry **) b;
- struct Mailbox *m1 = sbe1->mailbox;
- struct Mailbox *m2 = sbe2->mailbox;
+ const struct SbEntry *sbe1 = *(struct SbEntry const *const *) a;
+ const struct SbEntry *sbe2 = *(struct SbEntry const *const *) b;
+ const struct Mailbox *m1 = sbe1->mailbox;
+ const struct Mailbox *m2 = sbe2->mailbox;
int rc = 0;
/* If the items still match, use their index positions
* to maintain a stable sort order */
if (retval == 0)
- retval = (*((struct Email **) a))->index - (*((struct Email **) b))->index;
+ retval = (*((struct Email const *const *) a))->index -
+ (*((struct Email const *const *) b))->index;
return retval;
}
*/
static int compare_score(const void *a, const void *b)
{
- struct Email **pa = (struct Email **) a;
- struct Email **pb = (struct Email **) b;
+ struct Email const *const *pa = (struct Email const *const *) a;
+ struct Email const *const *pb = (struct Email const *const *) b;
int result = (*pb)->score - (*pa)->score; /* note that this is reverse */
result = perform_auxsort(result, a, b);
return SORT_CODE(result);
*/
static int compare_size(const void *a, const void *b)
{
- struct Email **pa = (struct Email **) a;
- struct Email **pb = (struct Email **) b;
+ struct Email const *const *pa = (struct Email const *const *) a;
+ struct Email const *const *pb = (struct Email const *const *) b;
int result = (*pa)->content->length - (*pb)->content->length;
result = perform_auxsort(result, a, b);
return SORT_CODE(result);
*/
static int compare_date_sent(const void *a, const void *b)
{
- struct Email **pa = (struct Email **) a;
- struct Email **pb = (struct Email **) b;
+ struct Email const *const *pa = (struct Email const *const *) a;
+ struct Email const *const *pb = (struct Email const *const *) b;
int result = (*pa)->date_sent - (*pb)->date_sent;
result = perform_auxsort(result, a, b);
return SORT_CODE(result);
*/
static int compare_subject(const void *a, const void *b)
{
- struct Email **pa = (struct Email **) a;
- struct Email **pb = (struct Email **) b;
+ struct Email const *const *pa = (struct Email const *const *) a;
+ struct Email const *const *pb = (struct Email const *const *) b;
int rc;
if (!(*pa)->env->real_subj)
*/
static int compare_to(const void *a, const void *b)
{
- struct Email **ppa = (struct Email **) a;
- struct Email **ppb = (struct Email **) b;
+ struct Email const *const *ppa = (struct Email const *const *) a;
+ struct Email const *const *ppb = (struct Email const *const *) b;
char fa[128];
mutt_str_strfcpy(fa, mutt_get_name(TAILQ_FIRST(&(*ppa)->env->to)), sizeof(fa));
*/
static int compare_from(const void *a, const void *b)
{
- struct Email **ppa = (struct Email **) a;
- struct Email **ppb = (struct Email **) b;
+ struct Email const *const *ppa = (struct Email const *const *) a;
+ struct Email const *const *ppb = (struct Email const *const *) b;
char fa[128];
mutt_str_strfcpy(fa, mutt_get_name(TAILQ_FIRST(&(*ppa)->env->from)), sizeof(fa));
*/
static int compare_date_received(const void *a, const void *b)
{
- struct Email **pa = (struct Email **) a;
- struct Email **pb = (struct Email **) b;
+ struct Email const *const *pa = (struct Email const *const *) a;
+ struct Email const *const *pb = (struct Email const *const *) b;
int result = (*pa)->received - (*pb)->received;
result = perform_auxsort(result, a, b);
return SORT_CODE(result);
*/
static int compare_order(const void *a, const void *b)
{
- struct Email **ea = (struct Email **) a;
- struct Email **eb = (struct Email **) b;
+ struct Email const *const *ea = (struct Email const *const *) a;
+ struct Email const *const *eb = (struct Email const *const *) b;
/* no need to auxsort because you will never have equality here */
return SORT_CODE((*ea)->index - (*eb)->index);
*/
static int compare_spam(const void *a, const void *b)
{
- struct Email **ppa = (struct Email **) a;
- struct Email **ppb = (struct Email **) b;
+ struct Email const *const *ppa = (struct Email const *const *) a;
+ struct Email const *const *ppb = (struct Email const *const *) b;
char *aptr = NULL, *bptr = NULL;
int ahas, bhas;
int result = 0;
*/
static int compare_label(const void *a, const void *b)
{
- struct Email **ppa = (struct Email **) a;
- struct Email **ppb = (struct Email **) b;
+ struct Email const *const *ppa = (struct Email const *const *) a;
+ struct Email const *const *ppb = (struct Email const *const *) b;
int ahas, bhas, result = 0;
/* As with compare_spam, not all messages will have the x-label
int sort_list_cb(const void *a, const void *b)
{
- const char *stra = *(char **) a;
- const char *strb = *(char **) b;
+ const char *stra = *(char const *const *) a;
+ const char *strb = *(char const *const *) b;
return strcmp(stra, strb);
}