From 4ffc39159b07823df1d312fadaf02a7e955e53a8 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sun, 18 Jun 2000 00:59:15 +0000 Subject: 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 --- camel/ChangeLog | 6 ++++++ camel/camel-mime-parser.c | 32 ++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'camel') 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 + + * 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 * 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]:'.')); -- cgit