diff options
author | Andy Green <andy@warmcat.com> | 2019-04-21 20:07:07 +0100 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2019-05-02 09:28:38 +0100 |
commit | 0405c0c87819f8c1fc087e2a879ee807d656d6b9 (patch) | |
tree | e2729cf4731c04569bc2764859f981693fbd0d26 /test-apps/test-lejp.c | |
parent | 80135635bbd5a0331385ab3be723ab2117844602 (diff) | |
download | libwebsockets-0405c0c87819f8c1fc087e2a879ee807d656d6b9.tar.gz |
lejp: make sure child object close is not mistaken for parent
Diffstat (limited to 'test-apps/test-lejp.c')
-rw-r--r-- | test-apps/test-lejp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test-apps/test-lejp.c b/test-apps/test-lejp.c index ad5f8eea..43d11ec3 100644 --- a/test-apps/test-lejp.c +++ b/test-apps/test-lejp.c @@ -42,6 +42,7 @@ static const char * const reason_names[] = { "LEJPCB_ARRAY_END", "LEJPCB_OBJECT_START", "LEJPCB_OBJECT_END", + "LEJPCB_OBJECT_END_PRE", }; static const char * const tok[] = { @@ -52,6 +53,11 @@ static signed char cb(struct lejp_ctx *ctx, char reason) { char buf[1024], *p = buf, *end = &buf[sizeof(buf)]; + int n; + + for (n = 0; n < ctx->sp; n++) + *p++ = ' '; + *p = '\0'; if (reason & LEJP_FLAG_CB_IS_VALUE) { p += lws_snprintf(p, p - end, " value '%s' ", ctx->buf); @@ -73,13 +79,17 @@ cb(struct lejp_ctx *ctx, char reason) switch (reason) { case LEJPCB_COMPLETE: - lwsl_notice("Parsing Completed (LEJPCB_COMPLETE)\n"); + lwsl_notice("%sParsing Completed (LEJPCB_COMPLETE)\n", buf); break; case LEJPCB_PAIR_NAME: - lwsl_notice("path: '%s' (LEJPCB_PAIR_NAME)\n", ctx->path); + lwsl_notice("%spath: '%s' (LEJPCB_PAIR_NAME)\n", buf, ctx->path); break; } + lwsl_notice("%s%s: path %s match %d statckp %d\r\n", buf, reason_names[(unsigned int) + (reason) & (LEJP_FLAG_CB_IS_VALUE - 1)], ctx->path, + ctx->path_match, ctx->pst[ctx->pst_sp].ppos); + return 0; } |