JSON: don't print the non-standand NaN

This commit is contained in:
李通洲
2023-09-18 20:12:33 +08:00
parent 7f727086af
commit 8a14cbae0c
3 changed files with 3 additions and 9 deletions
+1 -1
View File
@@ -1274,7 +1274,7 @@ int main(int argc, const char** argv)
if (instance.state.resultDoc)
{
yyjson_mut_write_fp(stdout, instance.state.resultDoc, YYJSON_WRITE_ALLOW_INF_AND_NAN | YYJSON_WRITE_PRETTY_TWO_SPACES, NULL, NULL);
yyjson_mut_write_fp(stdout, instance.state.resultDoc, YYJSON_WRITE_INF_AND_NAN_AS_NULL | YYJSON_WRITE_PRETTY_TWO_SPACES, NULL, NULL);
}
ffFinish();
+1 -4
View File
@@ -157,10 +157,7 @@ void ffGenerateCPUJson(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_va
yyjson_mut_obj_add_uint(doc, obj, "coresOnline", cpu.coresOnline);
yyjson_mut_obj_add_real(doc, obj, "frequencyMin", cpu.frequencyMin);
yyjson_mut_obj_add_real(doc, obj, "frequencyMax", cpu.frequencyMax);
if (cpu.temperature == cpu.temperature)
yyjson_mut_obj_add_real(doc, obj, "temperature", cpu.temperature);
else
yyjson_mut_obj_add_null(doc, obj, "temperature");
yyjson_mut_obj_add_real(doc, obj, "temperature", cpu.temperature);
}
ffStrbufDestroy(&cpu.name);
+1 -4
View File
@@ -256,10 +256,7 @@ void ffGenerateGPUJson(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_va
else
yyjson_mut_obj_add_null(doc, sharedObj, "used");
if (gpu->temperature == gpu->temperature)
yyjson_mut_obj_add_real(doc, obj, "temperature", gpu->temperature);
else
yyjson_mut_obj_add_null(doc, obj, "temperature");
yyjson_mut_obj_add_null(doc, obj, "temperature");
const char* type;
switch (gpu->type)