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:
parent
2614da4953
commit
c593d85742
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue