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

This commit is contained in:
lurchi 2016-09-05 12:35:24 +02:00
parent 2614da4953
commit c593d85742

View file

@ -683,12 +683,14 @@ psyc_parse_list (PsycParseListState *state, PsycString *type, PsycString *elem)
switch (parse_binary((ParseState*)state, state->elemlen, elem,
&state->elem_parsed)) {
case PARSE_SUCCESS:
state->part = PSYC_LIST_PART_ELEM_START;
if (elem->length == state->elem_parsed)
ret = PSYC_PARSE_LIST_ELEM;
else
ret = PSYC_PARSE_LIST_ELEM_END;
break;
case PARSE_INCOMPLETE:
state->part = PSYC_LIST_PART_ELEM;
if (elem->length == state->elem_parsed)
ret = PSYC_PARSE_LIST_ELEM_START;
else
@ -700,6 +702,7 @@ psyc_parse_list (PsycParseListState *state, PsycString *type, PsycString *elem)
} else {
switch (parse_until((ParseState*)state, '|', elem)) {
case PARSE_SUCCESS:
state->part = PSYC_LIST_PART_ELEM_START;
ret = PSYC_PARSE_LIST_ELEM;
break;
case PARSE_INSUFFICIENT:
@ -709,7 +712,6 @@ psyc_parse_list (PsycParseListState *state, PsycString *type, PsycString *elem)
}
}
state->part = PSYC_LIST_PART_ELEM_START;
state->startc = state->cursor;
return ret;
}
@ -917,6 +919,7 @@ psyc_parse_dict (PsycParseDictState *state, PsycString *type, PsycString *elem)
switch (parse_binary((ParseState*)state, state->elemlen, elem,
&state->elem_parsed)) {
case PARSE_SUCCESS:
state->part = PSYC_DICT_PART_KEY_START;
if (elem->length == state->elem_parsed)
ret = PSYC_PARSE_DICT_VALUE;
else
@ -934,6 +937,7 @@ psyc_parse_dict (PsycParseDictState *state, PsycString *type, PsycString *elem)
} else {
switch (parse_until((ParseState*)state, '{', elem)) {
case PARSE_SUCCESS:
state->part = PSYC_DICT_PART_KEY_START;
ret = PSYC_PARSE_DICT_VALUE;
break;
case PARSE_INSUFFICIENT:
@ -943,7 +947,7 @@ psyc_parse_dict (PsycParseDictState *state, PsycString *type, PsycString *elem)
}
}
state->part = PSYC_DICT_PART_KEY_START;
//state->part = PSYC_DICT_PART_KEY_START;
return ret;
}