From f4c345b41b6c40c2d57c700fbbff31a92647a2dc Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 17 Sep 2020 17:00:09 +0200 Subject: [PATCH 2/5] lib/json/src: use fmt to avoid newlib issue --- lib/json/src/json_encode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/json/src/json_encode.c b/lib/json/src/json_encode.c index 4de928e..377fd18 100644 --- a/lib/json/src/json_encode.c +++ b/lib/json/src/json_encode.c @@ -21,6 +21,8 @@ #include #include +#include "fmt.h" + #ifdef __KERNEL__ #include #else @@ -70,13 +72,11 @@ json_encode_value(struct json_encoder *encoder, struct json_value *jv) encoder->je_write(encoder->je_arg, encoder->je_encode_buf, len); break; case JSON_VALUE_TYPE_UINT64: - len = sprintf(encoder->je_encode_buf, "%" PRIu64, - jv->jv_val.u); + len = fmt_u64_dec(encoder->je_encode_buf, jv->jv_val.u); encoder->je_write(encoder->je_arg, encoder->je_encode_buf, len); break; case JSON_VALUE_TYPE_INT64: - len = sprintf(encoder->je_encode_buf, "%" PRIi64, - jv->jv_val.u); + len = fmt_s64_dec(encoder->je_encode_buf, jv->jv_val.u); encoder->je_write(encoder->je_arg, encoder->je_encode_buf, len); break; case JSON_VALUE_TYPE_FLOAT64: -- 2.28.0