aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r--camel/camel-mime-parser.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index a53e0716a7..ea7b75f5ca 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -1523,6 +1523,16 @@ folder_scan_init(void)
return s;
}
+static void
+drop_states(struct _header_scan_state *s)
+{
+ while (s->parts) {
+ folder_scan_drop_step(s);
+ }
+ s->unstep = 0;
+ s->state = HSCAN_INITIAL;
+}
+
static int
folder_scan_init_with_fd(struct _header_scan_state *s, int fd)
{
@@ -1530,6 +1540,7 @@ folder_scan_init_with_fd(struct _header_scan_state *s, int fd)
len = read(fd, s->inbuf, SCAN_BUF);
if (len>=0) {
+ drop_states(s);
s->inend = s->inbuf+len;
s->inptr = s->inbuf;
s->inend[0] = '\n';
@@ -1555,6 +1566,7 @@ folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream)
len = camel_stream_read(stream, s->inbuf, SCAN_BUF);
if (len >= 0) {
+ drop_states(s);
s->inend = s->inbuf+len;
s->inptr = s->inbuf;
s->inend[0] = '\n';