[dovecot-cvs] dovecot/src/lib-imap imap-parser.c,1.20,1.21

cras at procontrol.fi cras at procontrol.fi
Sat Nov 30 18:32:22 EET 2002


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv1596/lib-imap

Modified Files:
	imap-parser.c 
Log Message:
Maybe now?



Index: imap-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- imap-parser.c	30 Nov 2002 16:09:37 -0000	1.20
+++ imap-parser.c	30 Nov 2002 16:32:20 -0000	1.21
@@ -486,9 +486,8 @@
 	return TRUE;
 }
 
-#define IS_FINISHED(parser) \
-        ((parser)->cur_type == ARG_PARSE_NONE && \
-	 (parser)->root_list->size >= count && \
+#define IS_UNFINISHED(parser) \
+        ((parser)->cur_type != ARG_PARSE_NONE || \
 	 (parser)->cur_list != parser->root_list)
 
 int imap_parser_read_args(ImapParser *parser, unsigned int count,
@@ -496,7 +495,8 @@
 {
 	parser->flags = flags;
 
-	while (count == 0 || !IS_FINISHED(parser)) {
+	while (count == 0 || parser->root_list->size < count ||
+	       IS_UNFINISHED(parser)) {
 		if (!imap_parser_read_arg(parser))
 			break;
 	}
@@ -505,7 +505,8 @@
 		/* error, abort */
 		*args = NULL;
 		return -1;
-	} else if (IS_FINISHED(parser) || parser->eol) {
+	} else if ((!IS_UNFINISHED(parser) &&
+		    parser->root_list->size >= count) || parser->eol) {
 		/* all arguments read / end of line. ARG_PARSE_NONE checks
 		   that last argument isn't only partially parsed. */
 		if (count >= parser->root_list->alloc) {




More information about the dovecot-cvs mailing list