X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/93f2d376d5dd2103ee412c708e612109b2336a78..6d7c6175eda3aaa316d1960a89170a285510ad40:/src/src/mime.c diff --git a/src/src/mime.c b/src/src/mime.c index 7b3ec2580..7c6d23df9 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -1,5 +1,3 @@ -/* $Cambridge: exim/src/src/mime.c,v 1.18 2009/11/09 14:31:24 tom Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ @@ -23,9 +21,9 @@ uschar *mime_current_boundary = NULL; give info on detected "problems" in MIME encodings. Those are defined in mime.h. */ -void mime_set_anomaly(int level, char *text) { +void mime_set_anomaly(int level, const char *text) { mime_anomaly_level = level; - mime_anomaly_text = US text; + mime_anomaly_text = CUS text; } @@ -75,9 +73,10 @@ uschar *mime_decode_qp_char(uschar *qp_p, int *c) { /* just dump MIME part without any decoding */ -static int mime_decode_asis(FILE* in, FILE* out, uschar* boundary) +static ssize_t +mime_decode_asis(FILE* in, FILE* out, uschar* boundary) { - int len, size = 0; + ssize_t len, size = 0; uschar buffer[MIME_MAX_LINE_LENGTH]; while(fgets(CS buffer, MIME_MAX_LINE_LENGTH, mime_stream) != NULL) { @@ -97,16 +96,17 @@ static int mime_decode_asis(FILE* in, FILE* out, uschar* boundary) /* decode base64 MIME part */ -static int mime_decode_base64(FILE* in, FILE* out, uschar* boundary) +static ssize_t +mime_decode_base64(FILE* in, FILE* out, uschar* boundary) { uschar ibuf[MIME_MAX_LINE_LENGTH], obuf[MIME_MAX_LINE_LENGTH]; uschar *ipos, *opos; - size_t len, size = 0; + ssize_t len, size = 0; int bytestate = 0; opos = obuf; - while (fgets((char *)ibuf, MIME_MAX_LINE_LENGTH, in) != NULL) + while (Ufgets(ibuf, MIME_MAX_LINE_LENGTH, in) != NULL) { if (boundary != NULL && Ustrncmp(ibuf, "--", 2) == 0 @@ -153,7 +153,7 @@ static int mime_decode_base64(FILE* in, FILE* out, uschar* boundary) return -1; /* error */ size += len; /* copy incomplete last byte to start of obuf, where we continue */ - if (bytestate & 3 != 0) + if ((bytestate & 3) != 0) *obuf = *opos; opos = obuf; } @@ -171,11 +171,12 @@ static int mime_decode_base64(FILE* in, FILE* out, uschar* boundary) /* decode quoted-printable MIME part */ -static int mime_decode_qp(FILE* in, FILE* out, uschar* boundary) +static ssize_t +mime_decode_qp(FILE* in, FILE* out, uschar* boundary) { uschar ibuf[MIME_MAX_LINE_LENGTH], obuf[MIME_MAX_LINE_LENGTH]; uschar *ipos, *opos; - size_t len, size = 0; + ssize_t len, size = 0; while (fgets(CS ibuf, MIME_MAX_LINE_LENGTH, in) != NULL) { @@ -273,8 +274,8 @@ int mime_decode(uschar **listptr) { uschar decode_path[1024]; FILE *decode_file = NULL; long f_pos = 0; - unsigned int size_counter = 0; - int (*decode_function)(FILE*, FILE*, uschar*); + ssize_t size_counter = 0; + ssize_t (*decode_function)(FILE*, FILE*, uschar*); if (mime_stream == NULL) return FAIL;