fix json fp precision, fix multi value json compound tags

This commit is contained in:
Murphy 2023-12-15 23:31:50 -05:00
parent afda43984e
commit 8a4f45db71
No known key found for this signature in database
GPG key ID: 988032A5638EE799
2 changed files with 7 additions and 2 deletions

View file

@ -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);

View file

@ -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;