Browse Source

Override int64 to only display uint64 strings

- Not true uint64 support, but should handle all cases properly
- Useful for when dealing with large 64 bit numbers without negatives
pull/191/head
Jacob Alexander 10 years ago
parent
commit
43a44b9032
2 changed files with 7 additions and 0 deletions
  1. +2
    -0
      json_object.c
  2. +5
    -0
      json_object.h

+ 2
- 0
json_object.c View File

@@ -509,6 +509,8 @@ static int json_object_int_to_json_string(struct json_object* jso,
int level,
int flags)
{
if (flags & JSON_C_TO_STRING_UINT64)
return sprintbuf(pb, "%"PRIu64, jso->o.c_int64);
return sprintbuf(pb, "%"PRId64, jso->o.c_int64);
}



+ 5
- 0
json_object.h View File

@@ -62,6 +62,11 @@ extern "C" {
* A flag to drop trailing zero for float values
*/
#define JSON_C_TO_STRING_NOZERO (1<<2)
/**
* Force integer to output unsigned
* Useful when dealing with very large 64 bit numbers without negatives
*/
#define JSON_C_TO_STRING_UINT64 (1<<4)

#undef FALSE
#define FALSE ((json_bool)0)


Loading…
Cancel
Save