modify the json_object, replace c_int64/c_uint64 with struct{union{int64, uint64},...}

This commit is contained in:
dota17
2020-02-26 20:54:36 +08:00
parent 3c3b5920f7
commit c816de212b
7 changed files with 111 additions and 87 deletions

View File

@@ -91,12 +91,11 @@ static void getit(struct json_object *new_obj, const char *field)
static void checktype_header()
{
printf("json_object_is_type: %s,%s,%s,%s,%s,%s,%s,%s\n",
printf("json_object_is_type: %s,%s,%s,%s,%s,%s,%s\n",
json_type_to_name(json_type_null),
json_type_to_name(json_type_boolean),
json_type_to_name(json_type_double),
json_type_to_name(json_type_int),
json_type_to_name(json_type_uint),
json_type_to_name(json_type_object),
json_type_to_name(json_type_array),
json_type_to_name(json_type_string));
@@ -107,13 +106,12 @@ static void checktype(struct json_object *new_obj, const char *field)
if (field && !json_object_object_get_ex(new_obj, field, &o))
printf("Field %s does not exist\n", field);
printf("new_obj%s%-18s: %d,%d,%d,%d,%d,%d,%d,%d\n",
printf("new_obj%s%-18s: %d,%d,%d,%d,%d,%d,%d\n",
field ? "." : " ", field ? field : "",
json_object_is_type(o, json_type_null),
json_object_is_type(o, json_type_boolean),
json_object_is_type(o, json_type_double),
json_object_is_type(o, json_type_int),
json_object_is_type(o, json_type_uint),
json_object_is_type(o, json_type_object),
json_object_is_type(o, json_type_array),
json_object_is_type(o, json_type_string));

View File

@@ -59,13 +59,13 @@ new_obj.a_null json_object_get_boolean()=0
new_obj.a_null json_object_get_double()=0.000000
================================
json_object_is_type: null,boolean,double,int,uint,object,array,string
new_obj : 0,0,0,0,0,1,0,0
new_obj.string_of_digits : 0,0,0,0,0,0,0,1
new_obj.regular_number : 0,0,0,1,0,0,0,0
new_obj.decimal_number : 0,0,1,0,0,0,0,0
new_obj.boolean_true : 0,1,0,0,0,0,0,0
new_obj.boolean_false : 0,1,0,0,0,0,0,0
new_obj.int64_number : 0,0,0,1,0,0,0,0
new_obj.negative_number : 0,0,0,1,0,0,0,0
new_obj.a_null : 1,0,0,0,0,0,0,0
json_object_is_type: null,boolean,double,int,object,array,string
new_obj : 0,0,0,0,1,0,0
new_obj.string_of_digits : 0,0,0,0,0,0,1
new_obj.regular_number : 0,0,0,1,0,0,0
new_obj.decimal_number : 0,0,1,0,0,0,0
new_obj.boolean_true : 0,1,0,0,0,0,0
new_obj.boolean_false : 0,1,0,0,0,0,0
new_obj.int64_number : 0,0,0,1,0,0,0
new_obj.negative_number : 0,0,0,1,0,0,0
new_obj.a_null : 1,0,0,0,0,0,0