about summary refs log tree commit diff
path: root/rfc2045.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 21:56:16 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 21:56:16 +0200
commite57d1b319282973949d10372a6e13db625d20fef (patch)
tree9f10cada91809a36131fe80c497fb0fd5a9abf7d /rfc2045.c
parent4798cb386e7a436a2071b4101df8a2f8e4c1d21c (diff)
downloadmblaze-e57d1b319282973949d10372a6e13db625d20fef.tar.gz
mblaze-e57d1b319282973949d10372a6e13db625d20fef.tar.xz
mblaze-e57d1b319282973949d10372a6e13db625d20fef.zip
rfc2045: new parameter for blaze822_mime_body to allow freeing of new chunk
Diffstat (limited to 'rfc2045.c')
-rw-r--r--rfc2045.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/rfc2045.c b/rfc2045.c
index 8f913a1..e5e19ff 100644
--- a/rfc2045.c
+++ b/rfc2045.c
@@ -16,7 +16,8 @@ blaze822_check_mime(struct message *msg)
 }
 
 int
-blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno)
+blaze822_mime_body(struct message *msg,
+    char **cto, char **bodyo, size_t *bodyleno, char **bodychunko)
 {
 	if (!msg->body || !msg->bodyend) {
 		*bodyo = 0;
@@ -37,16 +38,20 @@ blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyle
 	*cto = ct;
 
 	if (cte) {
-		if (strncasecmp(cte, "quoted-printable", 16) == 0)
+		if (strncasecmp(cte, "quoted-printable", 16) == 0) {
 			blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno);
-		else if (strncasecmp(cte, "base64", 6) == 0)
+			*bodychunko = *bodyo;
+		} else if (strncasecmp(cte, "base64", 6) == 0) {
 			blaze822_decode_b64(msg->body, msg->bodyend, bodyo, bodyleno);
-		else
+			*bodychunko = *bodyo;
+		} else {
 			cte = 0;
+		}
 	}
 	if (!cte) {
 		*bodyo = msg->body;
 		*bodyleno = msg->bodyend - msg->body;
+		*bodychunko = 0;
 	}
 
 	return 1;