summaryrefslogtreecommitdiffstats
path: root/lib/utils.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2024-05-29 16:01:34 (GMT)
committerThomas Haller <thaller@redhat.com>2024-05-29 18:03:38 (GMT)
commit5248e1a45576617b349465997822cef34cbc5053 (patch)
tree4e4e588cda887f1691afdea3186b4b413bf5e966 /lib/utils.c
parent9451842e1109d909a7803db2266ccb1f8f00eef2 (diff)
downloadlibnl-5248e1a45576617b349465997822cef34cbc5053.zip
libnl-5248e1a45576617b349465997822cef34cbc5053.tar.gz
libnl-5248e1a45576617b349465997822cef34cbc5053.tar.bz2
all: fix and enable "-Wsign-compare" warning
Diffstat (limited to 'lib/utils.c')
-rw-r--r--lib/utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/utils.c b/lib/utils.c
index 1d56f1d..679078e 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1069,14 +1069,15 @@ char *__type2str(int type, char *buf, size_t len,
const struct trans_tbl *tbl, size_t tbl_len)
{
size_t i;
+
for (i = 0; i < tbl_len; i++) {
- if (tbl[i].i == type) {
+ if (tbl[i].i == ((uint64_t)type)) {
snprintf(buf, len, "%s", tbl[i].a);
return buf;
}
}
- snprintf(buf, len, "0x%x", type);
+ snprintf(buf, len, "0x%x", (unsigned)type);
return buf;
}
@@ -1169,7 +1170,7 @@ int __str2flags(const char *buf, const struct trans_tbl *tbl, size_t tbl_len)
p++;
t = strchr(p, ',');
- len = t ? t - p : strlen(p);
+ len = t ? ((size_t)(t - p)) : strlen(p);
for (i = 0; i < tbl_len; i++)
if (len == strlen(tbl[i].a) &&
!strncasecmp(tbl[i].a, p, len))