snep-validation: Fix compilation on ARM due to unaligned memory access
authorSzymon Janc <szymon.janc@tieto.com>
Mon, 25 Mar 2013 10:47:55 +0000 (11:47 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 28 Mar 2013 15:35:37 +0000 (16:35 +0100)
Use near_get_be32 helper function to access nfc_data. Although there is
most likely no risk of unaligned access since nfc_data is allocated
from heap (and properly alligned as access starts from first byte) this
result in compilation error on ARM (Debian GCC 4.6.3).

plugins/snep-validation.c: In function ‘snep_validation_server_req_get’:
plugins/snep-validation.c:155:22: error: cast increases required alignment
  of target type [-Werror=cast-align]
cc1: all warnings being treated as errors
make[1]: *** [plugins/snep-validation.o] Error 1
make: *** [all] Error 2

plugins/snep-validation.c

index 2094630..682a090 100644 (file)
@@ -152,7 +152,7 @@ static near_bool_t snep_validation_server_req_get(int client_fd, void *data)
        /* check if the acceptable length is higher than the data_len
         * otherwise returns a NEAR_SNEP_RESP_EXCESS
         */
-       acceptable_length = GUINT32_FROM_BE(*(uint32_t *)snep_data->nfc_data);
+       acceptable_length = near_get_be32(snep_data->nfc_data);
 
        /* Look if there are some incoming ndef stored */
        incoming_ndefs = g_hash_table_lookup(snep_validation_hash,