1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
ZyXEL_PMG5617GA/package/libs/libjson-c/patches-0.12/013-FEATURE_app_agent.patch
2022-11-27 10:16:14 +00:00

59 lines
1.5 KiB
Diff

Index: json-c-0.12/json_object.c
===================================================================
--- json-c-0.12.orig/json_object.c 2016-01-05 14:59:33.130930892 +0800
+++ json-c-0.12/json_object.c 2016-01-05 15:00:40.143747176 +0800
@@ -243,6 +243,7 @@
case json_type_uint16:
case json_type_uint8:
case json_type_ulong:
+ case json_type_int:
jso->_to_json_string = &json_object_int_to_json_string;
break;
case json_type_object:
@@ -811,6 +812,32 @@
json_object_generic_delete(jso);
}
+int json_object_set_param(struct json_object *jso, char* v)
+{
+ if(!jso) return 0;
+ switch(jso->o_type) {
+ case json_type_boolean:
+ jso->o.c_boolean = (json_bool)atoi(v);
+ break;
+ case json_type_int:
+ jso->o.c_int64 = (int32_t)atoi(v);
+ break;
+ case json_type_string:
+ if(jso->o.c_string.str) {
+ free(jso->o.c_string.str);
+ jso->o.c_string.str = NULL;
+ jso->o.c_string.len = 0;
+ }
+ jso->o.c_string.str = strdup(v);
+ jso->o.c_string.len = strlen(v);
+ break;
+ case json_type_double:
+ default:
+ break;
+ }
+
+ return 0;
+}
#if 1 /* zyxel, john */
int json_object_array_delete_idx(struct json_object *jso,
int idx)
Index: json-c-0.12/json_object.h
===================================================================
--- json-c-0.12.orig/json_object.h 2016-01-05 14:59:33.122930858 +0800
+++ json-c-0.12/json_object.h 2016-01-05 15:00:16.371145307 +0800
@@ -624,6 +624,8 @@
int idx);
#endif
+int json_object_set_param(struct json_object *obj, char *v);
+
#ifdef __cplusplus
}
#endif