mirror of
https://github.com/kgabis/parson.git
synced 2025-01-28 06:32:55 +08:00
Merge pull request #55 from jmlemetayer/unsigned
Add support to print unsigned integers
This commit is contained in:
commit
1bcab43c38
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…
x
Reference in New Issue
Block a user