fix json fp precision, fix multi value json compound tags
This commit is contained in:
parent
afda43984e
commit
8a4f45db71
2 changed files with 7 additions and 2 deletions
|
@ -124,10 +124,10 @@ static bool json_print_data(const tag_t *tag, const stream_t *stream, int depth)
|
||||||
ok = printi(stream, 0, "%ld", tag->data.l);
|
ok = printi(stream, 0, "%ld", tag->data.l);
|
||||||
break;
|
break;
|
||||||
case TAG_FLOAT:
|
case TAG_FLOAT:
|
||||||
ok = printi(stream, 0, "%f", tag->data.f);
|
ok = printi(stream, 0, "%.9g", tag->data.f);
|
||||||
break;
|
break;
|
||||||
case TAG_DOUBLE:
|
case TAG_DOUBLE:
|
||||||
ok = printi(stream, 0, "%lf", tag->data.d);
|
ok = printi(stream, 0, "%.17g", tag->data.d);
|
||||||
break;
|
break;
|
||||||
case TAG_BYTE_ARRAY:
|
case TAG_BYTE_ARRAY:
|
||||||
ok = json_print_byte_array(&tag->data, stream);
|
ok = json_print_byte_array(&tag->data, stream);
|
||||||
|
|
|
@ -562,6 +562,11 @@ static bool json_read_compound(tagdata_t *data, const stream_t *stream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next.type == TOK_COMMA) {
|
if (next.type == TOK_COMMA) {
|
||||||
|
if (json_next_token(&next, stream) == false) {
|
||||||
|
free(tags);
|
||||||
|
free(name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
} else if (next.type == TOK_RBRACE) {
|
} else if (next.type == TOK_RBRACE) {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue