Commit 0e82e55d authored by Thomas Roessler's avatar Thomas Roessler

Fix iconv warnings; from Edmund Grimley Evans.

parent dd1a199f
......@@ -288,7 +288,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;
......@@ -338,12 +338,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;
......@@ -358,10 +358,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;
......@@ -406,7 +406,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)
......@@ -415,10 +415,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))
......@@ -464,7 +464,7 @@ struct fgetconv_s
char *ob;
char *ib;
size_t ibl;
const char **inrepls;
ICONV_CONST char **inrepls;
};
struct fgetconv_not
......@@ -477,7 +477,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);
......@@ -515,7 +515,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)++;
}
......@@ -539,7 +539,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)++;
......
......@@ -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;
......
......@@ -91,7 +91,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;
......
......@@ -79,7 +79,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;
......
......@@ -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];
......
......@@ -47,10 +47,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)
{
......@@ -150,7 +150,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;
......@@ -191,7 +191,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";
......@@ -227,13 +227,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;
......@@ -305,7 +305,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;
......@@ -363,7 +363,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)
{
......
......@@ -673,7 +673,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment