mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Init valueint and valuedouble incase of cJSON_False/cJSON_True/cJSON_NULL
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: If75627ce38b9798498dd2a82013a70049a2a7e76
This commit is contained in:
parent
324a6ac9a9
commit
1bdcf368c6
5
cJSON.c
5
cJSON.c
@ -1317,6 +1317,8 @@ static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buf
|
|||||||
if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0))
|
if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0))
|
||||||
{
|
{
|
||||||
item->type = cJSON_NULL;
|
item->type = cJSON_NULL;
|
||||||
|
item->valueint = 0;
|
||||||
|
item->valuedouble = 0;
|
||||||
input_buffer->offset += 4;
|
input_buffer->offset += 4;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1324,6 +1326,8 @@ static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buf
|
|||||||
if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0))
|
if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0))
|
||||||
{
|
{
|
||||||
item->type = cJSON_False;
|
item->type = cJSON_False;
|
||||||
|
item->valueint = 0;
|
||||||
|
item->valuedouble = 0;
|
||||||
input_buffer->offset += 5;
|
input_buffer->offset += 5;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1332,6 +1336,7 @@ static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buf
|
|||||||
{
|
{
|
||||||
item->type = cJSON_True;
|
item->type = cJSON_True;
|
||||||
item->valueint = 1;
|
item->valueint = 1;
|
||||||
|
item->valuedouble = 1;
|
||||||
input_buffer->offset += 4;
|
input_buffer->offset += 4;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user