Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 1 | From 3170b245aba99694390c3c87d326639b6685d4dd Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 19 Jan 2023 14:34:05 -0800 |
| 4 | Subject: [PATCH] Fix -Wincompatible-function-pointer-types |
| 5 | |
| 6 | Fixes new found errors with clang 16 |
| 7 | |
| 8 | news.c:370:36: error: incompatible function pointer types passing 'int (struct dirent *)' to parameter of type 'int (*)(const struct dirent *)' [-Wincompatible-function-pointer-types] |
| 9 | if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) { |
| 10 | ^~~~~~~~~~~ |
| 11 | /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/uw-imap/2007f-r0/recipe-sysroot/usr/include/dirent.h:259:13: note: passing argument to parameter '__selector' here |
| 12 | int (*__selector) (const struct dirent *), |
| 13 | ^ |
| 14 | news.c:370:48: error: incompatible function pointer types passing 'int (const void *, const void *)' to parameter of type 'int (*)(const struct dirent **, const struct dirent **)' [-Wincompatible-function-pointer-types] |
| 15 | |
| 16 | Upstream-Status: Pending |
| 17 | |
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 19 | --- |
| 20 | src/osdep/unix/mh.c | 8 ++++---- |
| 21 | src/osdep/unix/mix.c | 12 ++++++------ |
| 22 | src/osdep/unix/mx.c | 8 ++++---- |
| 23 | src/osdep/unix/news.c | 8 ++++---- |
| 24 | 4 files changed, 18 insertions(+), 18 deletions(-) |
| 25 | |
| 26 | diff --git a/src/osdep/unix/mh.c b/src/osdep/unix/mh.c |
| 27 | index 0226b7a..9264624 100644 |
| 28 | --- a/src/osdep/unix/mh.c |
| 29 | +++ b/src/osdep/unix/mh.c |
| 30 | @@ -103,8 +103,8 @@ long mh_copy (MAILSTREAM *stream,char *sequence,char *mailbox, |
| 31 | long options); |
| 32 | long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data); |
| 33 | |
| 34 | -int mh_select (struct direct *name); |
| 35 | -int mh_numsort (const void *d1,const void *d2); |
| 36 | +int mh_select (const struct direct *name); |
| 37 | +int mh_numsort (const struct dirent **d1,const struct dirent **d2); |
| 38 | char *mh_file (char *dst,char *name); |
| 39 | long mh_canonicalize (char *pattern,char *ref,char *pat); |
| 40 | void mh_setdate (char *file,MESSAGECACHE *elt); |
| 41 | @@ -1194,7 +1194,7 @@ long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data) |
| 42 | * Returns: T to use file name, NIL to skip it |
| 43 | */ |
| 44 | |
| 45 | -int mh_select (struct direct *name) |
| 46 | +int mh_select (const struct direct *name) |
| 47 | { |
| 48 | char c; |
| 49 | char *s = name->d_name; |
| 50 | @@ -1209,7 +1209,7 @@ int mh_select (struct direct *name) |
| 51 | * Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2 |
| 52 | */ |
| 53 | |
| 54 | -int mh_numsort (const void *d1,const void *d2) |
| 55 | +int mh_numsort (const struct dirent **d1,const struct dirent **d2) |
| 56 | { |
| 57 | return atoi ((*(struct direct **) d1)->d_name) - |
| 58 | atoi ((*(struct direct **) d2)->d_name); |
| 59 | diff --git a/src/osdep/unix/mix.c b/src/osdep/unix/mix.c |
| 60 | index fbf4a02..c2207f6 100644 |
| 61 | --- a/src/osdep/unix/mix.c |
| 62 | +++ b/src/osdep/unix/mix.c |
| 63 | @@ -125,7 +125,7 @@ long mix_unsubscribe (MAILSTREAM *stream,char *mailbox); |
| 64 | long mix_create (MAILSTREAM *stream,char *mailbox); |
| 65 | long mix_delete (MAILSTREAM *stream,char *mailbox); |
| 66 | long mix_rename (MAILSTREAM *stream,char *old,char *newname); |
| 67 | -int mix_rselect (struct direct *name); |
| 68 | +int mix_rselect (const struct direct *name); |
| 69 | MAILSTREAM *mix_open (MAILSTREAM *stream); |
| 70 | void mix_close (MAILSTREAM *stream,long options); |
| 71 | void mix_abort (MAILSTREAM *stream); |
| 72 | @@ -140,8 +140,8 @@ THREADNODE *mix_thread (MAILSTREAM *stream,char *type,char *charset, |
| 73 | long mix_ping (MAILSTREAM *stream); |
| 74 | void mix_check (MAILSTREAM *stream); |
| 75 | long mix_expunge (MAILSTREAM *stream,char *sequence,long options); |
| 76 | -int mix_select (struct direct *name); |
| 77 | -int mix_msgfsort (const void *d1,const void *d2); |
| 78 | +int mix_select (const struct direct *name); |
| 79 | +int mix_msgfsort (const struct dirent **d1,const struct dirent **d2); |
| 80 | long mix_addset (SEARCHSET **set,unsigned long start,unsigned long size); |
| 81 | long mix_burp (MAILSTREAM *stream,MIXBURP *burp,unsigned long *reclaimed); |
| 82 | long mix_burp_check (SEARCHSET *set,size_t size,char *file); |
| 83 | @@ -587,7 +587,7 @@ long mix_rename (MAILSTREAM *stream,char *old,char *newname) |
| 84 | * Returns: T if mix file name, NIL otherwise |
| 85 | */ |
| 86 | |
| 87 | -int mix_rselect (struct direct *name) |
| 88 | +int mix_rselect (const struct direct *name) |
| 89 | { |
| 90 | return mix_dirfmttest (name->d_name); |
| 91 | } |
| 92 | @@ -1146,7 +1146,7 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options) |
| 93 | * ".mix" with no suffix was used by experimental versions |
| 94 | */ |
| 95 | |
| 96 | -int mix_select (struct direct *name) |
| 97 | +int mix_select (const struct direct *name) |
| 98 | { |
| 99 | char c,*s; |
| 100 | /* make sure name has prefix */ |
| 101 | @@ -1165,7 +1165,7 @@ int mix_select (struct direct *name) |
| 102 | * Returns: -1 if d1 < d2, 0 if d1 == d2, 1 d1 > d2 |
| 103 | */ |
| 104 | |
| 105 | -int mix_msgfsort (const void *d1,const void *d2) |
| 106 | +int mix_msgfsort (const struct dirent **d1,const struct dirent **d2) |
| 107 | { |
| 108 | char *n1 = (*(struct direct **) d1)->d_name + sizeof (MIXNAME) - 1; |
| 109 | char *n2 = (*(struct direct **) d2)->d_name + sizeof (MIXNAME) - 1; |
| 110 | diff --git a/src/osdep/unix/mx.c b/src/osdep/unix/mx.c |
| 111 | index 4549527..b5c5adf 100644 |
| 112 | --- a/src/osdep/unix/mx.c |
| 113 | +++ b/src/osdep/unix/mx.c |
| 114 | @@ -98,8 +98,8 @@ long mx_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data); |
| 115 | long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt, |
| 116 | STRING *st,SEARCHSET *set); |
| 117 | |
| 118 | -int mx_select (struct direct *name); |
| 119 | -int mx_numsort (const void *d1,const void *d2); |
| 120 | +int mx_select (const struct direct *name); |
| 121 | +int mx_numsort (const struct dirent **d1,const struct dirent **d2); |
| 122 | char *mx_file (char *dst,char *name); |
| 123 | long mx_lockindex (MAILSTREAM *stream); |
| 124 | void mx_unlockindex (MAILSTREAM *stream); |
| 125 | @@ -1110,7 +1110,7 @@ long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt, |
| 126 | * Returns: T to use file name, NIL to skip it |
| 127 | */ |
| 128 | |
| 129 | -int mx_select (struct direct *name) |
| 130 | +int mx_select (const struct direct *name) |
| 131 | { |
| 132 | char c; |
| 133 | char *s = name->d_name; |
| 134 | @@ -1125,7 +1125,7 @@ int mx_select (struct direct *name) |
| 135 | * Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2 |
| 136 | */ |
| 137 | |
| 138 | -int mx_numsort (const void *d1,const void *d2) |
| 139 | +int mx_numsort (const struct dirent **d1,const struct dirent **d2) |
| 140 | { |
| 141 | return atoi ((*(struct direct **) d1)->d_name) - |
| 142 | atoi ((*(struct direct **) d2)->d_name); |
| 143 | diff --git a/src/osdep/unix/news.c b/src/osdep/unix/news.c |
| 144 | index 4cf5bb7..3da5207 100644 |
| 145 | --- a/src/osdep/unix/news.c |
| 146 | +++ b/src/osdep/unix/news.c |
| 147 | @@ -76,8 +76,8 @@ long news_create (MAILSTREAM *stream,char *mailbox); |
| 148 | long news_delete (MAILSTREAM *stream,char *mailbox); |
| 149 | long news_rename (MAILSTREAM *stream,char *old,char *newname); |
| 150 | MAILSTREAM *news_open (MAILSTREAM *stream); |
| 151 | -int news_select (struct direct *name); |
| 152 | -int news_numsort (const void *d1,const void *d2); |
| 153 | +int news_select (const struct direct *name); |
| 154 | +int news_numsort (const struct dirent ** d1,const struct dirent ** d2); |
| 155 | void news_close (MAILSTREAM *stream,long options); |
| 156 | void news_fast (MAILSTREAM *stream,char *sequence,long flags); |
| 157 | void news_flags (MAILSTREAM *stream,char *sequence,long flags); |
| 158 | @@ -402,7 +402,7 @@ MAILSTREAM *news_open (MAILSTREAM *stream) |
| 159 | * Returns: T to use file name, NIL to skip it |
| 160 | */ |
| 161 | |
| 162 | -int news_select (struct direct *name) |
| 163 | +int news_select (const struct direct *name) |
| 164 | { |
| 165 | char c; |
| 166 | char *s = name->d_name; |
| 167 | @@ -417,7 +417,7 @@ int news_select (struct direct *name) |
| 168 | * Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2 |
| 169 | */ |
| 170 | |
| 171 | -int news_numsort (const void *d1,const void *d2) |
| 172 | +int news_numsort (const struct dirent ** d1,const struct dirent ** d2) |
| 173 | { |
| 174 | return atoi ((*(struct direct **) d1)->d_name) - |
| 175 | atoi ((*(struct direct **) d2)->d_name); |
| 176 | -- |
| 177 | 2.39.1 |
| 178 | |