diff options
author | Stoian Ivanov <sdr@mail.bg> | 2016-10-05 23:55:46 +0300 |
---|---|---|
committer | Stoian Ivanov <sdr@mail.bg> | 2016-10-05 23:55:46 +0300 |
commit | 05f025c07537f643b9cc463cb8fed6fbb72a73d8 (patch) | |
tree | 8e7915b30a253dd751bf8ca552ca8e0ba7acb402 /json_object.c | |
parent | fae09456ae516100bf9e799c8a744903c88faeba (diff) | |
download | json-c-05f025c07537f643b9cc463cb8fed6fbb72a73d8.tar.gz |
some basic set
Diffstat (limited to 'json_object.c')
-rw-r--r-- | json_object.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/json_object.c b/json_object.c index 4f74a20..ea2ea64 100644 --- a/json_object.c +++ b/json_object.c @@ -568,11 +568,11 @@ json_bool json_object_get_boolean(const struct json_object *jso) } } -json_bool json_object_set_boolean(struct json_object *jso,json_bool new_value){ +int json_object_set_boolean(struct json_object *jso,json_bool new_value){ if (!jso || jso->o_type!=json_type_boolean) - return FALSE; + return 0; jso->o.c_boolean=new_value; - return TRUE; + return 1; } @@ -634,6 +634,14 @@ int32_t json_object_get_int(const struct json_object *jso) } } +int json_object_set_int(struct json_object *jso,int new_value){ + if (!jso || jso->o_type!=json_type_int) + return 0; + jso->o.c_int64=new_value; + return 1; +} + + struct json_object* json_object_new_int64(int64_t i) { struct json_object *jso = json_object_new(json_type_int); @@ -666,6 +674,12 @@ int64_t json_object_get_int64(const struct json_object *jso) } } +int json_object_set_int64(struct json_object *jso,int64_t new_value){ + if (!jso || jso->o_type!=json_type_int) + return 0; + jso->o.c_int64=new_value; + return 1; +} /* json_object_double */ @@ -820,6 +834,12 @@ double json_object_get_double(const struct json_object *jso) } } +int json_object_set_double(struct json_object *jso,double new_value){ + if (!jso || jso->o_type!=json_type_double) + return 0; + jso->o.c_double=new_value; + return 1; +} /* json_object_string */ |