[OpenWrt-Devel] [PATCH iwinfo 2/2] Iron out all extra compiler warnings

Petr Štetiar ynezz at true.cz
Wed May 15 08:16:03 EDT 2019


iwinfo_lib.c:352:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lib.c:363:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lib.c:374:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lua.c:193:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lua.c:204:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lua.c:215:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lua.c:226:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_lua.c:541:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_cli.c:769:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
iwinfo_cli.c:824:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 iwinfo_cli.c | 7 ++++---
 iwinfo_lib.c | 6 +++---
 iwinfo_lua.c | 5 +++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index dba752999996..8f80aa41cd20 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -758,7 +758,8 @@ static void print_countrylist(const struct iwinfo_ops *iw, const char *ifname)
 
 static void print_htmodelist(const struct iwinfo_ops *iw, const char *ifname)
 {
-	int i, htmodes = 0;
+	unsigned int i;
+	int htmodes = 0;
 
 	if (iw->htmodelist(ifname, &htmodes))
 	{
@@ -821,9 +822,9 @@ int main(int argc, char **argv)
 	{
 		glob("/sys/class/net/*", 0, NULL, &globbuf);
 
-		for (i = 0; i < globbuf.gl_pathc; i++)
+		for (unsigned int y = 0; y < globbuf.gl_pathc; y++)
 		{
-			p = strrchr(globbuf.gl_pathv[i], '/');
+			p = strrchr(globbuf.gl_pathv[y], '/');
 
 			if (!p)
 				continue;
diff --git a/iwinfo_lib.c b/iwinfo_lib.c
index fa9bb9f14f4c..e2c3db1b32c8 100644
--- a/iwinfo_lib.c
+++ b/iwinfo_lib.c
@@ -347,7 +347,7 @@ const char * iwinfo_type(const char *ifname)
 
 const struct iwinfo_ops * iwinfo_backend(const char *ifname)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(backends); i++)
 		if (backends[i]->probe(ifname))
@@ -358,7 +358,7 @@ const struct iwinfo_ops * iwinfo_backend(const char *ifname)
 
 const struct iwinfo_ops * iwinfo_backend_by_name(const char *name)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(backends); i++)
 		if (!strcmp(backends[i]->name, name))
@@ -369,7 +369,7 @@ const struct iwinfo_ops * iwinfo_backend_by_name(const char *name)
 
 void iwinfo_finish(void)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(backends); i++)
 		backends[i]->close();
diff --git a/iwinfo_lua.c b/iwinfo_lua.c
index bb43438d8dd5..391ec02c5e8a 100644
--- a/iwinfo_lua.c
+++ b/iwinfo_lua.c
@@ -173,7 +173,7 @@ static char * iwinfo_crypto_desc(struct iwinfo_crypto_entry *c)
 /* Build Lua table from crypto data */
 static void iwinfo_L_cryptotable(lua_State *L, struct iwinfo_crypto_entry *c)
 {
-	int i, j;
+	unsigned int i, j;
 
 	lua_newtable(L);
 
@@ -532,7 +532,8 @@ static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char *, int *))
 static int iwinfo_L_htmodelist(lua_State *L, int (*func)(const char *, int *))
 {
 	const char *ifname = luaL_checkstring(L, 1);
-	int i, htmodes = 0;
+	int htmodes = 0;
+	unsigned int i;
 
 	if (!(*func)(ifname, &htmodes))
 	{
-- 
1.9.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list