summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2013-03-12 11:46:18 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-03-25 10:45:06 +0100
commitc23787a4da6b2d9f9ce79c3dfd990df32488ac9c (patch)
tree8561a7b2e8c09233fa0161b4e8720f964e11528b /tools
parent94d3d302c1fd9efaed320b26f4f4df6516e1305a (diff)
downloadneard-c23787a4da6b2d9f9ce79c3dfd990df32488ac9c.tar.gz
neard-c23787a4da6b2d9f9ce79c3dfd990df32488ac9c.tar.bz2
neard-c23787a4da6b2d9f9ce79c3dfd990df32488ac9c.zip
nfctool: Fix pointer casting errors on ARM
On GLib 2.28, Macro GINT_TO_POINTER on ARM will fail as it won't cast implicitly to int before casting to gpointer. It results in casting uint8 directly to void *, which will not do the job on some ARM processors. Error message: tools/nfctool/netlink.c: In function ‘nl_nfc_event_cb’: tools/nfctool/netlink.c:686:39: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] tools/nfctool/netlink.c: In function ‘nl_add_event_handler’: tools/nfctool/netlink.c:731:35: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
Diffstat (limited to 'tools')
-rw-r--r--tools/nfctool/netlink.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/nfctool/netlink.c b/tools/nfctool/netlink.c
index dd0bef6..1d4e2bf 100644
--- a/tools/nfctool/netlink.c
+++ b/tools/nfctool/netlink.c
@@ -671,6 +671,7 @@ static int nl_nfc_event_cb(struct nl_msg *n, void *arg)
guint32 idx = INVALID_ADAPTER_IDX;
struct nlattr *attr[NFC_ATTR_MAX + 1];
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(n));
+ guint32 cmd = gnlh->cmd;
nfc_event_cb_t cb = NULL;
DBG("Received cmd %d", gnlh->cmd);
@@ -682,12 +683,12 @@ static int nl_nfc_event_cb(struct nl_msg *n, void *arg)
idx = nla_get_u32(attr[NFC_ATTR_DEVICE_INDEX]);
if (handlers != NULL)
- cb = g_hash_table_lookup(handlers, GINT_TO_POINTER(gnlh->cmd));
+ cb = g_hash_table_lookup(handlers, GINT_TO_POINTER(cmd));
if (cb == NULL)
return NL_SKIP;
- switch (gnlh->cmd) {
+ switch (cmd) {
case NFC_EVENT_LLC_SDRES:
DBG("Received NFC_EVENT_LLC_SDRES\n");
nl_nfc_send_sdres_event(idx, attr[NFC_ATTR_LLC_SDP], cb);
@@ -726,8 +727,10 @@ static gboolean nl_gio_handler(GIOChannel *channel,
void nl_add_event_handler(guint8 cmd, nfc_event_cb_t cb)
{
+ guint32 c = cmd;
+
if (handlers != NULL)
- g_hash_table_replace(handlers, GINT_TO_POINTER(cmd), cb);
+ g_hash_table_replace(handlers, GINT_TO_POINTER(c), cb);
}
void nl_cleanup(void)