From: Thomas Roessler Date: Tue, 26 Mar 2002 09:50:06 +0000 (+0000) Subject: Fix iconv warnings; from Edmund Grimley Evans. X-Git-Tag: mutt-1-5-1-rel~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=859ba2a012d5a23d1c3c68d8941dd68566da97ce;p=mutt Fix iconv warnings; from Edmund Grimley Evans. --- diff --git a/charset.c b/charset.c index b347773e..228c6bda 100644 --- a/charset.c +++ b/charset.c @@ -286,7 +286,7 @@ iconv_t iconv_open (const char *tocode, const char *fromcode) return (iconv_t)(-1); } -size_t iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, +size_t iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { return 0; @@ -336,12 +336,12 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags) * if you're supplying an outrepl, the target charset should be. */ -size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, +size_t mutt_iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, - const char **inrepls, const char *outrepl) + ICONV_CONST char **inrepls, const char *outrepl) { size_t ret = 0, ret1; - const char *ib = *inbuf; + ICONV_CONST char *ib = *inbuf; size_t ibl = *inbytesleft; char *ob = *outbuf; size_t obl = *outbytesleft; @@ -356,10 +356,10 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, if (inrepls) { /* Try replacing the input */ - const char **t; + ICONV_CONST char **t; for (t = inrepls; *t; t++) { - const char *ib1 = *t; + ICONV_CONST char *ib1 = *t; size_t ibl1 = strlen (*t); char *ob1 = ob; size_t obl1 = obl; @@ -404,7 +404,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, int mutt_convert_string (char **ps, const char *from, const char *to, int flags) { iconv_t cd; - const char *repls[] = { "\357\277\275", "?", 0 }; + ICONV_CONST char *repls[] = { "\357\277\275", "?", 0 }; char *s = *ps; if (!s || !*s) @@ -413,10 +413,10 @@ int mutt_convert_string (char **ps, const char *from, const char *to, int flags) if (to && from && (cd = mutt_iconv_open (to, from, flags)) != (iconv_t)-1) { int len; - const char *ib; + ICONV_CONST char *ib; char *buf, *ob; size_t ibl, obl; - const char **inrepls = 0; + ICONV_CONST char **inrepls = 0; char *outrepl = 0; if (mutt_is_utf8 (to)) @@ -462,7 +462,7 @@ struct fgetconv_s char *ob; char *ib; size_t ibl; - const char **inrepls; + ICONV_CONST char **inrepls; }; struct fgetconv_not @@ -475,7 +475,7 @@ FGETCONV *fgetconv_open (FILE *file, const char *from, const char *to, int flags { struct fgetconv_s *fc; iconv_t cd = (iconv_t)-1; - static const char *repls[] = { "\357\277\275", "?", 0 }; + static ICONV_CONST char *repls[] = { "\357\277\275", "?", 0 }; if (from && to) cd = mutt_iconv_open (to, from, flags); @@ -513,7 +513,7 @@ int fgetconv (FGETCONV *_fc) if (fc->ibl) { size_t obl = sizeof (fc->bufo); - iconv (fc->cd, (const char **)&fc->ib, &fc->ibl, &fc->ob, &obl); + iconv (fc->cd, (ICONV_CONST char **)&fc->ib, &fc->ibl, &fc->ob, &obl); if (fc->p < fc->ob) return (unsigned char)*(fc->p)++; } @@ -537,7 +537,7 @@ int fgetconv (FGETCONV *_fc) if (fc->ibl) { size_t obl = sizeof (fc->bufo); - mutt_iconv (fc->cd, (const char **)&fc->ib, &fc->ibl, &fc->ob, &obl, + mutt_iconv (fc->cd, (ICONV_CONST char **)&fc->ib, &fc->ibl, &fc->ob, &obl, fc->inrepls, 0); if (fc->p < fc->ob) return (unsigned char)*(fc->p)++; diff --git a/charset.h b/charset.h index ca2efbab..364c3d5b 100644 --- a/charset.h +++ b/charset.h @@ -24,7 +24,7 @@ int mutt_convert_string (char **, const char *, const char *, int); iconv_t mutt_iconv_open (const char *, const char *, int); -size_t mutt_iconv (iconv_t, const char **, size_t *, char **, size_t *, const char **, const char *); +size_t mutt_iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *, ICONV_CONST char **, const char *); typedef void * FGETCONV; diff --git a/gnupgparse.c b/gnupgparse.c index bf0e2e60..01a0a6b5 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -90,7 +90,7 @@ static void fix_uid (char *uid) { int n = s - uid + 1; /* chars available in original buffer */ char *buf; - const char *ib; + ICONV_CONST char *ib; char *ob; size_t ibl, obl; diff --git a/handler.c b/handler.c index 2b1e661d..a09ed403 100644 --- a/handler.c +++ b/handler.c @@ -83,7 +83,7 @@ static void state_prefix_put (const char *d, size_t dlen, STATE *s) static void convert_to_state(iconv_t cd, char *bufi, size_t *l, STATE *s) { char bufo[BUFO_SIZE]; - const char *ib; + ICONV_CONST char *ib; char *ob; size_t ibl, obl; diff --git a/mbyte.c b/mbyte.c index 8c71aea9..57f6e8b2 100644 --- a/mbyte.c +++ b/mbyte.c @@ -93,7 +93,7 @@ void mutt_set_charset (char *charset) static size_t wcrtomb_iconv (char *s, wchar_t wc, iconv_t cd) { char buf[MB_LEN_MAX]; - const char *ib; + ICONV_CONST char *ib; char *ob; size_t ibl, obl, r; @@ -144,7 +144,7 @@ size_t mbrtowc_iconv (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps, iconv_t cd) { static mbstate_t mbstate; - const char *ib, *ibmax; + ICONV_CONST char *ib, *ibmax; char *ob, *t; size_t ibl, obl, k, r; char bufi[8], bufo[6]; diff --git a/rfc2047.c b/rfc2047.c index f988c85d..e7c4d725 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -46,10 +46,10 @@ extern char RFC822Specials[]; -typedef size_t (*encoder_t) (char *, const char *, size_t, +typedef size_t (*encoder_t) (char *, ICONV_CONST char *, size_t, const char *); -static size_t convert_string (const char *f, size_t flen, +static size_t convert_string (ICONV_CONST char *f, size_t flen, const char *from, const char *to, char **t, size_t *tlen) { @@ -149,7 +149,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, return tocode; } -static size_t b_encoder (char *s, const char *d, size_t dlen, +static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen, const char *tocode) { char *s0 = s; @@ -190,7 +190,7 @@ static size_t b_encoder (char *s, const char *d, size_t dlen, return s - s0; } -static size_t q_encoder (char *s, const char *d, size_t dlen, +static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen, const char *tocode) { char hex[] = "0123456789ABCDEF"; @@ -226,13 +226,13 @@ static size_t q_encoder (char *s, const char *d, size_t dlen, * tocode, unless fromcode is 0, in which case the data is assumed to * be already in tocode, which should be 8-bit and stateless. */ -static size_t try_block (const char *d, size_t dlen, +static size_t try_block (ICONV_CONST char *d, size_t dlen, const char *fromcode, const char *tocode, encoder_t *encoder, size_t *wlen) { char buf1[ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1]; iconv_t cd; - const char *ib; + ICONV_CONST char *ib; char *ob, *p; size_t ibl, obl; int count, len, len_b, len_q; @@ -304,7 +304,7 @@ static size_t encode_block (char *s, char *d, size_t dlen, { char buf1[ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1]; iconv_t cd; - const char *ib; + ICONV_CONST char *ib; char *ob; size_t ibl, obl, n1, n2; @@ -362,7 +362,7 @@ static size_t choose_block (char *d, size_t dlen, int col, * The input data is assumed to be a single line starting at column col; * if col is non-zero, the preceding character was a space. */ -static int rfc2047_encode (const char *d, size_t dlen, int col, +static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, const char *fromcode, const char *charsets, char **e, size_t *elen, char *specials) { diff --git a/sendlib.c b/sendlib.c index 2c36cc58..3a12709a 100644 --- a/sendlib.c +++ b/sendlib.c @@ -678,7 +678,7 @@ static size_t convert_file_to (FILE *file, const char *fromcode, { iconv_t cd1, *cd; char bufi[256], bufu[512], bufo[4 * sizeof (bufi)]; - const char *ib, *ub; + ICONV_CONST char *ib, *ub; char *ob; size_t ibl, obl, ubl, ubl1, n, ret; int i;