From 3c25e877da7ba4a11e0c9bd5f65f8857cb8f272b Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Fri, 18 Jun 2004 19:51:39 +0000 Subject: Fix various compiler warnings. svn path=/trunk/; revision=3899 --- base64.c | 1 + daemon.c | 2 +- driver.c | 22 +++++++++++----------- env.c | 2 +- imap.c | 2 +- netrc.c | 5 +---- pop3.c | 2 +- rfc822.c | 21 ++++++++++++--------- socket.c | 8 ++++---- transact.c | 14 +++++++------- uid.c | 2 +- unmime.c | 2 +- 12 files changed, 42 insertions(+), 41 deletions(-) diff --git a/base64.c b/base64.c index a8c7f1c1..03c6db44 100644 --- a/base64.c +++ b/base64.c @@ -8,6 +8,7 @@ * scheme used here. */ #include "config.h" +#include "fetchmail.h" #include static const char base64digits[] = diff --git a/daemon.c b/daemon.c index b5291d82..3dcb55c3 100644 --- a/daemon.c +++ b/daemon.c @@ -53,7 +53,7 @@ #include "fetchmail.h" #include "tunable.h" -RETSIGTYPE +static RETSIGTYPE sigchld_handler (int sig) /* process SIGCHLD to obtain the exit code of the terminating process */ { diff --git a/driver.c b/driver.c index ed58fcd8..7bd12095 100644 --- a/driver.c +++ b/driver.c @@ -815,24 +815,25 @@ flagthemail: return(PS_SUCCESS); } -static int do_session(ctl, proto, maxfetch) /* retrieve messages from server using given protocol method table */ -struct query *ctl; /* parsed options with merged-in defaults */ -const struct method *proto; /* protocol method table */ -const int maxfetch; /* maximum number of messages to fetch */ +static int do_session( + /* parsed options with merged-in defaults */ + struct query *ctl, + /* protocol method table */ + const struct method *proto, + /* maximum number of messages to fetch */ + const int maxfetch) { - int js; -#ifdef HAVE_VOLATILE + static int *msgsizes; volatile int err, mailserver_socket = -1; /* pacifies -Wall */ -#else - int err, mailserver_socket = -1; -#endif /* HAVE_VOLATILE */ + int deletions = 0, js; const char *msg; SIGHANDLERTYPE pipesave; SIGHANDLERTYPE alrmsave; ctl->server.base_protocol = proto; + msgsizes = NULL; pass = 0; err = 0; init_transact(proto); @@ -924,8 +925,7 @@ const int maxfetch; /* maximum number of messages to fetch */ else { char buf[MSGBUFSIZE+1], *realhost; - int count, new, bytes, deletions = 0; - int *msgsizes = (int *)NULL; + int count, new, bytes; #if INET6_ENABLE int fetches, dispatches, oldphase; #else /* INET6_ENABLE */ diff --git a/env.c b/env.c index d578f0c6..6b6a7d07 100644 --- a/env.c +++ b/env.c @@ -30,7 +30,7 @@ #include #endif -extern char *getenv(); /* needed on sysV68 R3V7.1. */ +extern char *getenv(const char *); /* needed on sysV68 R3V7.1. */ extern char *program_name; diff --git a/imap.c b/imap.c index 5d977061..bae1d50a 100644 --- a/imap.c +++ b/imap.c @@ -23,7 +23,7 @@ #endif /* OPIE_ENABLE */ #ifndef strstr /* glibc-2.1 declares this as a macro */ -extern char *strstr(); /* needed on sysV68 R3V7.1. */ +extern char *strstr(const char *, const char *); /* needed on sysV68 R3V7.1. */ #endif /* strstr */ /* imap_version values */ diff --git a/netrc.c b/netrc.c index 665a1f90..188f9986 100644 --- a/netrc.c +++ b/netrc.c @@ -320,10 +320,7 @@ search_netrc (list, host, login) #include -int -main (argc, argv) - int argc; - char **argv; +int main (int argc, char **argv) { struct stat sb; char *program_name, *file, *host, *login; diff --git a/pop3.c b/pop3.c index ec8cbdf5..80e0903f 100644 --- a/pop3.c +++ b/pop3.c @@ -26,7 +26,7 @@ #endif /* OPIE_ENABLE */ #ifndef strstr /* glibc-2.1 declares this as a macro */ -extern char *strstr(); /* needed on sysV68 R3V7.1. */ +extern char *strstr(const char *, const char *); /* needed on sysV68 R3V7.1. */ #endif /* strstr */ static int last; diff --git a/rfc822.c b/rfc822.c index 28dac71d..cd6fb17a 100644 --- a/rfc822.c +++ b/rfc822.c @@ -24,10 +24,12 @@ MIT license. Compile with -DMAIN to build the demonstrator. #include #include -#ifndef MAIN #include "fetchmail.h" + +#ifndef MAIN #include "i18n.h" #else +#include static int verbose; char *program_name = "rfc822"; #endif /* MAIN */ @@ -39,11 +41,11 @@ char *program_name = "rfc822"; #define HEADER_END(p) ((p)[0] == '\n' && ((p)[1] != ' ' && (p)[1] != '\t')) -unsigned char *reply_hack(buf, host, length) +unsigned char *reply_hack( + unsigned char *buf /* header to be hacked */, + const unsigned char *host /* server hostname */, + int *length) /* hack message headers so replies will work properly */ -unsigned char *buf; /* header to be hacked */ -const unsigned char *host; /* server hostname */ -int *length; { unsigned char *from, *cp, last_nws = '\0', *parens_from = NULL; int parendepth, state, has_bare_name_part, has_host_part; @@ -213,9 +215,8 @@ int *length; return(buf); } -unsigned char *nxtaddr(hdr) +unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to continue previous hdr */) /* parse addresses in succession out of a specified RFC822 header */ -const unsigned char *hdr; /* header to be parsed, NUL to continue previous hdr */ { static unsigned char address[BUFSIZ]; static int tp; @@ -392,10 +393,11 @@ const unsigned char *hdr; /* header to be parsed, NUL to continue previous hdr * static void parsebuf(unsigned char *longbuf, int reply) { unsigned char *cp; + int dummy; if (reply) { - reply_hack(longbuf, "HOSTNAME.NET"); + reply_hack(longbuf, "HOSTNAME.NET", &dummy); printf("Rewritten buffer: %s", longbuf); } else @@ -408,7 +410,7 @@ static void parsebuf(unsigned char *longbuf, int reply) -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { unsigned char buf[BUFSIZ], longbuf[BUFSIZ]; int ch, reply; @@ -450,6 +452,7 @@ main(int argc, char *argv[]) fputs(longbuf, stdout); parsebuf(longbuf, reply); } + exit(0); } #endif /* MAIN */ diff --git a/socket.c b/socket.c index 4b1b3203..83fd4d64 100644 --- a/socket.c +++ b/socket.c @@ -80,7 +80,7 @@ extern int mailserver_socket_temp; /* Socket to close if connect timeout */ #endif /* NET_SECURITY */ #ifdef HAVE_SOCKETPAIR -char *const *parse_plugin(const char *plugin, const char *host, const char *service) +static char *const *parse_plugin(const char *plugin, const char *host, const char *service) { const char **argvec; const char *c, *p; char *cp, *plugin_copy; @@ -752,7 +752,7 @@ SSL *SSLGetContext( int sock ) } -int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict ) +static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict ) { char buf[257]; X509 *x509_cert; @@ -884,12 +884,12 @@ int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict ) return (ok_return); } -int SSL_nock_verify_callback( int ok_return, X509_STORE_CTX *ctx ) +static int SSL_nock_verify_callback( int ok_return, X509_STORE_CTX *ctx ) { return SSL_verify_callback(ok_return, ctx, 0); } -int SSL_ck_verify_callback( int ok_return, X509_STORE_CTX *ctx ) +static int SSL_ck_verify_callback( int ok_return, X509_STORE_CTX *ctx ) { return SSL_verify_callback(ok_return, ctx, 1); } diff --git a/transact.c b/transact.c index 2bb28ede..b82f928c 100644 --- a/transact.c +++ b/transact.c @@ -36,7 +36,7 @@ #include "fetchmail.h" #ifndef strstr /* glibc-2.1 declares this as a macro */ -extern char *strstr(); /* needed on sysV68 R3V7.1. */ +extern char *strstr(const char *, const char *); /* needed on sysV68 R3V7.1. */ #endif /* strstr */ int mytimeout; /* value of nonreponse timeout */ @@ -87,7 +87,7 @@ static void find_server_names(const char *hdr, { char *cp; - for (cp = nxtaddr(hdr); + for (cp = nxtaddr((const unsigned char *)hdr); cp != NULL; cp = nxtaddr(NULL)) { @@ -110,11 +110,11 @@ static void find_server_names(const char *hdr, { int sl = strlen(ctl->server.qvirtual); - if (!strncasecmp(cp, ctl->server.qvirtual, sl)) + if (!strncasecmp((char *)cp, ctl->server.qvirtual, sl)) cp += sl; } - if ((atsign = strchr(cp, '@'))) { + if ((atsign = strchr((char *)cp, '@'))) { struct idlist *idp; /* @@ -125,15 +125,15 @@ static void find_server_names(const char *hdr, for (idp = ctl->server.localdomains; idp; idp = idp->next) { char *rhs; - rhs = atsign + (strlen(atsign) - strlen(idp->id)); + rhs = atsign + (strlen(atsign) - strlen((char *)idp->id)); if (rhs > atsign && (rhs[-1] == '.' || rhs[-1] == '@') && - strcasecmp(rhs, idp->id) == 0) + strcasecmp(rhs, (char *)idp->id) == 0) { if (outlevel >= O_DEBUG) report(stdout, GT_("passed through %s matching %s\n"), cp, idp->id); - save_str(xmit_names, cp, XMIT_ACCEPT); + save_str(xmit_names, (const char *)cp, XMIT_ACCEPT); accept_count++; goto nomap; } diff --git a/uid.c b/uid.c index 91362418..1d9846e0 100644 --- a/uid.c +++ b/uid.c @@ -271,7 +271,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile) /* return a pointer to the last element of the list to help the quick, * constant-time addition to the list, NOTE: this function does not dup * the string, the caller must do that. */ -/*@shared@*/ struct idlist **save_str_quick(/*@shared@*/ struct idlist **idl, +/*@shared@*/ static struct idlist **save_str_quick(/*@shared@*/ struct idlist **idl, /*@only@*/ char *str, flag status) /* save a number/UID pair on the given UID list */ { diff --git a/unmime.c b/unmime.c index fbc74f2c..65f654a8 100644 --- a/unmime.c +++ b/unmime.c @@ -327,7 +327,7 @@ static char *GetBoundary(char *CntType) } -int CheckContentType(char *CntType) +static int CheckContentType(char *CntType) { /* * Static array of Content-Type's for which we will do -- cgit v1.2.3