1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

fix bug in partial list parsing (second try)

This commit is contained in:
lurchi 2016-09-05 12:58:11 +02:00
parent 678304a144
commit 0fe0be4e4b

View file

@ -683,12 +683,14 @@ psyc_parse_list (PsycParseListState *state, PsycString *type, PsycString *elem)
switch (parse_binary((ParseState*)state, state->elemlen, elem, switch (parse_binary((ParseState*)state, state->elemlen, elem,
&state->elem_parsed)) { &state->elem_parsed)) {
case PARSE_SUCCESS: case PARSE_SUCCESS:
state->part = PSYC_LIST_PART_ELEM_START;
if (elem->length == state->elem_parsed) if (elem->length == state->elem_parsed)
ret = PSYC_PARSE_LIST_ELEM; ret = PSYC_PARSE_LIST_ELEM;
else else
ret = PSYC_PARSE_LIST_ELEM_END; ret = PSYC_PARSE_LIST_ELEM_END;
break; break;
case PARSE_INCOMPLETE: case PARSE_INCOMPLETE:
state->part = PSYC_LIST_PART_ELEM;
if (elem->length == state->elem_parsed) if (elem->length == state->elem_parsed)
ret = PSYC_PARSE_LIST_ELEM_START; ret = PSYC_PARSE_LIST_ELEM_START;
else else
@ -700,6 +702,7 @@ psyc_parse_list (PsycParseListState *state, PsycString *type, PsycString *elem)
} else { } else {
switch (parse_until((ParseState*)state, '|', elem)) { switch (parse_until((ParseState*)state, '|', elem)) {
case PARSE_SUCCESS: case PARSE_SUCCESS:
state->part = PSYC_LIST_PART_ELEM_START;
ret = PSYC_PARSE_LIST_ELEM; ret = PSYC_PARSE_LIST_ELEM;
break; break;
case PARSE_INSUFFICIENT: case PARSE_INSUFFICIENT:
@ -710,7 +713,6 @@ psyc_parse_list (PsycParseListState *state, PsycString *type, PsycString *elem)
} }
} }
state->part = PSYC_LIST_PART_ELEM_START;
state->startc = state->cursor; state->startc = state->cursor;
return ret; return ret;
} }