aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-03-15 17:05:25 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-03-15 17:05:25 +0000
commitc3e52ea6ca3178b7ecab4b389a9ba9269662b48f (patch)
tree92010dbf827948300ec59549600f86eac09ca9b0
parent10ad1196e3f7f240a231e91d7cb2a612da3d6b4e (diff)
downloadfetchmail-c3e52ea6ca3178b7ecab4b389a9ba9269662b48f.tar.gz
fetchmail-c3e52ea6ca3178b7ecab4b389a9ba9269662b48f.tar.bz2
fetchmail-c3e52ea6ca3178b7ecab4b389a9ba9269662b48f.zip
Further cleanups to compile with C++ compiler.
svn path=/branches/BRANCH_6-3/; revision=4744
-rw-r--r--base64.c4
-rw-r--r--driver.c13
-rw-r--r--getpass.c3
-rw-r--r--imap.c2
-rw-r--r--libesmtp/gethostbyname.c4
-rw-r--r--md5c.c2
-rw-r--r--netrc.c7
-rw-r--r--ntlm.h5
-rw-r--r--opie.c6
-rw-r--r--options.c11
-rw-r--r--pop3.c10
-rw-r--r--rcfile_l.l7
-rw-r--r--rcfile_y.y6
-rw-r--r--rfc2047e.c2
-rw-r--r--rpa.c25
-rw-r--r--sink.c4
-rw-r--r--smb.h4
-rw-r--r--smbdes.c6
-rw-r--r--smbencrypt.c2
-rw-r--r--smbencrypt.h17
-rw-r--r--smbutil.c4
-rw-r--r--socket.c6
-rw-r--r--strlcat.c5
-rw-r--r--strlcpy.c5
-rw-r--r--transact.c13
25 files changed, 86 insertions, 87 deletions
diff --git a/base64.c b/base64.c
index 4fd9a30c..1453257b 100644
--- a/base64.c
+++ b/base64.c
@@ -30,7 +30,7 @@ static const char base64val[] = {
void to64frombits(char *out, const void *in_, int inlen)
/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
{
- const unsigned char *in = in_;
+ const unsigned char *in = (const unsigned char *)in_;
for (; inlen >= 3; inlen -= 3)
{
@@ -61,7 +61,7 @@ int from64tobits(void *out_, const char *in, int maxlen)
{
int len = 0;
register unsigned char digit1, digit2, digit3, digit4;
- unsigned char *out = out_;
+ unsigned char *out = (unsigned char *)out_;
if (in[0] == '+' && in[1] == ' ')
in += 2;
diff --git a/driver.c b/driver.c
index 89aeb36c..1d39f068 100644
--- a/driver.c
+++ b/driver.c
@@ -443,7 +443,7 @@ static int fetch_messages(int mailserver_socket, struct query *ctl,
/* Time to allocate memory to store the sizes */
xfree(*msgsizes);
- *msgsizes = xmalloc(sizeof(int) * fetchsizelimit);
+ *msgsizes = (int *)xmalloc(sizeof(int) * fetchsizelimit);
}
/*
@@ -1029,7 +1029,7 @@ static int do_session(
{
xfree(ctl->server.truename);
ctl->server.truename = xstrdup(res->ai_canonname);
- ctl->server.trueaddr = xmalloc(res->ai_addrlen);
+ ctl->server.trueaddr = (struct sockaddr *)xmalloc(res->ai_addrlen);
ctl->server.trueaddr_len = res->ai_addrlen;
memcpy(ctl->server.trueaddr, res->ai_addr, res->ai_addrlen);
freeaddrinfo(res);
@@ -1397,7 +1397,7 @@ is restored."));
!(proto->getpartialsizes && NUM_NONZERO(ctl->fetchsizelimit)))
{
xfree(msgsizes);
- msgsizes = xmalloc(sizeof(int) * count);
+ msgsizes = (int *)xmalloc(sizeof(int) * count);
for (i = 0; i < count; i++)
msgsizes[i] = 0;
@@ -1575,10 +1575,9 @@ closeUp:
return(err);
}
-int do_protocol(ctl, proto)
-/* 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 */
+/** retrieve messages from server using given protocol method table */
+int do_protocol(struct query *ctl /** parsed options with merged-in defaults */,
+ const struct method *proto /** protocol method table */)
{
int err;
diff --git a/getpass.c b/getpass.c
index 12f58627..3c19ba7c 100644
--- a/getpass.c
+++ b/getpass.c
@@ -61,8 +61,7 @@ static void disable_tty_echo(void);
static void restore_tty_state(void);
static RETSIGTYPE sigint_handler(int);
-char *fm_getpassword(prompt)
-char *prompt;
+char *fm_getpassword(char *prompt)
{
#if !(defined(HAVE_TCSETATTR) || defined(HAVE_TERMIO_H) || defined(HAVE_STTY))
#if defined(HAVE_GETPASS)
diff --git a/imap.c b/imap.c
index 42f57281..856f3f86 100644
--- a/imap.c
+++ b/imap.c
@@ -782,7 +782,7 @@ static int imap_getrange(int sock,
{
if (unseen_messages)
free(unseen_messages);
- unseen_messages = xmalloc(count * sizeof(unsigned int));
+ unseen_messages = (unsigned int *)xmalloc(count * sizeof(unsigned int));
memset(unseen_messages, 0, count * sizeof(unsigned int));
unseen = 0;
diff --git a/libesmtp/gethostbyname.c b/libesmtp/gethostbyname.c
index d151606d..2e3beefc 100644
--- a/libesmtp/gethostbyname.c
+++ b/libesmtp/gethostbyname.c
@@ -85,7 +85,7 @@ gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
memset (ctx, 0, sizeof (struct ghbnctx));
ctx->hostbuf_len = 2048;
- if ((ctx->hostbuf = malloc (ctx->hostbuf_len)) == NULL)
+ if ((ctx->hostbuf = (char *)malloc (ctx->hostbuf_len)) == NULL)
{
errno = ENOMEM;
return NULL;
@@ -95,7 +95,7 @@ gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
&hp, &ctx->h_err)) == ERANGE)
{
ctx->hostbuf_len += 1024;
- if ((tmp = realloc (ctx->hostbuf, ctx->hostbuf_len)) == NULL)
+ if ((tmp = (char *)realloc (ctx->hostbuf, ctx->hostbuf_len)) == NULL)
{
errno = ENOMEM;
return NULL;
diff --git a/md5c.c b/md5c.c
index ae36de49..61fd2fe7 100644
--- a/md5c.c
+++ b/md5c.c
@@ -56,7 +56,7 @@ void MD5Init(struct MD5Context *ctx)
*/
void MD5Update(struct MD5Context *ctx, const void *buf_, unsigned len)
{
- const unsigned char *buf = buf_;
+ const unsigned char *buf = (const unsigned char *)buf_;
register uint32 t;
/* Update bitcount */
diff --git a/netrc.c b/netrc.c
index ea422edf..196db671 100644
--- a/netrc.c
+++ b/netrc.c
@@ -76,8 +76,7 @@ maybe_add_to_list (netrc_entry **newentry, netrc_entry **list)
list of entries. NULL is returned if the file could not be
parsed. */
netrc_entry *
-parse_netrc (file)
- char *file;
+parse_netrc (char *file)
{
FILE *fp;
char buf[POPBUFSIZE+1], *p, *tok;
@@ -291,9 +290,7 @@ parse_netrc (file)
/* Return the netrc entry from LIST corresponding to HOST. NULL is
returned if no such entry exists. */
netrc_entry *
-search_netrc (list, host, login)
- netrc_entry *list;
- char *host, *login;
+search_netrc (netrc_entry *list, char *host, char *login)
{
/* Look for the HOST in LIST. */
while (list)
diff --git a/ntlm.h b/ntlm.h
index f25e416e..14696335 100644
--- a/ntlm.h
+++ b/ntlm.h
@@ -1,9 +1,6 @@
/* ntlm.h -- interface declarations for SMB authentication code */
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef unsigned char uint8;
-
+#include "smbtypes.h"
/*
* These structures are byte-order dependant, and should not
diff --git a/opie.c b/opie.c
index b7687d94..395de2dd 100644
--- a/opie.c
+++ b/opie.c
@@ -18,7 +18,13 @@
#include "md5.h"
#ifdef OPIE_ENABLE
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <opie.h>
+#ifdef __cplusplus
+}
+#endif
int do_otp(int sock, char *command, struct query *ctl)
{
diff --git a/options.c b/options.c
index 8f890ed0..9bfc7586 100644
--- a/options.c
+++ b/options.c
@@ -215,12 +215,11 @@ static int xatoi(char *s, int *errflagptr)
#endif
}
-int parsecmdline (argc, argv, rctl, ctl)
-/* parse and validate the command line options */
-int argc; /* argument count */
-char **argv; /* argument strings */
-struct runctl *rctl; /* global run controls to modify */
-struct query *ctl; /* option record to be initialized */
+/** parse and validate the command line options */
+int parsecmdline (int argc /** argument count */,
+ char **argv /** argument strings */,
+ struct runctl *rctl /** global run controls to modify */,
+ struct query *ctl /** option record to initialize */)
{
/*
* return value: if positive, argv index of last parsed option + 1
diff --git a/pop3.c b/pop3.c
index ff68f614..4456b2d3 100644
--- a/pop3.c
+++ b/pop3.c
@@ -23,7 +23,13 @@
#include "i18n.h"
#ifdef OPIE_ENABLE
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <opie.h>
+#ifdef __cplusplus
+}
+#endif
#endif /* OPIE_ENABLE */
/* global variables: please reinitialize them explicitly for proper
@@ -533,8 +539,10 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting)
if ((challenge = strstr(lastok, "otp-"))) {
char response[OPIE_RESPONSE_MAX+1];
int i;
+ char *n = xstrdup("");
- i = opiegenerator(challenge, !strcmp(ctl->password, "opie") ? "" : ctl->password, response);
+ i = opiegenerator(challenge, !strcmp(ctl->password, "opie") ? n : ctl->password, response);
+ free(n);
if ((i == -2) && !run.poll_interval) {
char secret[OPIE_SECRET_MAX+1];
fprintf(stderr, GT_("Secret pass phrase: "));
diff --git a/rcfile_l.l b/rcfile_l.l
index 9f4bf5c8..14eb73e4 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -223,12 +223,11 @@ options {/* EMPTY */}
%%
-void escapes(cp, tp)
-/* process standard C-style escape sequences in a string,
+/** process standard C-style escape sequences in a string,
* this can never lengthen the output, so cp and tp may overlap as long
* as cp >= tp. */
-const char *cp; /* source string with escapes */
-char *tp; /* target buffer for digested string */
+void escapes(const char *cp /** source string with escapes */,
+ char *tp /** target buffer for digested string */)
{
while (*cp)
{
diff --git a/rcfile_y.y b/rcfile_y.y
index 0aa9265e..75d57c27 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -518,9 +518,9 @@ static void user_reset(void)
current.server = save;
}
-struct query *hostalloc(init)
-/* append a host record to the host list */
-struct query *init; /* pointer to block containing initial values */
+/** append a host record to the host list */
+struct query *hostalloc(struct query *init /** pointer to block containing
+ initial values */)
{
struct query *node;
diff --git a/rfc2047e.c b/rfc2047e.c
index 922fe7a9..fd6ae2bc 100644
--- a/rfc2047e.c
+++ b/rfc2047e.c
@@ -104,7 +104,7 @@ char *rfc2047e(const char *string, const char *charset) {
count++;
r += strspn(r, ws);
}
- words = xmalloc(sizeof(char *) * (count + 1));
+ words = (char **)xmalloc(sizeof(char *) * (count + 1));
idx = 0;
r = string;
diff --git a/rpa.c b/rpa.c
index 79e4d8ab..433c12e6 100644
--- a/rpa.c
+++ b/rpa.c
@@ -50,7 +50,7 @@ extern int linecount;
unsigned char* rbuf, int unicodeit);
static void CompUserResp();
static int CheckUserAuth();
- static void md5(void* in, int len, unsigned char* out);
+ static void md5(const void* in, int len, unsigned char* out);
#endif
/* RPA protocol definitions */
@@ -360,9 +360,7 @@ int POP3_auth_rpa (char *userid, char *passphrase, int socket)
globals: reads outlevel.
*********************************************************************/
-static int POP3_rpa_resp (argbuf,socket)
-char *argbuf;
-int socket;
+static int POP3_rpa_resp (char *argbuf, int socket)
{
int ok;
char buf [POPBUFSIZE];
@@ -419,9 +417,7 @@ int socket;
globals: none
*********************************************************************/
-static void LenAppend(pptr_,len)
-char **pptr_;
-int len;
+static void LenAppend(char **pptr_, int len)
{
unsigned char **pptr = (unsigned char **)pptr_;
@@ -455,9 +451,7 @@ int len;
globals: reads outlevel.
*********************************************************************/
-int LenSkip(pptr,rxlen)
-char **pptr;
-int rxlen;
+int LenSkip(char **pptr, int rxlen)
{
int len;
char *save;
@@ -517,8 +511,7 @@ int rxlen;
globals: reads outlevel.
*********************************************************************/
-static int DecBase64(bufp)
-char *bufp;
+static int DecBase64(char *bufp)
{
unsigned int newx, bits=0, cnt=0, i, part=0;
unsigned char ch;
@@ -576,9 +569,7 @@ char *bufp;
globals: reads outlevel;
*********************************************************************/
-static void EncBase64(bufp,len)
-char *bufp;
-int len;
+static void EncBase64(char *bufp, int len)
{
char* outp;
unsigned char c1,c2,c3;
@@ -871,11 +862,11 @@ static int CheckUserAuth(void)
globals: reads outlevel
*********************************************************************/
-static void md5(void *in_,int len,unsigned char *out)
+static void md5(const void *in_,int len,unsigned char *out)
{
int i;
MD5_CTX md5context;
- unsigned char *in = in_;
+ const unsigned char *in = (const unsigned char *)in_;
if (outlevel >= O_DEBUG)
{
diff --git a/sink.c b/sink.c
index 3ceb367f..aaa0beba 100644
--- a/sink.c
+++ b/sink.c
@@ -920,7 +920,7 @@ static int open_smtp_sink(struct query *ctl, struct msgblk *msg,
for (idp = msg->recipients; idp; idp = idp->next)
total_addresses++;
#ifdef EXPLICIT_BOUNCE_ON_BAD_ADDRESS
- from_responses = xmalloc(sizeof(char *) * total_addresses);
+ from_responses = (char **)xmalloc(sizeof(char *) * total_addresses);
#endif /* EXPLICIT_BOUNCE_ON_BAD_ADDRESS */
for (idp = msg->recipients; idp; idp = idp->next)
if (idp->val.status.mark == XMIT_ACCEPT)
@@ -1426,7 +1426,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward)
char **responses;
/* eat the RFC2033-required responses, saving errors */
- responses = xmalloc(sizeof(char *) * lmtp_responses);
+ responses = (char **)xmalloc(sizeof(char *) * lmtp_responses);
for (errors = i = 0; i < lmtp_responses; i++)
{
if ((smtp_err = SMTP_ok(ctl->smtp_socket, ctl->smtphostmode))
diff --git a/smb.h b/smb.h
index eb5e382e..edefb17d 100644
--- a/smb.h
+++ b/smb.h
@@ -1,6 +1,4 @@
-typedef unsigned short uint16;
-typedef unsigned uint32;
-typedef unsigned char uint8;
+#include "smbtypes.h"
typedef struct
{
diff --git a/smbdes.c b/smbdes.c
index e3ab78af..f738b6a2 100644
--- a/smbdes.c
+++ b/smbdes.c
@@ -173,7 +173,7 @@ static void concat(char *out, char *in1, char *in2, int l1, int l2)
*out++ = *in2++;
}
-static void xor(char *out, char *in1, char *in2, int n)
+static void exor(char *out, char *in1, char *in2, int n)
{
int i;
for (i=0;i<n;i++)
@@ -224,7 +224,7 @@ static void dohash(char *out, char *in, char *key, int forw)
permute(er, r, perm4, 48);
- xor(erk, er, ki[forw ? i : 15 - i], 48);
+ exor(erk, er, ki[forw ? i : 15 - i], 48);
for (j=0;j<8;j++)
for (k=0;k<6;k++)
@@ -245,7 +245,7 @@ static void dohash(char *out, char *in, char *key, int forw)
cb[j*4+k] = b[j][k];
permute(pcb, cb, perm5, 32);
- xor(r2, l, pcb, 32);
+ exor(r2, l, pcb, 32);
for (j=0;j<32;j++)
l[j] = r[j];
diff --git a/smbencrypt.c b/smbencrypt.c
index a98c63dc..b596587d 100644
--- a/smbencrypt.c
+++ b/smbencrypt.c
@@ -30,13 +30,13 @@ extern int DEBUGLEVEL;
#include <ctype.h>
#include "smbbyteorder.h"
#include "smbdes.h"
+#include "smbencrypt.h"
#include "smbmd4.h"
#ifndef _AIX
typedef unsigned char uchar;
#endif
typedef signed short int16;
-typedef unsigned short uint16;
typedef int BOOL;
#define False 0
#define True 1
diff --git a/smbencrypt.h b/smbencrypt.h
index 0f33b062..03e17d94 100644
--- a/smbencrypt.h
+++ b/smbencrypt.h
@@ -1,2 +1,15 @@
-void SMBencrypt(char *passwd, uint8 *c8, uint8 *p24);
-void SMBNTencrypt(char *passwd, uint8 *c8, uint8 *p24);
+#ifndef SMBENCRYPT_H
+#define SMBENCRYPT_H
+
+#include "smbtypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void SMBencrypt(uint8 *passwd, uint8 *c8, uint8 *p24);
+void SMBNTencrypt(uint8 *passwd, uint8 *c8, uint8 *p24);
+#ifdef __cplusplus
+}
+
+#endif
+#endif
diff --git a/smbutil.c b/smbutil.c
index 74bd5ba2..aa50ed09 100644
--- a/smbutil.c
+++ b/smbutil.c
@@ -197,8 +197,8 @@ void buildSmbNtlmAuthResponse(tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResp
*p = '\0';
}
- SMBencrypt(password, challenge->challengeData, lmRespData);
- SMBNTencrypt(password, challenge->challengeData, ntRespData);
+ SMBencrypt((uint8*)password, challenge->challengeData, lmRespData);
+ SMBNTencrypt((uint8*)password, challenge->challengeData, ntRespData);
response->bufIndex = 0;
memcpy(response->ident,"NTLMSSP\0\0\0",8);
diff --git a/socket.c b/socket.c
index b1119ca5..10cd5d99 100644
--- a/socket.c
+++ b/socket.c
@@ -108,7 +108,7 @@ static char *const *parse_plugin(const char *plugin, const char *host, const cha
}
plugin_copy_len = plugin_len + host_len * host_count + service_len * service_count;
- plugin_copy = malloc(plugin_copy_len + 1);
+ plugin_copy = (char *)malloc(plugin_copy_len + 1);
if (!plugin_copy)
{
report(stderr, GT_("fetchmail: malloc failed\n"));
@@ -134,7 +134,7 @@ static char *const *parse_plugin(const char *plugin, const char *host, const cha
}
plugin_copy[plugin_copy_len] = 0;
- argvec = malloc(s);
+ argvec = (const char **)malloc(s);
if (!argvec)
{
report(stderr, GT_("fetchmail: malloc failed\n"));
@@ -470,7 +470,7 @@ int SockRead(int sock, char *buf, int len)
#ifdef FORCE_STUFFING
maxavailable = n;
#endif
- if ((newline = memchr(bp, '\n', n)) != NULL)
+ if ((newline = (char *)memchr(bp, '\n', n)) != NULL)
n = newline - bp + 1;
#ifndef __BEOS__
if ((n = fm_read(sock, bp, n)) == -1)
diff --git a/strlcat.c b/strlcat.c
index fe3ec105..259500f8 100644
--- a/strlcat.c
+++ b/strlcat.c
@@ -30,10 +30,7 @@
* If retval >= siz, truncation occurred.
*/
size_t
-strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
+strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
diff --git a/strlcpy.c b/strlcpy.c
index baf2c7a7..bb7d4096 100644
--- a/strlcpy.c
+++ b/strlcpy.c
@@ -28,10 +28,7 @@
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
-strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
+strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
diff --git a/transact.c b/transact.c
index d2a241c5..c0719615 100644
--- a/transact.c
+++ b/transact.c
@@ -869,7 +869,7 @@ int readheaders(int sock,
|| !strncasecmp("Bcc:", line, 4)
|| !strncasecmp("Apparently-To:", line, 14))
{
- *to_chainptr = xmalloc(sizeof(struct addrblk));
+ *to_chainptr = (struct addrblk *)xmalloc(sizeof(struct addrblk));
(*to_chainptr)->offset = (line - msgblk.headers);
to_chainptr = &(*to_chainptr)->next;
*to_chainptr = NULL;
@@ -879,7 +879,7 @@ int readheaders(int sock,
|| !strncasecmp("Resent-Cc:", line, 10)
|| !strncasecmp("Resent-Bcc:", line, 11))
{
- *resent_to_chainptr = xmalloc(sizeof(struct addrblk));
+ *resent_to_chainptr = (struct addrblk *)xmalloc(sizeof(struct addrblk));
(*resent_to_chainptr)->offset = (line - msgblk.headers);
resent_to_chainptr = &(*resent_to_chainptr)->next;
*resent_to_chainptr = NULL;
@@ -1476,11 +1476,10 @@ va_dcl
}
}
-int gen_recv(sock, buf, size)
-/* get one line of input from the server */
-int sock; /* socket to which server is connected */
-char *buf; /* buffer to receive input */
-int size; /* length of buffer */
+/** get one line of input from the server */
+int gen_recv(int sock /** socket to which server is connected */,
+ char *buf /* buffer to receive input */,
+ int size /* length of buffer */)
{
int oldphase = phase; /* we don't have to be re-entrant */