aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-06-18 08:59:15 +0800
committerDan Winship <danw@src.gnome.org>2000-06-18 08:59:15 +0800
commit4ffc39159b07823df1d312fadaf02a7e955e53a8 (patch)
tree0167c693a88ceaa48e22bb2e9747e0d6f40c268a /camel
parentf4ae655f41b3fdbfda2aa69a7662fa09578a87c7 (diff)
downloadgsoc2013-evolution-4ffc39159b07823df1d312fadaf02a7e955e53a8.tar.gz
gsoc2013-evolution-4ffc39159b07823df1d312fadaf02a7e955e53a8.tar.zst
gsoc2013-evolution-4ffc39159b07823df1d312fadaf02a7e955e53a8.zip
Don't copy newlines into the parsed header text, and turn any number of
* camel-mime-parser.c (folder_scan_header): Don't copy newlines into the parsed header text, and turn any number of tabs and spaces after a newline into a single space. svn path=/trunk/; revision=3624
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-parser.c32
2 files changed, 28 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 91aef64322..7e38c2d529 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-17 Dan Winship <danw@helixcode.com>
+
+ * camel-mime-parser.c (folder_scan_header): Don't copy newlines
+ into the parsed header text, and turn any number of tabs and
+ spaces after a newline into a single space.
+
2000-06-17 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c (imap_init): Should now
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index acb29814d2..c8dc4fb61c 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -1102,18 +1102,34 @@ retry:
start = inptr;
- if (!s->midline
- && (part = folder_boundary_check(s, inptr, lastone))) {
- if ((s->outptr>s->outbuf) || (inptr-start))
- goto header_truncated; /* may not actually be truncated */
-
- goto normal_exit;
+ if (!s->midline) {
+ if ((part = folder_boundary_check(s, inptr, lastone))) {
+ if ((s->outptr>s->outbuf) || (inptr-start))
+ goto header_truncated; /* may not actually be truncated */
+
+ goto normal_exit;
+ }
+
+ /* Replace any number of spaces and tabs at the start of the line with
+ * a single space.
+ */
+ if (*start == ' ' || *start == '\t') {
+ static char *space = " ";
+ do
+ start++;
+ while (*start == ' ' || *start == '\t');
+ header_append(s, space, space + 1);
+ }
}
/* goto next line */
while ((*inptr++)!='\n')
;
+ g_assert(inptr<=s->inend+1);
+
+ header_append(s, start, inptr-1);
+
/* check against the real buffer end, not our 'atleast limited' end */
/* also make sure we have at least 1 char lookahead, so even if we found a \n at
the end, well, make out we didn't, and re-scan it next pass */
@@ -1124,10 +1140,6 @@ retry:
s->midline = FALSE;
}
- g_assert(inptr<=s->inend);
-
- header_append(s, start, inptr);
-
h(printf("outbuf[0] = %02x '%c' oubuf[1] = %02x '%c'\n",
s->outbuf[0], isprint(s->outbuf[0])?s->outbuf[0]:'.',
s->outbuf[1], isprint(s->outbuf[1])?s->outbuf[1]:'.'));