1
0
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:
Krzysztof Gabis 2016-09-22 22:43:26 +01:00 committed by GitHub
commit 1bcab43c38

View File

@ -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);
}