netifd: Fix multiple -Wsign-compare warnings
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 12 Feb 2023 20:07:31 +0000 (21:07 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 19 Feb 2023 15:08:28 +0000 (16:08 +0100)
This fixes warnings like this:
warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]

Mostly this was an int compared to a size_t returned by ARRAY_SIZE().
The easiest fix is to count on the size_t type.

The ifindex is sometimes an unsigned int and sometimes a signed int in
the kernel interfaces. I think it normally fits into an unsigned 16 bit
value, so this should be fine. Do the one comparison where the
compiler complains as a long.

Casting the result of sizeof() to int should be safe. These values are
never out of range of int.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

No differences found