mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Merge pull request #307 from bnason-nf/vstudio_static_analyzer_warnings
Fix most of the issues reported by the Visual Studio code analysis tool
This commit is contained in:
commit
26f38f4782
8
cJSON.c
8
cJSON.c
@ -324,7 +324,7 @@ loop_end:
|
|||||||
{
|
{
|
||||||
item->valueint = INT_MAX;
|
item->valueint = INT_MAX;
|
||||||
}
|
}
|
||||||
else if (number <= INT_MIN)
|
else if (number <= (double)INT_MIN)
|
||||||
{
|
{
|
||||||
item->valueint = INT_MIN;
|
item->valueint = INT_MIN;
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number)
|
|||||||
{
|
{
|
||||||
object->valueint = INT_MAX;
|
object->valueint = INT_MAX;
|
||||||
}
|
}
|
||||||
else if (number <= INT_MIN)
|
else if (number <= (double)INT_MIN)
|
||||||
{
|
{
|
||||||
object->valueint = INT_MIN;
|
object->valueint = INT_MIN;
|
||||||
}
|
}
|
||||||
@ -1675,7 +1675,7 @@ static cJSON_bool print_object(const cJSON * const item, printbuffer * const out
|
|||||||
update_offset(output_buffer);
|
update_offset(output_buffer);
|
||||||
|
|
||||||
/* print comma if not last */
|
/* print comma if not last */
|
||||||
length = (size_t) ((output_buffer->format ? 1 : 0) + (current_item->next ? 1 : 0));
|
length = ((size_t)(output_buffer->format ? 1 : 0) + (size_t)(current_item->next ? 1 : 0));
|
||||||
output_pointer = ensure(output_buffer, length + 1);
|
output_pointer = ensure(output_buffer, length + 1);
|
||||||
if (output_pointer == NULL)
|
if (output_pointer == NULL)
|
||||||
{
|
{
|
||||||
@ -2300,7 +2300,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num)
|
|||||||
{
|
{
|
||||||
item->valueint = INT_MAX;
|
item->valueint = INT_MAX;
|
||||||
}
|
}
|
||||||
else if (num <= INT_MIN)
|
else if (num <= (double)INT_MIN)
|
||||||
{
|
{
|
||||||
item->valueint = INT_MIN;
|
item->valueint = INT_MIN;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user