* 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
*
* 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)
/**
* 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;
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
{
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);
*
* 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;
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)
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
{
char buf[HUGE_STRING];
bool complete, armor_header;
- FGETCONV *fc = NULL;
+ struct FgetConv *fc = NULL;
char *fname = NULL;
FILE *fp = NULL;
}
else if (pgpout)
{
- FGETCONV *fc = NULL;
+ struct FgetConv *fc = NULL;
int c;
rewind(pgpout);
fc = fgetconv_open(pgpout, "utf-8", Charset, 0);
char buf[HUGE_STRING];
bool complete, armor_header;
- FGETCONV *fc = NULL;
+ struct FgetConv *fc = NULL;
rewind(fpin);
}
else if (pgpout)
{
- FGETCONV *fc = NULL;
+ struct FgetConv *fc = NULL;
int ch;
char *expected_charset =
gpgcharset && *gpgcharset ? gpgcharset : "utf-8";
if (!mutt_cs_is_us_ascii(body_charset))
{
int c;
- FGETCONV *fc = NULL;
+ struct FgetConv *fc = NULL;
if (flags & ENCRYPT)
send_charset = "us-ascii";
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;
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;
fputc('\n', fout);
}
-static void encode_8bit(FGETCONV *fc, FILE *fout)
+static void encode_8bit(struct FgetConv *fc, FILE *fout)
{
int ch;
char *p, boundary[SHORT_STRING];
char send_charset[SHORT_STRING];
FILE *fpin = NULL;
- FGETCONV *fc = NULL;
+ struct FgetConv *fc = NULL;
if (a->type == TYPEMULTIPART)
{