diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-11-21 22:53:38 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-11-21 22:53:38 -0700 |
commit | 2adddd4261eeefe058b529ed0b9af6b2d497aa67 (patch) | |
tree | 8ccd933b22c28c4ac2c24520127cf50dbcf54f10 /imap/src/osdep | |
parent | d68d725ea37a3538f657fc2a8d211fad36af72d3 (diff) | |
download | alpine-2adddd4261eeefe058b529ed0b9af6b2d497aa67.tar.xz |
* Fix some compilation warnings. It is possible these fixes break
compilation in other compilers as there might be differences
in the prototypes of the scandir function. This might need to
be solved by making sensible changes to the configure script, so
more work might be needed to complete this project.
Diffstat (limited to 'imap/src/osdep')
-rw-r--r-- | imap/src/osdep/unix/mbx.c | 9 | ||||
-rw-r--r-- | imap/src/osdep/unix/mh.c | 10 | ||||
-rw-r--r-- | imap/src/osdep/unix/mix.c | 22 | ||||
-rw-r--r-- | imap/src/osdep/unix/mx.c | 10 | ||||
-rw-r--r-- | imap/src/osdep/unix/news.c | 10 |
5 files changed, 33 insertions, 28 deletions
diff --git a/imap/src/osdep/unix/mbx.c b/imap/src/osdep/unix/mbx.c index ddb8ae89..3770e0a9 100644 --- a/imap/src/osdep/unix/mbx.c +++ b/imap/src/osdep/unix/mbx.c @@ -1512,10 +1512,12 @@ unsigned long mbx_read_flags (MAILSTREAM *stream,MESSAGECACHE *elt) fatal (LOCAL->buf); } if ((LOCAL->buf[0] != ';') || (LOCAL->buf[13] != '-')) { + char tmp[16]; LOCAL->buf[14] = '\0'; /* tie off buffer for error message */ + strncpy(tmp, LOCAL->buf, 14); sprintf (LOCAL->buf+50,"Invalid flags for message %lu (%lu %lu): %s", elt->msgno,elt->private.special.offset, - elt->private.special.text.size,(char *) LOCAL->buf); + elt->private.special.text.size,(char *) tmp); fatal (LOCAL->buf+50); } LOCAL->buf[13] = '\0'; /* tie off buffer */ @@ -1596,10 +1598,13 @@ void mbx_update_status (MAILSTREAM *stream,unsigned long msgno,long flags) fatal (LOCAL->buf); } if ((LOCAL->buf[0] != ';') || (LOCAL->buf[13] != '-')) { + char tmp[16]; + LOCAL->buf[14] = '\0'; /* tie off buffer for error message */ + strncpy(tmp, LOCAL->buf, 14); LOCAL->buf[14] = '\0'; /* tie off buffer for error message */ sprintf (LOCAL->buf+50,"Invalid flags for message %lu (%lu %lu): %s", elt->msgno,elt->private.special.offset, - elt->private.special.text.size,(char *) LOCAL->buf); + elt->private.special.text.size,(char *) tmp); fatal (LOCAL->buf+50); } /* print new flag string */ diff --git a/imap/src/osdep/unix/mh.c b/imap/src/osdep/unix/mh.c index ab4449f4..68e3aa68 100644 --- a/imap/src/osdep/unix/mh.c +++ b/imap/src/osdep/unix/mh.c @@ -100,8 +100,8 @@ long mh_copy (MAILSTREAM *stream,char *sequence,char *mailbox, 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); @@ -1192,10 +1192,10 @@ long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data) * 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; + char *s = (char *) name->d_name; while ((c = *s++) != '\0') if (!isdigit (c)) return NIL; return T; } @@ -1207,7 +1207,7 @@ int mh_select (struct direct *name) * Returns: negative if d1 < d2, 0 if d1 == d2, positive 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); diff --git a/imap/src/osdep/unix/mix.c b/imap/src/osdep/unix/mix.c index d2b5c71b..11b4b3a3 100644 --- a/imap/src/osdep/unix/mix.c +++ b/imap/src/osdep/unix/mix.c @@ -123,7 +123,7 @@ long mix_unsubscribe (MAILSTREAM *stream,char *mailbox); long mix_create (MAILSTREAM *stream,char *mailbox); long mix_delete (MAILSTREAM *stream,char *mailbox); long mix_rename (MAILSTREAM *stream,char *old,char *newname); -int mix_rselect (struct direct *name); +int mix_rselect (const struct direct *name); MAILSTREAM *mix_open (MAILSTREAM *stream); void mix_close (MAILSTREAM *stream,long options); void mix_abort (MAILSTREAM *stream); @@ -138,8 +138,8 @@ THREADNODE *mix_thread (MAILSTREAM *stream,char *type,char *charset, long mix_ping (MAILSTREAM *stream); void mix_check (MAILSTREAM *stream); long mix_expunge (MAILSTREAM *stream,char *sequence,long options); -int mix_select (struct direct *name); -int mix_msgfsort (const void *d1,const void *d2); +int mix_select (const struct direct *name); +int mix_msgfsort (const struct direct **d1,const struct direct **d2); long mix_addset (SEARCHSET **set,unsigned long start,unsigned long size); long mix_burp (MAILSTREAM *stream,MIXBURP *burp,unsigned long *reclaimed); long mix_burp_check (SEARCHSET *set,size_t size,char *file); @@ -586,9 +586,9 @@ long mix_rename (MAILSTREAM *stream,char *old,char *newname) * Returns: T if mix file name, NIL otherwise */ -int mix_rselect (struct direct *name) +int mix_rselect (const struct direct *name) { - return mix_dirfmttest (name->d_name); + return mix_dirfmttest ((char *) name->d_name); } /* MIX mail open @@ -1151,12 +1151,12 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options) * ".mix" with no suffix was used by experimental versions */ -int mix_select (struct direct *name) +int mix_select (const struct direct *name) { char c,*s; /* make sure name has prefix */ - if (mix_dirfmttest (name->d_name)) { - for (c = *(s = name->d_name + sizeof (MIXNAME) - 1); c && isxdigit (c); + if (mix_dirfmttest ((char *) name->d_name)) { + for (c = *(s = ((char *) name->d_name) + sizeof (MIXNAME) - 1); c && isxdigit (c); c = *s++); if (!c) return T; /* all-hex or no suffix */ } @@ -1170,7 +1170,7 @@ int mix_select (struct direct *name) * Returns: -1 if d1 < d2, 0 if d1 == d2, 1 d1 > d2 */ -int mix_msgfsort (const void *d1,const void *d2) +int mix_msgfsort (const struct direct **d1,const struct direct **d2) { char *n1 = (*(struct direct **) d1)->d_name + sizeof (MIXNAME) - 1; char *n2 = (*(struct direct **) d2)->d_name + sizeof (MIXNAME) - 1; @@ -2469,7 +2469,7 @@ FILE *mix_data_open (MAILSTREAM *stream,int *fd,long *size, FILE *mix_sortcache_open (MAILSTREAM *stream) { - int fd,refwd; + int fd = -1,refwd; unsigned long i,uid,sentdate,fromlen,tolen,cclen,subjlen,msgidlen,reflen; char *s,*t,*msg,tmp[MAILTMPLEN]; MESSAGECACHE *elt; @@ -2671,7 +2671,7 @@ FILE *mix_sortcache_open (MAILSTREAM *stream) fclose (srtcf); /* so close it and return as if error */ srtcf = NIL; } - else fchmod (fd,sbuf.st_mode); + else if(fd >= 0) fchmod (fd,sbuf.st_mode); return srtcf; } diff --git a/imap/src/osdep/unix/mx.c b/imap/src/osdep/unix/mx.c index 54ea6ecb..6ba04ca0 100644 --- a/imap/src/osdep/unix/mx.c +++ b/imap/src/osdep/unix/mx.c @@ -98,8 +98,8 @@ long mx_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data); long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt, STRING *st,SEARCHSET *set); -int mx_select (struct direct *name); -int mx_numsort (const void *d1,const void *d2); +int mx_select (const struct direct *name); +int mx_numsort (const struct direct **d1,const struct direct **d2); char *mx_file (char *dst,char *name); long mx_lockindex (MAILSTREAM *stream); void mx_unlockindex (MAILSTREAM *stream); @@ -1111,10 +1111,10 @@ long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt, * Returns: T to use file name, NIL to skip it */ -int mx_select (struct direct *name) +int mx_select (const struct direct *name) { char c; - char *s = name->d_name; + char *s = (char *) name->d_name; while ((c = *s++) != '\0') if (!isdigit (c)) return NIL; return T; } @@ -1126,7 +1126,7 @@ int mx_select (struct direct *name) * Returns: negative if d1 < d2, 0 if d1 == d2, positive if d1 > d2 */ -int mx_numsort (const void *d1,const void *d2) +int mx_numsort (const struct direct **d1,const struct direct **d2) { return atoi ((*(struct direct **) d1)->d_name) - atoi ((*(struct direct **) d2)->d_name); diff --git a/imap/src/osdep/unix/news.c b/imap/src/osdep/unix/news.c index d80ef003..beda8a66 100644 --- a/imap/src/osdep/unix/news.c +++ b/imap/src/osdep/unix/news.c @@ -76,8 +76,8 @@ long news_create (MAILSTREAM *stream,char *mailbox); long news_delete (MAILSTREAM *stream,char *mailbox); long news_rename (MAILSTREAM *stream,char *old,char *newname); MAILSTREAM *news_open (MAILSTREAM *stream); -int news_select (struct direct *name); -int news_numsort (const void *d1,const void *d2); +int news_select (const struct direct *name); +int news_numsort (const struct direct **d1,const struct direct **d2); void news_close (MAILSTREAM *stream,long options); void news_fast (MAILSTREAM *stream,char *sequence,long flags); void news_flags (MAILSTREAM *stream,char *sequence,long flags); @@ -403,10 +403,10 @@ MAILSTREAM *news_open (MAILSTREAM *stream) * Returns: T to use file name, NIL to skip it */ -int news_select (struct direct *name) +int news_select (const struct direct *name) { char c; - char *s = name->d_name; + char *s = (char *) name->d_name; while ((c = *s++) != '\0') if (!isdigit (c)) return NIL; return T; } @@ -418,7 +418,7 @@ int news_select (struct direct *name) * Returns: negative if d1 < d2, 0 if d1 == d2, positive if d1 > d2 */ -int news_numsort (const void *d1,const void *d2) +int news_numsort (const struct direct **d1,const struct direct **d2) { return atoi ((*(struct direct **) d1)->d_name) - atoi ((*(struct direct **) d2)->d_name); |