From: Pierre Habouzit Date: Sat, 28 Oct 2006 00:25:32 +0000 (+0200) Subject: use a proper "hack" for iconv functions: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=5e53f9e5f65aa5b3af6f5af9d868403536534afb;hp=59926571aaec3e38cec09d0d9fa34f4a4b887309 use a proper "hack" for iconv functions: - use macros instead of empty functions (WTF?) when we don't have iconv enabled. - use my_iconv (static inline) responsible of unconstifying some argument, so that we can work with constness correctly. various fixes. --- diff --git a/charset.c b/charset.c index 63bc81c..14e79f4 100644 --- a/charset.c +++ b/charset.c @@ -253,27 +253,6 @@ int mutt_chscmp (const char *s, const char *chs) } -#ifndef HAVE_ICONV - -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, - char **outbuf, size_t * outbytesleft) -{ - return 0; -} - -int iconv_close (iconv_t cd) -{ - return 0; -} - -#endif /* !HAVE_ICONV */ - - /* * Like iconv_open, but canonicalises the charsets */ @@ -326,7 +305,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft, size_t obl = *outbytesleft; for (;;) { - ret1 = iconv (cd, &ib, &ibl, &ob, &obl); + ret1 = my_iconv(cd, &ib, &ibl, &ob, &obl); if (ret1 != (size_t) - 1) ret += ret1; if (ibl && obl && errno == EILSEQ) { @@ -340,7 +319,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft, char *ob1 = ob; size_t obl1 = obl; - iconv (cd, &ib1, &ibl1, &ob1, &obl1); + my_iconv(cd, &ib1, &ibl1, &ob1, &obl1); if (!ibl1) { ++ib, --ibl; ob = ob1, obl = obl1; @@ -354,7 +333,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft, /* Replace the output */ if (!outrepl) outrepl = "?"; - iconv (cd, 0, 0, &ob, &obl); + my_iconv(cd, 0, 0, &ob, &obl); if (obl) { int n = str_len (outrepl); @@ -366,7 +345,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft, ++ib, --ibl; ob += n, obl -= n; ++ret; - iconv (cd, 0, 0, 0, 0); /* for good measure */ + my_iconv(cd, 0, 0, 0, 0); /* for good measure */ continue; } } @@ -512,7 +491,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); + my_iconv(fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob, &obl); if (fc->p < fc->ob) return (unsigned char) *(fc->p)++; } @@ -584,8 +563,8 @@ static size_t convert_string (const char *f, size_t flen, return (size_t) (-1); obl = 4 * flen + 1; ob = buf = mem_malloc (obl); - n = iconv (cd, &f, &flen, &ob, &obl); - if (n == (size_t) (-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) { + n = my_iconv(cd, &f, &flen, &ob, &obl); + if (n == (size_t) (-1) || my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) { e = errno; mem_free (&buf); iconv_close (cd); diff --git a/charset.h b/charset.h index bba1605..9cbd2bd 100644 --- a/charset.h +++ b/charset.h @@ -19,9 +19,15 @@ typedef void *iconv_t; #endif #ifndef HAVE_ICONV - iconv_t iconv_open (const char *, const char *); -size_t iconv (iconv_t, const char **, size_t *, char **, size_t *); -int iconv_close (iconv_t); +# define iconv_open(a, b) ((iconv_t)(-1)) +# define my_iconv(a,b,c,d,e) 0 +# define iconv_close(a) 0 +#else +static inline size_t my_iconv(iconv_t ict, const char **inbuf, size_t *ilen, + char **outbuf, size_t *olen) +{ + return iconv(ict, (char **)inbuf, ilen, outbuf, olen); +} #endif int mutt_convert_string (char **, const char *, const char *, int); diff --git a/gnupgparse.c b/gnupgparse.c index e4f0a57..1f8a0a3 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -90,7 +90,7 @@ static void fix_uid (char *uid) buf = mem_malloc (n + 1); ib = uid, ibl = d - uid + 1, ob = buf, obl = n; - iconv (cd, &ib, &ibl, &ob, &obl); + my_iconv(cd, &ib, &ibl, &ob, &obl); if (!ibl) { if (ob - buf < n) { memcpy (uid, buf, ob - buf); diff --git a/handler.c b/handler.c index 06a1fcd..53b519a 100644 --- a/handler.c +++ b/handler.c @@ -583,7 +583,7 @@ static void enriched_putc (int c, struct enriched_state *stte) } } -static void enriched_puts (char *s, struct enriched_state *stte) +static void enriched_puts (const char *s, struct enriched_state *stte) { char *c; diff --git a/hash.c b/hash.c index 72225be..0e2192b 100644 --- a/hash.c +++ b/hash.c @@ -77,7 +77,7 @@ HASH *hash_resize (HASH * ptr, int nelem) * data data to associate with `key' * allow_dup if nonzero, duplicate keys are allowed in the table */ -int hash_insert (HASH * table, const char *key, void *data, int allow_dup) +int hash_insert (HASH * table, const char *key, const void *data, int allow_dup) { struct hash_elem *ptr; int h; diff --git a/hash.h b/hash.h index 1a4f985..3c072c1 100644 --- a/hash.h +++ b/hash.h @@ -27,7 +27,7 @@ typedef struct { HASH *hash_create (int nelem); int hash_string (const unsigned char *s, int n); -int hash_insert (HASH * table, const char *key, void *data, int allow_dup); +int hash_insert (HASH * table, const char *key, const void *data, int allow_dup); HASH *hash_resize (HASH * table, int nelem); void *hash_find_hash (const HASH * table, int hash, const char *key); void hash_delete_hash (HASH * table, int hash, const char *key, diff --git a/init.c b/init.c index c32e551..e8c3b0a 100644 --- a/init.c +++ b/init.c @@ -257,7 +257,7 @@ static void user_to_string (char* dst, size_t dstlen, static void sys_to_string (char* dst, size_t dstlen, struct option_t* option) { - char* val = NULL, *t = NULL; + char *val = NULL, *t = NULL; int clean = 0; /* get some $muttng_ values dynamically */ @@ -2220,7 +2220,7 @@ char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed try == user entered data for completion. len == length of dest buffer. */ -static void candidate (char *dest, char *try, char *src, int len) +static void candidate (char *dest, char *try, const char *src, int len) { int l; @@ -2285,7 +2285,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) || !str_ncmp (buffer, "unset", 5) || !str_ncmp (buffer, "reset", 5) || !str_ncmp (buffer, "toggle", 6)) { /* complete variables */ - char *prefixes[] = { "no", "inv", "?", "&", 0 }; + const char *prefixes[] = { "no", "inv", "?", "&", NULL }; pt++; /* loop through all the possible prefixes (no, inv, ...) */ @@ -2408,7 +2408,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos) char tmp[LONG_STRING], tmp2[LONG_STRING]; char *s, *d; size_t dlen = buffer + len - pt - spaces; - char *vals[] = { "no", "yes", "ask-no", "ask-yes" }; + const char *vals[] = { "no", "yes", "ask-no", "ask-yes" }; tmp[0] = '\0'; @@ -2458,7 +2458,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos) "", p); } else if (DTYPE (option->type) == DT_MAGIC) { - char *p; + const char *p; switch (DefaultMagic) { case M_MBOX: p = "mbox"; @@ -2529,7 +2529,7 @@ int mutt_query_variables (LIST * queries) return 0; } -char *mutt_getnamebyvalue (int val, const struct mapping_t *map) +const char *mutt_getnamebyvalue (int val, const struct mapping_t *map) { int i; @@ -2573,7 +2573,8 @@ void mutt_init (int skip_sys_rc, LIST * commands) { struct passwd *pw; struct utsname utsname; - char *p, buffer[STRING], error[STRING]; + const char *p; + char buffer[STRING], error[STRING]; int i, default_rc = 0, need_pause = 0; BUFFER err; @@ -2661,18 +2662,17 @@ void mutt_init (int skip_sys_rc, LIST * commands) #ifdef USE_NNTP { FILE *f; - char *i; + char *q; if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) { buffer[0] = '\0'; fgets (buffer, sizeof (buffer), f); - p = (char*) &buffer; + p = (char*)&buffer; SKIPWS (p); - i = p; - while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') - && (*i != '\n')) - i++; - *i = '\0'; + q = p; + while (*q && !isspace(*q)) + q++; + *q = '\0'; NewsServer = str_dup (p); fclose (f); } diff --git a/init.h b/init.h index 37e3112..f411a0f 100644 --- a/init.h +++ b/init.h @@ -3854,7 +3854,7 @@ struct option_t const MuttVars[] = { */ #endif /*--*/ - { NULL } + { NULL, -1, R_NONE, -1, NULL } }; static const char* Features[] = { @@ -3968,14 +3968,14 @@ const struct mapping_t SortBrowserMethods[] = { {"date", SORT_DATE}, {"size", SORT_SIZE}, {"unsorted", SORT_ORDER}, - {NULL} + {NULL, 0} }; const struct mapping_t SortAliasMethods[] = { {"alias", SORT_ALIAS}, {"address", SORT_ADDRESS}, {"unsorted", SORT_ORDER}, - {NULL} + {NULL, 0} }; const struct mapping_t SortKeyMethods[] = { @@ -3983,7 +3983,7 @@ const struct mapping_t SortKeyMethods[] = { {"date", SORT_DATE}, {"keyid", SORT_KEYID}, {"trust", SORT_TRUST}, - {NULL} + {NULL, 0} }; @@ -4087,5 +4087,5 @@ struct command_t Commands[] = { {"unscore", mutt_parse_unscore, 0}, {"unset", parse_set, M_SET_UNSET}, {"unsubscribe", parse_unsubscribe, 0}, - {NULL} + {NULL, NULL, 0} }; diff --git a/keymap.c b/keymap.c index b480455..2219c68 100644 --- a/keymap.c +++ b/keymap.c @@ -184,7 +184,7 @@ static int parsekeys (char *str, keycode_t * d, int max) /* insert a key sequence into the specified map. the map is sorted by ASCII * value (lowest to highest) */ -void km_bind (char *s, int menu, int op, char *macro, char *descr) +void km_bind (const char *s, int menu, int op, char *macro, char *descr) { struct keymap_t *map, *tmp, *last = NULL, *next; keycode_t buf[MAX_SEQ]; @@ -241,7 +241,7 @@ void km_bind (char *s, int menu, int op, char *macro, char *descr) Keymaps[menu] = map; } -void km_bindkey (char *s, int menu, int op) +void km_bindkey (const char *s, int menu, int op) { km_bind (s, menu, op, NULL, NULL); } diff --git a/keymap.h b/keymap.h index 3668f18..45829b6 100644 --- a/keymap.h +++ b/keymap.h @@ -21,8 +21,8 @@ /* type for key storage, the rest of mutt works fine with int type */ typedef short keycode_t; -void km_bind (char *, int, int, char *, char *); -void km_bindkey (char *, int, int); +void km_bind (const char *, int, int, char *, char *); +void km_bindkey (const char *, int, int); int km_dokey (int); /* entry in the keymap tree */ @@ -82,9 +82,9 @@ extern int LastKey; extern struct mapping_t Menus[]; struct binding_t { - char *name; /* name of the function */ - int op; /* function id number */ - char *seq; /* default key binding */ + const char *name; /* name of the function */ + int op; /* function id number */ + const char *seq; /* default key binding */ }; struct binding_t *km_get_table (int menu); diff --git a/mapping.h b/mapping.h index 3872f77..5b0302e 100644 --- a/mapping.h +++ b/mapping.h @@ -15,7 +15,7 @@ struct mapping_t { int value; }; -char *mutt_getnamebyvalue (int, const struct mapping_t *); +const char *mutt_getnamebyvalue (int, const struct mapping_t *); char *mutt_compile_help (char *, size_t, int, struct mapping_t *); int mutt_getvaluebyname (const char *, const struct mapping_t *); diff --git a/mbyte.c b/mbyte.c index 6993422..c9f3540 100644 --- a/mbyte.c +++ b/mbyte.c @@ -102,14 +102,14 @@ static size_t wcrtomb_iconv (char *s, wchar_t wc, iconv_t cd) ib = buf; ob = s; obl = MB_LEN_MAX; - r = iconv (cd, &ib, &ibl, &ob, &obl); + r = my_iconv(cd, &ib, &ibl, &ob, &obl); } else { ib = ""; ibl = 1; ob = buf; obl = sizeof (buf); - r = iconv (cd, &ib, &ibl, &ob, &obl); + r = my_iconv(cd, &ib, &ibl, &ob, &obl); } return ob - s; } @@ -168,7 +168,7 @@ size_t mbrtowc_iconv (wchar_t * pwc, const char *s, size_t n, ibl = 1; for (;;) { - r = iconv (cd, &ib, &ibl, &ob, &obl); + r = my_iconv(cd, &ib, &ibl, &ob, &obl); if (ob > bufo && (!k || ib > bufi + k)) { /* we have a character */ memset (ps, 0, sizeof (*ps)); diff --git a/mh.c b/mh.c index 47231ed..cfe7c36 100644 --- a/mh.c +++ b/mh.c @@ -837,7 +837,7 @@ static struct maildir *maildir_sort_inode (struct maildir *list) } #endif /* USE_INODESORT */ -#if USE_HCACHE +#ifdef USE_HCACHE static size_t maildir_hcache_keylen (const char *fn) { const char *p = strchr (fn, ':'); @@ -856,7 +856,7 @@ void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md) char fn[_POSIX_PATH_MAX]; int count; -#if USE_HCACHE +#ifdef USE_HCACHE void *hc = NULL; void *data; struct timeval *when = NULL; @@ -870,7 +870,7 @@ void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md) if (!(p && p->h && !p->header_parsed)) continue; -#if USE_HCACHE +#ifdef USE_HCACHE data = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen); when = (struct timeval *) data; #endif @@ -879,7 +879,7 @@ void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md) mutt_message (_("Reading %s... %d"), ctx->path, count); snprintf (fn, sizeof (fn), "%s/%s", ctx->path, p->h->path); -#if USE_HCACHE +#ifdef USE_HCACHE if (option (OPTHCACHEVERIFY)) { ret = stat (fn, &lastchanged); } @@ -897,17 +897,17 @@ void maildir_delayed_parsing (CONTEXT * ctx, struct maildir *md) if (maildir_parse_message (ctx->magic, fn, p->h->old, p->h)) { p->header_parsed = 1; maildir_parse_flags (p->h, fn); -#if USE_HCACHE +#ifdef USE_HCACHE mutt_hcache_store (hc, p->h->path + 3, p->h, 0, &maildir_hcache_keylen); #endif } else mutt_free_header (&p->h); -#if USE_HCACHE +#ifdef USE_HCACHE mem_free (&data); #endif } -#if USE_HCACHE +#ifdef USE_HCACHE mutt_hcache_close (hc); #endif } @@ -1385,7 +1385,7 @@ static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) char path[_POSIX_PATH_MAX], tmp[_POSIX_PATH_MAX]; int i, j; -#if USE_HCACHE +#ifdef USE_HCACHE void *hc = NULL; #endif /* USE_HCACHE */ @@ -1397,7 +1397,7 @@ static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) if (i != 0) return i; -#if USE_HCACHE +#ifdef USE_HCACHE if (ctx->magic == M_MAILDIR) hc = mutt_hcache_open (HeaderCache, ctx->path); #endif /* USE_HCACHE */ @@ -1408,7 +1408,7 @@ static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path); if (ctx->magic == M_MAILDIR || (option (OPTMHPURGE) && ctx->magic == M_MH)) { -#if USE_HCACHE +#ifdef USE_HCACHE if (ctx->magic == M_MAILDIR) mutt_hcache_delete (hc, ctx->hdrs[i]->path + 3, &maildir_hcache_keylen); @@ -1441,7 +1441,7 @@ static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) } } -#if USE_HCACHE +#ifdef USE_HCACHE if (ctx->magic == M_MAILDIR) mutt_hcache_close (hc); #endif /* USE_HCACHE */ @@ -1466,7 +1466,7 @@ static int mh_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) return 0; err: -#if USE_HCACHE +#ifdef USE_HCACHE if (ctx->magic == M_MAILDIR) mutt_hcache_close (hc); #endif /* USE_HCACHE */ diff --git a/mutt.h b/mutt.h index e8d53e6..10dfd10 100644 --- a/mutt.h +++ b/mutt.h @@ -848,7 +848,7 @@ typedef struct { typedef struct { char *major; int major_int; - char *minor; + const char *minor; regex_t minor_rx; } ATTACH_MATCH; diff --git a/muttlib.c b/muttlib.c index 931c98b..24f4ef3 100644 --- a/muttlib.c +++ b/muttlib.c @@ -259,27 +259,27 @@ int mutt_matches_ignore (const char *s, LIST * t) return 0; } -/* prepend the path part of *path to *link */ -void mutt_expand_link (char *newpath, const char *path, const char *link) +/* prepend the path part of *path to *lnk */ +void mutt_expand_link (char *newpath, const char *path, const char *lnk) { const char *lb = NULL; size_t len; - /* link is full path */ - if (*link == '/') { - strfcpy (newpath, link, _POSIX_PATH_MAX); + /* lnk is full path */ + if (*lnk == '/') { + strfcpy (newpath, lnk, _POSIX_PATH_MAX); return; } if ((lb = strrchr (path, '/')) == NULL) { - /* no path in link */ - strfcpy (newpath, link, _POSIX_PATH_MAX); + /* no path in lnk */ + strfcpy (newpath, lnk, _POSIX_PATH_MAX); return; } len = lb - path + 1; memcpy (newpath, path, len); - strfcpy (newpath + len, link, _POSIX_PATH_MAX - len); + strfcpy (newpath + len, lnk, _POSIX_PATH_MAX - len); } char *mutt_expand_path (char *s, size_t slen) @@ -294,7 +294,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) char tmp[_POSIX_PATH_MAX]; char *t; - char *tail = ""; + const char *tail = ""; int recurse = 0; @@ -1050,12 +1050,12 @@ void mutt_FormatString (char *dest, /* output buffer */ break; /* skip rest of input */ } else { - short tolower = 0; + short lower = 0; short nodots = 0; while (ch == '_' || ch == ':') { if (ch == '_') - tolower = 1; + lower = 1; else if (ch == ':') nodots = 1; @@ -1067,7 +1067,7 @@ void mutt_FormatString (char *dest, /* output buffer */ callback (buf, sizeof (buf), ch, src, prefix, ifstring, elsestring, data, flags); - if (tolower) + if (lower) str_tolower (buf); if (nodots) { char *p = buf; @@ -1145,32 +1145,32 @@ void mutt_FormatString (char *dest, /* output buffer */ then we assume it is a commmand to run instead of a normal file. */ FILE *mutt_open_read (const char *path, pid_t * thepid) { - FILE *f; - struct stat s; - - int len = str_len (path); - - if (path[len - 1] == '|') { - /* read from a pipe */ - - char *s = str_dup (path); - - s[len - 1] = 0; - mutt_endwin (NULL); - *thepid = mutt_create_filter (s, NULL, &f, NULL); - mem_free (&s); - } - else { - if (stat (path, &s) < 0) - return (NULL); - if (S_ISDIR (s.st_mode)) { - errno = EINVAL; - return (NULL); + int len = str_len (path); + FILE *f; + + if (path[len - 1] == '|') { + char *s = str_dup (path); + + /* read from a pipe */ + + s[len - 1] = 0; + mutt_endwin (NULL); + *thepid = mutt_create_filter (s, NULL, &f, NULL); + mem_free (&s); + } else { + struct stat st; + + if (stat (path, &st) < 0) + return (NULL); + if (S_ISDIR (st.st_mode)) { + errno = EINVAL; + return (NULL); + } + f = fopen (path, "r"); + *thepid = -1; } - f = fopen (path, "r"); - *thepid = -1; - } - return (f); + + return (f); } /* returns 0 if OK to proceed, -1 to abort, 1 to retry */ diff --git a/protos.h b/protos.h index 0fc9575..688e32f 100644 --- a/protos.h +++ b/protos.h @@ -373,11 +373,11 @@ extern char *sys_errlist[]; #define memmove(d,s,n) bcopy((s),(d),(n)) #endif +#ifdef _AIX /* AIX doesn't define these in any headers (sigh) */ int strcasecmp (const char *, const char *); int strncasecmp (const char *, const char *, size_t); -#ifdef _AIX int setegid (gid_t); #endif /* _AIX */ diff --git a/rfc2047.c b/rfc2047.c index d4e7d6a..a81a849 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -63,8 +63,8 @@ static size_t convert_string (const char *f, size_t flen, return (size_t) (-1); obl = 4 * flen + 1; ob = buf = mem_malloc (obl); - n = iconv (cd, &f, &flen, &ob, &obl); - if (n == (size_t) (-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) { + n = my_iconv(cd, &f, &flen, &ob, &obl); + if (n == (size_t) (-1) || my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) { e = errno; mem_free (&buf); iconv_close (cd); @@ -230,8 +230,8 @@ static size_t try_block (const char *d, size_t dlen, cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode); - if (iconv (cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) || - iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) { + if (my_iconv(cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) || + my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) { assert (errno == E2BIG); iconv_close (cd); assert (ib > d); @@ -296,8 +296,8 @@ static size_t encode_block (char *s, char *d, size_t dlen, cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode); - n1 = iconv (cd, &ib, &ibl, &ob, &obl); - n2 = iconv (cd, 0, 0, &ob, &obl); + n1 = my_iconv(cd, &ib, &ibl, &ob, &obl); + n2 = my_iconv(cd, 0, 0, &ob, &obl); assert (n1 != (size_t) (-1) && n2 != (size_t) (-1)); iconv_close (cd); return (*encoder) (s, buf1, ob - buf1, tocode); diff --git a/sendlib.c b/sendlib.c index 4571e7a..dd633de 100644 --- a/sendlib.c +++ b/sendlib.c @@ -639,7 +639,7 @@ static size_t convert_file_to (FILE * file, const char *fromcode, /* Convert to UTF-8 */ ib = bufi; ob = bufu, obl = sizeof (bufu); - n = iconv (cd1, ibl ? &ib : 0, &ibl, &ob, &obl); + n = my_iconv(cd1, ibl ? &ib : 0, &ibl, &ob, &obl); assert (n == (size_t) (-1) || !n || ICONV_NONTRANS); if (n == (size_t) (-1) && ((errno != EINVAL && errno != E2BIG) || ib == bufi)) { @@ -655,7 +655,7 @@ static size_t convert_file_to (FILE * file, const char *fromcode, if (cd[i] != (iconv_t) (-1) && score[i] != (size_t) (-1)) { ub = bufu, ubl = ubl1; ob = bufo, obl = sizeof (bufo); - n = iconv (cd[i], (ibl || ubl) ? &ub : 0, &ubl, &ob, &obl); + n = my_iconv(cd[i], (ibl || ubl) ? &ub : 0, &ubl, &ob, &obl); if (n == (size_t) (-1)) { assert (errno == E2BIG || (BUGGY_ICONV && (errno == EILSEQ || errno == ENOENT))); diff --git a/state.c b/state.c index 3e10619..ca73d4a 100644 --- a/state.c +++ b/state.c @@ -38,7 +38,7 @@ void mutt_convert_to_state (iconv_t cd, char *bufi, size_t * l, STATE * s) if (!bufi) { if (cd != (iconv_t) (-1)) { ob = bufo, obl = sizeof (bufo); - iconv (cd, 0, 0, &ob, &obl); + my_iconv(cd, 0, 0, &ob, &obl); if (ob != bufo) state_prefix_put (bufo, ob - bufo, s); }