From b0c393647713866d33bef5bc2cdf18bfe51a1ba6 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 4 Sep 2017 06:09:08 -0300 Subject: [PATCH] Fix clang warnings about comparing uint32 < 0 (#10) * Fix clang warnings about comparing uint32 < 0 clangs complains about an uint32 compared to < 0: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] So remove these comparisos and an uint32 never will be less than 0. Signed-off-by: Marcos Paulo de Souza * module-jack.c: Differentiate error msg from protocol-native Signed-off-by: Marcos Paulo de Souza --- spa/plugins/alsa/alsa-monitor.c | 2 +- spa/plugins/alsa/alsa-source.c | 2 +- spa/plugins/v4l2/v4l2-monitor.c | 2 +- spa/plugins/v4l2/v4l2-source.c | 2 +- src/modules/module-jack.c | 2 +- src/modules/module-protocol-native/connection.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spa/plugins/alsa/alsa-monitor.c b/spa/plugins/alsa/alsa-monitor.c index a64a7a649..b86d3bc8f 100644 --- a/spa/plugins/alsa/alsa-monitor.c +++ b/spa/plugins/alsa/alsa-monitor.c @@ -548,7 +548,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory, spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS); spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS); - if (index < 0 || index >= SPA_N_ELEMENTS(impl_interfaces)) + if (index >= SPA_N_ELEMENTS(impl_interfaces)) return SPA_RESULT_ENUM_END; *info = &impl_interfaces[index]; diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c index 282316049..3c7af64ff 100644 --- a/spa/plugins/alsa/alsa-source.c +++ b/spa/plugins/alsa/alsa-source.c @@ -741,7 +741,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory, spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS); spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS); - if (index < 0 || index >= SPA_N_ELEMENTS(impl_interfaces)) + if (index >= SPA_N_ELEMENTS(impl_interfaces)) return SPA_RESULT_ENUM_END; *info = &impl_interfaces[index]; diff --git a/spa/plugins/v4l2/v4l2-monitor.c b/spa/plugins/v4l2/v4l2-monitor.c index 8f756c3f6..a50f6e543 100644 --- a/spa/plugins/v4l2/v4l2-monitor.c +++ b/spa/plugins/v4l2/v4l2-monitor.c @@ -415,7 +415,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory, spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS); spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS); - if (index < 0 || index >= SPA_N_ELEMENTS(impl_interfaces)) + if (index >= SPA_N_ELEMENTS(impl_interfaces)) return SPA_RESULT_ENUM_END; *info = &impl_interfaces[index]; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 027d84eed..fe5fbf409 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -985,7 +985,7 @@ static int impl_enum_interface_info(const struct spa_handle_factory *factory, spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS); spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS); - if (index < 0 || index >= SPA_N_ELEMENTS(impl_interfaces)) + if (index >= SPA_N_ELEMENTS(impl_interfaces)) return SPA_RESULT_ENUM_END; *info = &impl_interfaces[index]; diff --git a/src/modules/module-jack.c b/src/modules/module-jack.c index 197260e53..7d56c2519 100644 --- a/src/modules/module-jack.c +++ b/src/modules/module-jack.c @@ -989,7 +989,7 @@ connection_data(void *data, int fd, enum spa_io mask) struct client *client = data; if (mask & (SPA_IO_ERR | SPA_IO_HUP)) { - pw_log_error("protocol-native %p: got connection error", client->impl); + pw_log_error("jack %p: got connection error", client->impl); client_killed(client); return; } diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c index ce9a89c57..2285ac992 100644 --- a/src/modules/module-protocol-native/connection.c +++ b/src/modules/module-protocol-native/connection.c @@ -75,7 +75,7 @@ int pw_protocol_native_connection_get_fd(struct pw_protocol_native_connection *c { struct impl *impl = SPA_CONTAINER_OF(conn, struct impl, this); - if (index < 0 || index >= impl->in.n_fds) + if (index >= impl->in.n_fds) return -1; return impl->in.fds[index];