[dovecot-cvs] dovecot/src/lib-mail message-body-search.c,1.22,1.23

cras at dovecot.org cras at dovecot.org
Fri Oct 28 16:38:38 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv26610

Modified Files:
	message-body-search.c 
Log Message:
Added an assert



Index: message-body-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-body-search.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- message-body-search.c	6 Jan 2005 21:40:26 -0000	1.22
+++ message-body-search.c	28 Oct 2005 13:38:36 -0000	1.23
@@ -112,7 +112,7 @@
 						    "UTF-8", NULL);
 	if (hdr_search_ctx == NULL) {
 		/* Invalid key. */
-		return FALSE;
+		return -1;
 	}
 
 	/* we default to text content-type */
@@ -386,7 +386,7 @@
 				   const struct message_part *part)
 {
 	struct part_search_context part_ctx;
-	int found;
+	int ret, found;
 
 	found = FALSE;
 	while (part != NULL && !found) {
@@ -401,13 +401,17 @@
 
 		t_push();
 
-		if (message_search_header(&part_ctx, input)) {
-			found = TRUE;
+		ret = message_search_header(&part_ctx, input);
+		if (ret != 0) {
+			/* found / invalid */
+			found = ret > 0;
 		} else if (part->children != NULL) {
 			/* multipart/xxx or message/rfc822 */
 			if (message_body_search_ctx(ctx, input, part->children))
 				found = TRUE;
 		} else {
+			i_assert(input->v_offset == part->physical_pos +
+				 part->header_size.physical_size);
 			if (message_search_body(&part_ctx, input, part))
 				found = TRUE;
 		}



More information about the dovecot-cvs mailing list