From 551512ad543e830447479aa0f9e873c590720f15 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Thu, 17 May 2012 07:16:02 +0000 Subject: [PATCH] Do not cast pointers to different size integers It will work only on little endian machines. Fix clang warning pn53x-tamashell.c:163:40: warning: cast from 'uint8_t *' (aka 'unsigned char *') to 'unsigned int *' increases required alignment from 1 to 4 [-Wcast-align] size = sscanf(cmd+offset, "%2x", (unsigned int*)&byte); ^~~~~~~~~~~~~~~~~~~~ --- examples/pn53x-tamashell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index 933e6a8..21d9284 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -156,11 +156,11 @@ int main(int argc, const char* argv[]) szTx = 0; for(int i = 0; i < MAX_FRAME_LEN - 10; i++) { int size; - uint8_t byte; + unsigned int byte; while (isspace(cmd[offset])) { offset++; } - size = sscanf(cmd+offset, "%2x", (unsigned int*)&byte); + size = sscanf(cmd+offset, "%2x", &byte); if (size < 1 ) { break; }