[gmime] Properly terminate the quoted-printable encoding



commit 9356782b4eb6b63b20089aba89acc60ba1d526f9
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Thu Sep 16 21:57:40 2010 -0400

    Properly terminate the quoted-printable encoding
    
    2010-09-16  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-encodings.c (g_mime_encoding_quoted_encode_close):
    	If the last input character is not a \n, append an "=\n"
    sequence.

 ChangeLog               |    5 +++++
 gmime/gmime-encodings.c |    7 ++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7d476ef..2ca4b47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-16  Jeffrey Stedfast  <fejj novell com>
+
+	* gmime/gmime-encodings.c (g_mime_encoding_quoted_encode_close):
+	If the last input character is not a \n, append an "=\n" sequence.
+
 2010-09-13  Jeffrey Stedfast  <fejj novell com>
 
 	* gmime/gmime-charset.c: Mark known_iconv_charsets[] as
diff --git a/gmime/gmime-encodings.c b/gmime/gmime-encodings.c
index df8b9d9..c4bf7a8 100644
--- a/gmime/gmime-encodings.c
+++ b/gmime/gmime-encodings.c
@@ -903,7 +903,12 @@ g_mime_encoding_quoted_encode_close (const unsigned char *inbuf, size_t inlen, u
 		}
 	}
 	
-	*outptr++ = '\n';
+	if (last != '\n') {
+		/* we end with =\n so that the \n isn't interpreted as a real
+		   \n when it gets decoded later */
+		*outptr++ = '=';
+		*outptr++ = '\n';
+	}
 	
 	*save = 0;
 	*state = -1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]