[evolution-data-server] Bug #556933 - Too long quoted-printable lines in edge case
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #556933 - Too long quoted-printable lines in edge case
- Date: Fri, 16 Oct 2009 08:46:12 +0000 (UTC)
commit 0dd35558af11dc896c2c444cbd56b672f7861829
Author: Milan Crha <mcrha redhat com>
Date: Fri Oct 16 10:45:36 2009 +0200
Bug #556933 - Too long quoted-printable lines in edge case
camel/camel-mime-utils.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index e0f12c3..fb2dbdb 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -514,6 +514,17 @@ camel_quoted_encode_step (guchar *in, gsize len, guchar *out, gint *statep, gint
register gint sofar = *save; /* keeps track of how many chars on a line */
register gint last = *statep; /* keeps track if last gchar to end was a space cr etc */
+ #define output_last() \
+ if (sofar + 3 > 74) { \
+ *outptr++ = '='; \
+ *outptr++ = '\n'; \
+ sofar = 0; \
+ } \
+ *outptr++ = '='; \
+ *outptr++ = tohex[(last >> 4) & 0xf]; \
+ *outptr++ = tohex[last & 0xf]; \
+ sofar += 3;
+
inptr = in;
inend = in + len;
outptr = out;
@@ -521,17 +532,12 @@ camel_quoted_encode_step (guchar *in, gsize len, guchar *out, gint *statep, gint
c = *inptr++;
if (c == '\r') {
if (last != -1) {
- *outptr++ = '=';
- *outptr++ = tohex[(last >> 4) & 0xf];
- *outptr++ = tohex[last & 0xf];
- sofar += 3;
+ output_last ();
}
last = c;
} else if (c == '\n') {
if (last != -1 && last != '\r') {
- *outptr++ = '=';
- *outptr++ = tohex[(last >> 4) & 0xf];
- *outptr++ = tohex[last & 0xf];
+ output_last ();
}
*outptr++ = '\n';
sofar = 0;
@@ -542,10 +548,7 @@ camel_quoted_encode_step (guchar *in, gsize len, guchar *out, gint *statep, gint
*outptr++ = last;
sofar++;
} else {
- *outptr++ = '=';
- *outptr++ = tohex[(last >> 4) & 0xf];
- *outptr++ = tohex[last & 0xf];
- sofar += 3;
+ output_last ();
}
}
@@ -582,6 +585,8 @@ camel_quoted_encode_step (guchar *in, gsize len, guchar *out, gint *statep, gint
*save = sofar;
*statep = last;
+ #undef output_last
+
return (outptr - out);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]