mirror of
git://git.psyced.org/git/psyclpc
synced 2024-08-15 03:20:16 +00:00
pkg-psyc: incomplete packet parsing - return 0 when not finished
This commit is contained in:
parent
dbe6e0a453
commit
79c479b563
2 changed files with 17 additions and 17 deletions
|
@ -17,10 +17,9 @@
|
|||
debug_message(sprintf("p1: libpsyc returned %O\n", p1));
|
||||
mixed *p2 = psyc_parse("ing\n_notice_test_libpsyc\nJust [_topic] libpsyc.\n|\n");
|
||||
debug_message(sprintf("p2: libpsyc returned %O\n", p2));
|
||||
mixed *p = ({ p1[0]+p2[0], p1[1]+p2[1],
|
||||
(p1[2]||"") + p2[2], (p1[3]||"") + p2[3] });
|
||||
mixed pr = psyc_render(p);
|
||||
debug_message(sprintf("libpsyc returned %O (%s)\n", p,
|
||||
|
||||
mixed pr = psyc_render(p2);
|
||||
debug_message(sprintf("libpsyc returned %O (%s)\n", p2,
|
||||
pr == s ? "SUCCESS": "FAIL!"));
|
||||
|
||||
string ls = ":_context\ttest\n\n:_list_foo\t|foo|bar|baz\n:_list_bar\t\n_notice_test_libpsyc\nJust [_topic] libpsyc.\n|\n";
|
||||
|
@ -239,10 +238,11 @@ f_psyc_parse (svalue_t *sp) {
|
|||
errorf("\npsyc_parse got type %d, not supported\n", sp->type);
|
||||
}
|
||||
|
||||
free_svalue(sp);
|
||||
|
||||
if (!state->packet) {
|
||||
state->packet = allocate_array(4);
|
||||
if (!state->packet) errorf("Out of memory for psyc_parse array.\n");
|
||||
}
|
||||
v = state->packet;
|
||||
|
||||
map = allocate_mapping(0, 1); // empty mapping
|
||||
|
@ -251,6 +251,8 @@ f_psyc_parse (svalue_t *sp) {
|
|||
map = allocate_mapping(0, 1); // empty mapping
|
||||
if (!map) errorf("Out of memory for psyc_parse entity header.\n");
|
||||
put_mapping(&v->item[PACKET_ENTITY], map);
|
||||
} else
|
||||
v = state->packet;
|
||||
|
||||
do {
|
||||
ret = psyc_parse(state->parser, &oper, &name, &value);
|
||||
|
@ -359,6 +361,7 @@ f_psyc_parse (svalue_t *sp) {
|
|||
|
||||
case PSYC_PARSE_COMPLETE:
|
||||
state->packet = NULL;
|
||||
put_array(sp, v);
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
|
@ -373,6 +376,7 @@ f_psyc_parse (svalue_t *sp) {
|
|||
} else
|
||||
state->remaining = NULL;
|
||||
|
||||
put_number(sp, 0);
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
|
@ -431,11 +435,7 @@ f_psyc_parse (svalue_t *sp) {
|
|||
if (buffer)
|
||||
pfree(buffer);
|
||||
|
||||
free_svalue(sp);
|
||||
put_array(sp, v);
|
||||
state->packet = 0;
|
||||
return sp;
|
||||
|
||||
} /* f_psyc_parse */
|
||||
|
||||
#endif /* USE_PSYC */
|
||||
|
|
|
@ -17,7 +17,7 @@ version_longtype="stable"
|
|||
# A timestamp, to be used by bumpversion and other scripts.
|
||||
# It can be used, for example, to 'touch' this file on every build, thus
|
||||
# forcing revision control systems to add it on every checkin automatically.
|
||||
version_stamp="Fri May 13 23:10:29 CEST 2011"
|
||||
version_stamp="Thu May 19 18:45:43 CEST 2011"
|
||||
|
||||
# Okay, LDMUD is using 3.x.x so to avoid conflicts let's just use 4.x.x
|
||||
version_major=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue