From: Richard Russon Date: Sat, 23 Dec 2017 02:10:47 +0000 (+0000) Subject: drop unnecessary FGETCONV typedef X-Git-Tag: neomutt-20180223~66^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7585822c1e1a7440b72a4b4e84b7c9d831b8d3ed;p=neomutt drop unnecessary FGETCONV typedef --- diff --git a/mutt/charset.c b/mutt/charset.c index ecc390fbd..d5d58a0ff 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -227,18 +227,16 @@ const struct MimeNames PreferredMIMENames[] = * mutt_cs_fgetconv_close - Close an fgetconv handle * @param handle fgetconv handle */ -void mutt_cs_fgetconv_close(FGETCONV **handle) +void mutt_cs_fgetconv_close(struct FgetConv **fc) { - struct FgetConv *fc = (struct FgetConv *) *handle; - - if (fc->cd != (iconv_t) -1) - iconv_close(fc->cd); - FREE(handle); + if ((*fc)->cd != (iconv_t) -1) + iconv_close((*fc)->cd); + FREE(fc); } /** * mutt_cs_fgetconv - Convert a file's character set - * @param handle fgetconv handle + * @param fc FgetConv handle * @retval num Next character in the converted file * @retval EOF Error * @@ -246,10 +244,8 @@ void mutt_cs_fgetconv_close(FGETCONV **handle) * Each call to this function will return one converted character. * The buffer is refilled automatically when empty. */ -int mutt_cs_fgetconv(FGETCONV *handle) +int mutt_cs_fgetconv(struct FgetConv *fc) { - struct FgetConv *fc = (struct FgetConv *) handle; - if (!fc) return EOF; if (fc->cd == (iconv_t) -1) @@ -300,22 +296,22 @@ int mutt_cs_fgetconv(FGETCONV *handle) /** * mutt_cs_fgetconvs - Convert a file's charset into a string buffer - * @param buf Buffer for result - * @param l Length of buffer - * @param handle fgetconv handle + * @param buf Buffer for result + * @param l Length of buffer + * @param fc FgetConv handle * @retval ptr Result buffer on success * @retval NULL Error * * Read a file into a buffer, converting the character set as it goes. */ -char *mutt_cs_fgetconvs(char *buf, size_t l, FGETCONV *handle) +char *mutt_cs_fgetconvs(char *buf, size_t l, struct FgetConv *fc) { int c; size_t r; for (r = 0; r + 1 < l;) { - c = mutt_cs_fgetconv(handle); + c = mutt_cs_fgetconv(fc); if (c == EOF) break; buf[r++] = (char) c; diff --git a/mutt/charset.h b/mutt/charset.h index 449d28c9c..ac17bf19f 100644 --- a/mutt/charset.h +++ b/mutt/charset.h @@ -29,10 +29,8 @@ extern char *AssumedCharset; extern char *Charset; -typedef void *FGETCONV; - /** - * struct EgetConv - Cursor for converting a file's encoding + * struct FgetConv - Cursor for converting a file's encoding */ struct FgetConv { @@ -69,9 +67,9 @@ extern const struct MimeNames PreferredMIMENames[]; void mutt_cs_canonical_charset(char *dest, size_t dlen, const char *name); int mutt_cs_chscmp(const char *s, const char *chs); -void mutt_cs_fgetconv_close(FGETCONV **handle); -int mutt_cs_fgetconv(FGETCONV *handle); -char * mutt_cs_fgetconvs(char *buf, size_t l, FGETCONV *handle); +void mutt_cs_fgetconv_close(struct FgetConv **fc); +int mutt_cs_fgetconv(struct FgetConv *fc); +char * mutt_cs_fgetconvs(char *buf, size_t l, struct FgetConv *fc); char * mutt_cs_get_default_charset(void); size_t mutt_cs_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, const char **inrepls, const char *outrepl); void mutt_cs_set_langinfo_charset(void); diff --git a/mutt_charset.c b/mutt_charset.c index f783a6366..366d7e485 100644 --- a/mutt_charset.c +++ b/mutt_charset.c @@ -142,7 +142,7 @@ int mutt_convert_string(char **ps, const char *from, const char *to, int flags) * * Parameter flags is given as-is to mutt_iconv_open(). */ -FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags) +struct FgetConv *fgetconv_open(FILE *file, const char *from, const char *to, int flags) { struct FgetConv *fc = NULL; iconv_t cd = (iconv_t) -1; @@ -163,7 +163,7 @@ FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags) fc = mutt_mem_malloc(sizeof(struct FgetConvNot)); fc->file = file; fc->cd = cd; - return (FGETCONV *) fc; + return fc; } bool mutt_check_charset(const char *s, bool strict) diff --git a/mutt_charset.h b/mutt_charset.h index 72d1742d3..a70efdbd9 100644 --- a/mutt_charset.h +++ b/mutt_charset.h @@ -30,7 +30,7 @@ int mutt_convert_string(char **ps, const char *from, const char *to, int flags); iconv_t mutt_iconv_open(const char *tocode, const char *fromcode, int flags); -FGETCONV *fgetconv_open(FILE *file, const char *from, const char *to, int flags); +struct FgetConv *fgetconv_open(FILE *file, const char *from, const char *to, int flags); /* flags for charset.c:mutt_convert_string(), fgetconv_open(), and * mutt_iconv_open(). Note that applying charset-hooks to tocode is diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index da9d01277..efd08f8e5 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -2436,7 +2436,7 @@ static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset) { char buf[HUGE_STRING]; bool complete, armor_header; - FGETCONV *fc = NULL; + struct FgetConv *fc = NULL; char *fname = NULL; FILE *fp = NULL; @@ -2675,7 +2675,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s) } else if (pgpout) { - FGETCONV *fc = NULL; + struct FgetConv *fc = NULL; int c; rewind(pgpout); fc = fgetconv_open(pgpout, "utf-8", Charset, 0); diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 7d2badf75..d9adcd9d9 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -279,7 +279,7 @@ static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset) char buf[HUGE_STRING]; bool complete, armor_header; - FGETCONV *fc = NULL; + struct FgetConv *fc = NULL; rewind(fpin); @@ -541,7 +541,7 @@ int pgp_application_pgp_handler(struct Body *m, struct State *s) } else if (pgpout) { - FGETCONV *fc = NULL; + struct FgetConv *fc = NULL; int ch; char *expected_charset = gpgcharset && *gpgcharset ? gpgcharset : "utf-8"; @@ -1547,7 +1547,7 @@ struct Body *pgp_traditional_encryptsign(struct Body *a, int flags, char *keylis if (!mutt_cs_is_us_ascii(body_charset)) { int c; - FGETCONV *fc = NULL; + struct FgetConv *fc = NULL; if (flags & ENCRYPT) send_charset = "us-ascii"; diff --git a/sendlib.c b/sendlib.c index e1eed0a67..14cc257ac 100644 --- a/sendlib.c +++ b/sendlib.c @@ -85,7 +85,7 @@ const char MimeSpecials[] = "@.,;:<>[]\\\"()?/= \t"; -static void encode_quoted(FGETCONV *fc, FILE *fout, int istext) +static void encode_quoted(struct FgetConv *fc, FILE *fout, int istext) { int c, linelen = 0; char line[77], savechar; @@ -272,7 +272,7 @@ static void b64_putc(struct B64Context *ctx, char c, FILE *fout) ctx->buffer[ctx->size++] = c; } -static void encode_base64(FGETCONV *fc, FILE *fout, int istext) +static void encode_base64(struct FgetConv *fc, FILE *fout, int istext) { struct B64Context ctx; int ch, ch1 = EOF; @@ -295,7 +295,7 @@ static void encode_base64(FGETCONV *fc, FILE *fout, int istext) fputc('\n', fout); } -static void encode_8bit(FGETCONV *fc, FILE *fout) +static void encode_8bit(struct FgetConv *fc, FILE *fout) { int ch; @@ -431,7 +431,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) char *p, boundary[SHORT_STRING]; char send_charset[SHORT_STRING]; FILE *fpin = NULL; - FGETCONV *fc = NULL; + struct FgetConv *fc = NULL; if (a->type == TYPEMULTIPART) {