changeset 2363:8b0d9d6444be HEAD

mbox parsing fix
author Timo Sirainen <tss@iki.fi>
date Mon, 26 Jul 2004 17:49:01 +0300
parents f2acbe281ac1
children 974b0478a548
files src/lib-storage/index/mbox/istream-raw-mbox.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/istream-raw-mbox.c	Sun Jul 25 00:19:20 2004 +0300
+++ b/src/lib-storage/index/mbox/istream-raw-mbox.c	Mon Jul 26 17:49:01 2004 +0300
@@ -200,7 +200,7 @@
 
 	/* See if we have From-line here - note that it works right only
 	   because all characters are different in mbox_from. */
-        fromp = mbox_from; from_start_pos = 0;
+        fromp = mbox_from; from_start_pos = (size_t)-1;
 	eoh_char = rstream->body_offset == (uoff_t)-1 ? '\n' : '\0';
 	for (i = stream->pos; i < pos; i++) {
 		if (buf[i] == eoh_char &&
@@ -218,7 +218,7 @@
 				i++;
 				from_start_pos = i - 6;
 				fromp = mbox_from;
-			} else if (from_start_pos != 0) {
+			} else if (from_start_pos != (size_t)-1) {
 				/* we have the whole From-line here now.
 				   See if it's a valid one. */
 				if (mbox_from_parse(buf + from_start_pos + 6,
@@ -236,7 +236,7 @@
 							   from_start_pos);
 					break;
 				}
-				from_start_pos = 0;
+				from_start_pos = (size_t)-1;
 			}
 		} else {
 			fromp = mbox_from;
@@ -248,7 +248,7 @@
 	/* we want to go at least one byte further next time */
 	rstream->input_peak_offset = stream->istream.v_offset + i;
 
-	if (from_start_pos != 0) {
+	if (from_start_pos != (size_t)-1) {
 		/* we're waiting for the \n at the end of From-line */
 		new_pos = from_start_pos;
 	} else {