Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2020-01-14 11:05:02 +0300
committerPetr Štetiar <ynezz@true.cz>2020-01-20 18:54:10 +0300
commit1ffa41535369f5bb67d1eb5bdcb306671ca1d2e4 (patch)
tree2bf73fcad0d352cef827f4cd2d5008af4c36c4fb /tests/test-blobmsg.c
parent132ecb563da794f390209c20f94d4798839dc709 (diff)
blobmsg_json: prefer snprintf usage
Better safe than sorry and while at it prefer use of PRId16 and PRId32 formatting constants as well. Reviewed-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'tests/test-blobmsg.c')
-rw-r--r--tests/test-blobmsg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test-blobmsg.c b/tests/test-blobmsg.c
index 58b0bc4..2224853 100644
--- a/tests/test-blobmsg.c
+++ b/tests/test-blobmsg.c
@@ -1,4 +1,6 @@
#include <stdio.h>
+#include <float.h>
+#include <limits.h>
#include <stdint.h>
#include <inttypes.h>
@@ -117,7 +119,8 @@ fill_message(struct blob_buf *buf)
blobmsg_add_string(buf, "message", "Hello, world!");
tbl = blobmsg_open_table(buf, "testdata");
- blobmsg_add_double(buf, "double", 1.337e2);
+ blobmsg_add_double(buf, "dbl-min", DBL_MIN);
+ blobmsg_add_double(buf, "dbl-max", DBL_MAX);
blobmsg_add_u8(buf, "foo", 0);
blobmsg_add_u8(buf, "poo", 100);
blobmsg_add_u8(buf, "moo-min", INT8_MIN);
@@ -142,7 +145,8 @@ fill_message(struct blob_buf *buf)
blobmsg_add_u32(buf, NULL, INT32_MAX);
blobmsg_add_u64(buf, NULL, INT64_MIN);
blobmsg_add_u64(buf, NULL, INT64_MAX);
- blobmsg_add_double(buf, "double", 1.337e2);
+ blobmsg_add_double(buf, NULL, DBL_MIN);
+ blobmsg_add_double(buf, NULL, DBL_MAX);
blobmsg_close_table(buf, tbl);
}