mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
fix: print int without decimal places (#630)
This commit is contained in:
parent
203a0dec6f
commit
d321fa9e6e
4
cJSON.c
4
cJSON.c
@ -562,6 +562,10 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out
|
|||||||
{
|
{
|
||||||
length = sprintf((char*)number_buffer, "null");
|
length = sprintf((char*)number_buffer, "null");
|
||||||
}
|
}
|
||||||
|
else if(d == (double)item->valueint)
|
||||||
|
{
|
||||||
|
length = sprintf((char*)number_buffer, "%d", item->valueint);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
|
/* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
|
||||||
|
Loading…
Reference in New Issue
Block a user