Bug fix, adding empty JsonBuilder object or array to same would cause an errant comma at the end of the target.

This commit is contained in:
Stephen Atherton 2018-09-09 22:11:11 -07:00
parent 2d6632dfc6
commit 7ca304d209
2 changed files with 4 additions and 4 deletions

View File

@ -206,7 +206,7 @@ public:
}
JsonBuilderArray & addContents(const JsonBuilderArray &arr) {
if(!arr.jsonText.size()) {
if(arr.empty()) {
return *this;
}
@ -256,7 +256,7 @@ public:
}
JsonBuilderObject & addContents(const JsonBuilderObject &obj) {
if(!obj.jsonText.size()) {
if(obj.empty()) {
return *this;
}

View File

@ -2145,7 +2145,7 @@ TEST_CASE("status/json/builderPerf") {
printf("Generating and serializing random document\n");
double start = timer();
int bytes = 0;
int64_t bytes = 0;
double generated = 0;
for(int i = 0; i < iterations; i++) {
int n = elements;
@ -2159,7 +2159,7 @@ TEST_CASE("status/json/builderPerf") {
double end = timer();
double elapsed = end - start;
printf("RESULT: %lu bytes %d elements %d levels %f seconds (%f gen, %f serialize) %f MB/s %f items/s\n",
printf("RESULT: %lld bytes %d elements %d levels %f seconds (%f gen, %f serialize) %f MB/s %f items/s\n",
bytes, iterations*elements, level, elapsed, generated, elapsed - generated, bytes / elapsed / 1e6, iterations*elements / elapsed);
return Void();