mirror of
https://git.freebsd.org/ports.git
synced 2025-06-20 12:10:31 -04:00
Clang 16 has a new error about incompatible function types, which shows up when building mail/panda-cclient: 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] if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) { ^~~~~~~~~~~ /usr/include/dirent.h:127:12: note: passing argument to parameter here int (*)(const struct dirent *), int (*)(const struct dirent **, ^ 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] if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) { ^~~~~~~~~~~~ /usr/include/dirent.h:127:44: note: passing argument to parameter here int (*)(const struct dirent *), int (*)(const struct dirent **, ^ This is because the prototypes for the scandir(3) 'select' and 'compar' callback function parameters do not match the declarations in <dirent.h>. The same occurs in a few other files under src/osdep/unix. Fix these by using the correct parameter types for the callback functions. PR: 271539 Approved by: thierry (maintainer) MFH: 2023Q2
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
--- src/osdep/unix/mh.c.orig 2022-04-17 00:12:02 UTC
|
|
+++ src/osdep/unix/mh.c
|
|
@@ -100,8 +100,8 @@ long mh_append (MAILSTREAM *stream,char *mailbox,appen
|
|
long options);
|
|
long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data);
|
|
|
|
-int mh_select (struct direct *name);
|
|
-int mh_numsort (const void *d1,const void *d2);
|
|
+int mh_select (const struct direct *name);
|
|
+int mh_numsort (const struct direct **d1,const struct direct **d2);
|
|
char *mh_file (char *dst,char *name);
|
|
long mh_canonicalize (char *pattern,char *ref,char *pat);
|
|
void mh_setdate (char *file,MESSAGECACHE *elt);
|
|
@@ -1191,7 +1191,7 @@ long mh_append (MAILSTREAM *stream,char *mailbox,appen
|
|
* Returns: T to use file name, NIL to skip it
|
|
*/
|
|
|
|
-int mh_select (struct direct *name)
|
|
+int mh_select (const struct direct *name)
|
|
{
|
|
char c;
|
|
char *s = name->d_name;
|
|
@@ -1206,10 +1206,9 @@ int mh_select (struct direct *name)
|
|
* Returns: negative if d1 < d2, 0 if d1 == d2, postive if d1 > d2
|
|
*/
|
|
|
|
-int mh_numsort (const void *d1,const void *d2)
|
|
+int mh_numsort (const struct direct **d1,const struct direct **d2)
|
|
{
|
|
- return atoi ((*(struct direct **) d1)->d_name) -
|
|
- atoi ((*(struct direct **) d2)->d_name);
|
|
+ return atoi ((*d1)->d_name) - atoi ((*d2)->d_name);
|
|
}
|
|
|
|
|