[dovecot-cvs] dovecot/src/lib-mail quoted-printable.c,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Sat Feb 8 08:33:32 EET 2003


Update of /home/cvs/dovecot/src/lib-mail
In directory danu:/tmp/cvs-serv3336

Modified Files:
	quoted-printable.c 
Log Message:
We handled '=' at end of line wrong.



Index: quoted-printable.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/quoted-printable.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- quoted-printable.c	5 Jan 2003 13:09:52 -0000	1.4
+++ quoted-printable.c	8 Feb 2003 06:33:30 -0000	1.5
@@ -19,25 +19,42 @@
 			continue;
 
 		buffer_append(dest, src + next, src_pos - next);
+		next = src_pos+1;
 
 		if (src[src_pos] == '_') {
 			buffer_append_c(dest, ' ');
-			next = src_pos+1;
-		} else {
-			/* =<hex> */
-			if (src_pos+2 >= src_size)
-				break;
+			continue;
+		}
 
-			hexbuf[0] = src[src_pos+1];
-			hexbuf[1] = src[src_pos+2];
+		if (src_pos+1 >= src_size)
+			break;
 
-			if (hex_to_binary(hexbuf, dest) == 1) {
-				src_pos += 2;
-				next = src_pos+1;
-			} else {
-				/* non-hex data */
-				next = src_pos;
-			}
+		if (src[src_pos+1] == '\n') {
+			/* =\n -> skip both */
+			src_pos++;
+			continue;
+		}
+
+		if (src_pos+2 >= src_size)
+			break;
+
+		if (src[src_pos+1] == '\r' && src[src_pos+2] == '\n') {
+			/* =\r\n -> skip both */
+			src_pos += 2;
+			next++;
+			continue;
+		}
+
+		/* =<hex> */
+		hexbuf[0] = src[src_pos+1];
+		hexbuf[1] = src[src_pos+2];
+
+		if (hex_to_binary(hexbuf, dest) == 1) {
+			src_pos += 2;
+			next = src_pos+1;
+		} else {
+			/* non-hex data, show as-is */
+			next = src_pos;
 		}
 	}
 




More information about the dovecot-cvs mailing list