mirror of
https://github.com/kgabis/parson.git
synced 2024-11-24 06:05:29 +00:00
Add support to print unsigned integers
Else numbers between INT_MAX and UINT_MAX will be printed using double format
This commit is contained in:
parent
642f0cb4f5
commit
d198f6ebfe
2
parson.c
2
parson.c
@ -874,6 +874,8 @@ static int json_serialize_to_buffer_r(const JSON_Value *value, char *buf, int le
|
||||
}
|
||||
if (num == ((double)(int)num)) { /* check if num is integer */
|
||||
written = sprintf(num_buf, "%d", (int)num);
|
||||
} else if (num == ((double)(unsigned int)num)) {
|
||||
written = sprintf(num_buf, "%u", (unsigned int)num);
|
||||
} else {
|
||||
written = sprintf(num_buf, DOUBLE_SERIALIZATION_FORMAT, num);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user