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
This commit is contained in:
Dan Winship
2000-06-18 00:59:15 +00:00
parent f4ae655f41
commit 4ffc39159b
2 changed files with 28 additions and 10 deletions

View File

@ -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

View File

@ -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]:'.'));