[dovecot-cvs] dovecot/src/lib-imap imap-parser.c,1.19,1.20
cras at procontrol.fi
cras at procontrol.fi
Sat Nov 30 18:09:39 EET 2002
Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv19240
Modified Files:
imap-parser.c
Log Message:
Still not exactly right.
Index: imap-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- imap-parser.c 30 Nov 2002 15:56:05 -0000 1.19
+++ imap-parser.c 30 Nov 2002 16:09:37 -0000 1.20
@@ -364,11 +364,11 @@
return FALSE;
if (*data == '\r') {
- if (data_size == 1)
- return FALSE;
-
data++; data_size--;
i_buffer_skip(parser->inbuf, 1);
+
+ if (data_size == 0)
+ return FALSE;
}
if (*data != '\n') {
@@ -486,13 +486,17 @@
return TRUE;
}
+#define IS_FINISHED(parser) \
+ ((parser)->cur_type == ARG_PARSE_NONE && \
+ (parser)->root_list->size >= count && \
+ (parser)->cur_list != parser->root_list)
+
int imap_parser_read_args(ImapParser *parser, unsigned int count,
ImapParserFlags flags, ImapArg **args)
{
parser->flags = flags;
- while (count == 0 || parser->root_list->size < count ||
- parser->cur_list != parser->root_list) {
+ while (count == 0 || !IS_FINISHED(parser)) {
if (!imap_parser_read_arg(parser))
break;
}
@@ -501,12 +505,9 @@
/* error, abort */
*args = NULL;
return -1;
- } else if ((parser->cur_type == ARG_PARSE_NONE &&
- parser->root_list->size >= count &&
- parser->list_arg == NULL) || parser->eol) {
+ } else if (IS_FINISHED(parser) || parser->eol) {
/* all arguments read / end of line. ARG_PARSE_NONE checks
- that last argument isn't only partially parsed.
- list_arg == NULL makes sure the lists are closed. */
+ that last argument isn't only partially parsed. */
if (count >= parser->root_list->alloc) {
/* unused arguments must be NIL-filled. */
parser->root_list->alloc = count+1;
More information about the dovecot-cvs
mailing list