summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-21 13:16:42 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-04-01 17:13:28 +0100
commitca3f7b613b1594482034b91270076e5e74c25248 (patch)
treef1627265e8d493a842bfb69dd8ba56f2111e2c12
parent04b57d4987a1950a60d6e4878426b8a256845230 (diff)
downloadevolution-data-server-ca3f7b613b1594482034b91270076e5e74c25248.tar.gz
Bug #640829 - Can drop text/plain message lines in message preview
(cherry picked from commit b0dfd4aeb2b44d56f701efca1508d2c8c6911724)
-rw-r--r--camel/camel-mime-filter.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/camel/camel-mime-filter.c b/camel/camel-mime-filter.c
index f762549ca..6dfd93ada 100644
--- a/camel/camel-mime-filter.c
+++ b/camel/camel-mime-filter.c
@@ -139,8 +139,6 @@ static void filter_run(CamelMimeFilter *f,
const gchar *in, gsize len, gsize prespace,
gchar **out, gsize *outlen, gsize *outprespace))
{
- struct _CamelMimeFilterPrivate *p;
-
#ifdef MALLOC_CHECK
checkmem(f->outreal);
checkmem(f->backbuf);
@@ -149,36 +147,39 @@ static void filter_run(CamelMimeFilter *f,
here we take a performance hit, if the input buffer doesn't
have the pre-space required. We make a buffer that does ...
*/
- if (prespace < f->backlen) {
- gint newlen = len+prespace+f->backlen;
- p = CAMEL_MIME_FILTER_GET_PRIVATE(f);
+ if (f->backlen > 0) {
+ struct _CamelMimeFilterPrivate *p;
+ gint newlen;
+
+ p = CAMEL_MIME_FILTER_GET_PRIVATE (f);
+
+ newlen = len + prespace + f->backlen;
if (p->inlen < newlen) {
/* NOTE: g_realloc copies data, we dont need that (slower) */
g_free(p->inbuf);
p->inbuf = g_malloc(newlen+PRE_HEAD);
p->inlen = newlen+PRE_HEAD;
}
+
/* copy to end of structure */
- memcpy(p->inbuf+p->inlen - len, in, len);
- in = p->inbuf+p->inlen - len;
+ memcpy (p->inbuf + p->inlen - len, in, len);
+ in = p->inbuf + p->inlen - len;
prespace = p->inlen - len;
- }
-#ifdef MALLOC_CHECK
- checkmem(f->outreal);
- checkmem(f->backbuf);
-#endif
-
- /* preload any backed up data */
- if (f->backlen > 0) {
- memcpy((gchar *) in-f->backlen, f->backbuf, f->backlen);
+ /* preload any backed up data */
+ memcpy ((gchar *) in - f->backlen, f->backbuf, f->backlen);
in -= f->backlen;
len += f->backlen;
prespace -= f->backlen;
f->backlen = 0;
}
- filterfunc(f, in, len, prespace, out, outlen, outprespace);
+#ifdef MALLOC_CHECK
+ checkmem (f->outreal);
+ checkmem (f->backbuf);
+#endif
+
+ filterfunc (f, in, len, prespace, out, outlen, outprespace);
#ifdef MALLOC_CHECK
checkmem(f->outreal);