[linux-nfc] [neard][PATCH v2 05/73] nfctool: fix adapter_compare_idx() cast-function-type

Krzysztof Kozlowski <[email protected]> Mon, 19 Jul 2021 13:07:11 +0200
Newsgroups org.01.lists.linux-nfc,dev.linux.lists.oe-linux-nfc
Message-ID <[email protected]>
Fix on GCC v10:

    tools/nfctool/adapter.c: In function ‘adapter_get’:
    tools/nfctool/adapter.c:155:8: error: cast between incompatible function types from ‘gint (*)(struct nfc_adapter *, guint32)’ {aka ‘int (*)(struct nfc_adapter *, unsigned int)’} to ‘gint (*)(const void *, const void *)’ {aka ‘int (*)(const void *, const void *)’} [-Werror=cast-function-type]
      155 |        (GCompareFunc)adapter_compare_idx);
          |        ^

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
 tools/nfctool/adapter.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/nfctool/adapter.c b/tools/nfctool/adapter.c
index 5e3bf41884d1..343c4ab7d0ff 100644
--- a/tools/nfctool/adapter.c
+++ b/tools/nfctool/adapter.c
@@ -139,9 +139,11 @@ void adapter_idx_print_info(guint32 idx)
 		g_slist_foreach(adapters, (GFunc)adapter_print_info, NULL);
 }
 
-static gint adapter_compare_idx(struct nfc_adapter *adapter, guint32 idx)
+static gint adapter_compare_idx(struct nfc_adapter *adapter, gpointer idx_ptr)
 {
-	return (gint)adapter->idx - (gint)idx;
+	gint idx = GPOINTER_TO_INT(idx_ptr);
+
+	return (gint)adapter->idx - idx;
 }
 
 struct nfc_adapter *adapter_get(guint32 idx)
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s