MCPcopy Create free account
hub / github.com/SVF-tools/SVF / cJSON_CreateNumber

Function cJSON_CreateNumber

svf/lib/Util/cJSON.cpp:2436–2460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2434}
2435
2436CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num)
2437{
2438 cJSON *item = cJSON_New_Item(&global_hooks);
2439 if(item)
2440 {
2441 item->type = cJSON_Number;
2442 item->valuedouble = num;
2443
2444 /* use saturation in case of overflow */
2445 if (num >= INT_MAX)
2446 {
2447 item->valueint = INT_MAX;
2448 }
2449 else if (num <= (double)INT_MIN)
2450 {
2451 item->valueint = INT_MIN;
2452 }
2453 else
2454 {
2455 item->valueint = (int)num;
2456 }
2457 }
2458
2459 return item;
2460}
2461
2462CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2463{

Callers 5

cJSON_AddNumberToObjectFunction · 0.85
cJSON_CreateIntArrayFunction · 0.85
cJSON_CreateFloatArrayFunction · 0.85
cJSON_CreateDoubleArrayFunction · 0.85
getBugDescriptionMethod · 0.85

Calls 1

cJSON_New_ItemFunction · 0.85

Tested by

no test coverage detected