aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-api-dbus.c4
-rw-r--r--src/afb-hreq.c4
-rw-r--r--src/afb-ws-json1.c2
-rw-r--r--src/afb-wsj1.c12
4 files changed, 11 insertions, 11 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c
index f4fd0eba..c0bc57a8 100644
--- a/src/afb-api-dbus.c
+++ b/src/afb-api-dbus.c
@@ -423,7 +423,7 @@ static void dbus_req_reply(struct dbus_req *dreq, uint8_t type, const char *firs
static void dbus_req_success(struct dbus_req *dreq, struct json_object *obj, const char *info)
{
- dbus_req_reply(dreq, RETOK, json_object_to_json_string(obj), info);
+ dbus_req_reply(dreq, RETOK, json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN), info);
}
static void dbus_req_fail(struct dbus_req *dreq, const char *status, const char *info)
@@ -516,7 +516,7 @@ static void afb_api_dbus_server_send_event(struct api_dbus *api, const char *eve
int rc;
rc = sd_bus_emit_signal(api->sdbus, api->path, api->name,
- "event", "ss", event, json_object_to_json_string(object));
+ "event", "ss", event, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN));
if (rc < 0)
ERROR("error while emiting event %s", event);
json_object_put(object);
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index 4239670d..ab174e2f 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -677,7 +677,7 @@ static void req_send(struct afb_hreq *hreq, const char *buffer, size_t size)
static ssize_t send_json_cb(json_object *obj, uint64_t pos, char *buf, size_t max)
{
- ssize_t len = stpncpy(buf, json_object_to_json_string(obj)+pos, max) - buf;
+ ssize_t len = stpncpy(buf, json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)+pos, max) - buf;
return len ? : (ssize_t)MHD_CONTENT_READER_END_OF_STREAM;
}
@@ -698,7 +698,7 @@ static void req_reply(struct afb_hreq *hreq, unsigned retcode, const char *statu
if (reqid != NULL && json_object_object_get_ex(reply, "request", &request))
json_object_object_add (request, short_key_for_reqid, json_object_new_string(reqid));
- response = MHD_create_response_from_callback((uint64_t)strlen(json_object_to_json_string(reply)), SIZE_RESPONSE_BUFFER, (void*)send_json_cb, reply, (void*)json_object_put);
+ response = MHD_create_response_from_callback((uint64_t)strlen(json_object_to_json_string_ext(reply, JSON_C_TO_STRING_PLAIN)), SIZE_RESPONSE_BUFFER, (void*)send_json_cb, reply, (void*)json_object_put);
afb_hreq_reply(hreq, retcode, response, NULL);
}
diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c
index 9e20e7d9..88f9b358 100644
--- a/src/afb-ws-json1.c
+++ b/src/afb-ws-json1.c
@@ -416,7 +416,7 @@ static void aws_emit(struct afb_ws_json1 *aws, int code, const char *id, size_t
json_object_array_add(msg, json_object_new_string(token));
/* emits the reply */
- txt = json_object_to_json_string(msg);
+ txt = json_object_to_json_string_ext(msg, JSON_C_TO_STRING_PLAIN);
afb_ws_text(aws->ws, txt, strlen(txt));
json_object_put(msg);
}
diff --git a/src/afb-wsj1.c b/src/afb-wsj1.c
index df4a2344..7f030a0c 100644
--- a/src/afb-wsj1.c
+++ b/src/afb-wsj1.c
@@ -427,18 +427,18 @@ struct afb_wsj1 *afb_wsj1_msg_wsj1(struct afb_wsj1_msg *msg)
static int wsj1_send_isot(struct afb_wsj1 *wsj1, int i1, const char *s1, const char *o1, const char *t1)
{
char code[2] = { (char)('0' + i1), 0 };
- return afb_ws_texts(wsj1->ws, "[", code, ",\"", s1, "\",", o1, t1 != NULL ? ",\"" : "]", t1, "\"]", NULL);
+ return afb_ws_texts(wsj1->ws, "[", code, ",\"", s1, "\",", o1 == NULL ? "null" : o1, t1 != NULL ? ",\"" : "]", t1, "\"]", NULL);
}
static int wsj1_send_issot(struct afb_wsj1 *wsj1, int i1, const char *s1, const char *s2, const char *o1, const char *t1)
{
char code[2] = { (char)('0' + i1), 0 };
- return afb_ws_texts(wsj1->ws, "[", code, ",\"", s1, "\",\"", s2, "\",", o1, t1 != NULL ? ",\"" : "]", t1, "\"]", NULL);
+ return afb_ws_texts(wsj1->ws, "[", code, ",\"", s1, "\",\"", s2, "\",", o1 == NULL ? "null" : o1, t1 != NULL ? ",\"" : "]", t1, "\"]", NULL);
}
int afb_wsj1_send_event_j(struct afb_wsj1 *wsj1, const char *event, struct json_object *object)
{
- return afb_wsj1_send_event_s(wsj1, event, json_object_to_json_string(object));
+ return afb_wsj1_send_event_s(wsj1, event, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN));
}
int afb_wsj1_send_event_s(struct afb_wsj1 *wsj1, const char *event, const char *object)
@@ -448,7 +448,7 @@ int afb_wsj1_send_event_s(struct afb_wsj1 *wsj1, const char *event, const char *
int afb_wsj1_call_j(struct afb_wsj1 *wsj1, const char *api, const char *verb, struct json_object *object, void (*on_reply)(void *closure, struct afb_wsj1_msg *msg), void *closure)
{
- return afb_wsj1_call_s(wsj1, api, verb, json_object_to_json_string(object), on_reply, closure);
+ return afb_wsj1_call_s(wsj1, api, verb, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN), on_reply, closure);
}
int afb_wsj1_call_s(struct afb_wsj1 *wsj1, const char *api, const char *verb, const char *object, void (*on_reply)(void *closure, struct afb_wsj1_msg *msg), void *closure)
@@ -480,7 +480,7 @@ int afb_wsj1_call_s(struct afb_wsj1 *wsj1, const char *api, const char *verb, co
int afb_wsj1_reply_ok_j(struct afb_wsj1_msg *msg, struct json_object *object, const char *token)
{
- return afb_wsj1_reply_ok_s(msg, json_object_to_json_string(object), token);
+ return afb_wsj1_reply_ok_s(msg, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN), token);
}
int afb_wsj1_reply_ok_s(struct afb_wsj1_msg *msg, const char *object, const char *token)
@@ -490,7 +490,7 @@ int afb_wsj1_reply_ok_s(struct afb_wsj1_msg *msg, const char *object, const char
int afb_wsj1_reply_error_j(struct afb_wsj1_msg *msg, struct json_object *object, const char *token)
{
- return afb_wsj1_reply_error_s(msg, json_object_to_json_string(object), token);
+ return afb_wsj1_reply_error_s(msg, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN), token);
}
int afb_wsj1_reply_error_s(struct afb_wsj1_msg *msg, const char *object, const char *token)