Skip to content
Snippets Groups Projects
Commit c7e47c63 authored by Philippe Mathieu-Daudé's avatar Philippe Mathieu-Daudé Committed by Marc-André Lureau
Browse files

char: cast ARRAY_SIZE() as signed to silent warning on empty array


chardev/char.c: In function 'chardev_name_foreach':
chardev/char.c:546:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
     for (i = 0; i < ARRAY_SIZE(chardev_alias_table); i++) {
                   ^
Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170530120919.8874-1-f4bug@amsat.org>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 43771d5d
No related branches found
No related tags found
No related merge requests found
......@@ -841,7 +841,7 @@ chardev_name_foreach(void (*fn)(const char *name, void *opaque), void *opaque)
object_class_foreach(chardev_class_foreach, TYPE_CHARDEV, false, &fe);
for (i = 0; i < ARRAY_SIZE(chardev_alias_table); i++) {
for (i = 0; i < (int)ARRAY_SIZE(chardev_alias_table); i++) {
fn(chardev_alias_table[i].alias, opaque);
}
}
......@@ -887,7 +887,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
return NULL;
}
for (i = 0; i < ARRAY_SIZE(chardev_alias_table); i++) {
for (i = 0; i < (int)ARRAY_SIZE(chardev_alias_table); i++) {
if (g_strcmp0(chardev_alias_table[i].alias, name) == 0) {
name = chardev_alias_table[i].typename;
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment