[LEDE-DEV] [PATCH] libubox: Fix -Wsign-compare and sign conversion warnings

Yousong Zhou yszhou4tech at gmail.com
Tue Mar 21 07:22:06 PDT 2017


On 29 January 2017 at 09:11, Rosen Penev <rosenp at gmail.com> wrote:
> While at it, also add -Wextra and -Wno-unused-parameter to the
> CFLAGS. Compile tested on 32 and 64-bit x86.
>
> Signed-off by: Rosen Penev <rosenp at gmail.com>

Sorry for the delay, but I just also compile-tested this ;)

With gcc 4.7.2, the following further changes are needed to compile the code.
Can you take them and send a v2?

Regards,
                yousong

diff --git a/examples/blobmsg-example.c b/examples/blobmsg-example.c
index 1c86017..56cac27 100644
--- a/examples/blobmsg-example.c
+++ b/examples/blobmsg-example.c
@@ -15,7 +15,7 @@ static const char *indent_str = "\t\t\t\t\t\t\t\t\t\t\t\t\t";
 static void dump_attr_data(struct blob_attr *data, int indent, int next_indent);
 
 static void
-dump_table(struct blob_attr *head, int len, int indent, bool array)
+dump_table(struct blob_attr *head, size_t len, int indent, bool array)
 {
 	struct blob_attr *attr;
 	struct blobmsg_hdr *hdr;
diff --git a/examples/json_script-example.c b/examples/json_script-example.c
index 4d252a9..afb419e 100644
--- a/examples/json_script-example.c
+++ b/examples/json_script-example.c
@@ -1,7 +1,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <json.h>
+#ifdef JSONC
+    #include <json.h>
+#else
+    #include <json/json.h>
+#endif
 #include "blobmsg.h"
 #include "blobmsg_json.h"
 #include "json_script.h"
@@ -14,7 +18,7 @@ static void handle_command(struct json_script_ctx *ctx, const char *name,
 	struct blob_attr *data, struct blob_attr *vars)
 {
 	struct blob_attr *cur;
-	int rem;
+	size_t rem;
 
 	fprintf(stdout, "%s", name);
 	blobmsg_for_each_attr(cur, data, rem)
diff --git a/json_script.c b/json_script.c
index 2d720ae..ae1fa34 100644
--- a/json_script.c
+++ b/json_script.c
@@ -121,8 +121,6 @@ json_get_tuple(struct blob_attr *cur, struct blob_attr **tb, int t1, int t2)
 {
 	static struct blobmsg_policy expr_tuple[3] = {
 		{ .type = BLOBMSG_TYPE_STRING },
-		{},
-		{},
 	};
 
 	expr_tuple[1].type = t1;
-- 
2.6.4




More information about the Lede-dev mailing list