[libglnx/wip/smcv/warnings: 5/7] tests: Make iterator signedness agree with limit
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx/wip/smcv/warnings: 5/7] tests: Make iterator signedness agree with limit
- Date: Sun, 24 Apr 2022 10:09:26 +0000 (UTC)
commit 4c51a54c36eb1a9d728acb14a700271adc7e0ee4
Author: Simon McVittie <smcv collabora com>
Date: Sun Apr 24 11:06:51 2022 +0100
tests: Make iterator signedness agree with limit
g_variant_n_children() returns a size_t (or gsize, which is equivalent)
so in principle it could overflow an int, although in practice we are
not going to have that many extended attributes. This silences a
warning from gcc -Wsign-compare.
Signed-off-by: Simon McVittie <smcv collabora com>
tests/test-libglnx-xattrs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c
index b72b0d0..ad52b76 100644
--- a/tests/test-libglnx-xattrs.c
+++ b/tests/test-libglnx-xattrs.c
@@ -122,7 +122,7 @@ do_write_run (GLnxDirFdIterator *dfd_iter, GError **error)
if (!glnx_fd_get_all_xattrs (fd, ¤t_xattrs, NULL, error))
return FALSE;
- for (int i = 0; i < g_variant_n_children (current_xattrs); i++)
+ for (size_t i = 0; i < g_variant_n_children (current_xattrs); i++)
{
const char *name, *value;
g_variant_get_child (current_xattrs, i, "(^&ay^&ay)", &name, &value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]