From: Aurelien Jacobs Date: Fri, 27 Dec 2013 16:29:03 +0000 (+0100) Subject: asix-sigma: fix incorrect pointer cast (non-aligned memory and endiannes issue) X-Git-Tag: libsigrok-0.3.0~395 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c36923b03b343bcdbda55e5167a36e1c63b527a7;p=libsigrok.git asix-sigma: fix incorrect pointer cast (non-aligned memory and endiannes issue) This fixes the following warning: asix-sigma.c: In function 'receive_data': asix-sigma.c:1064:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] devc->state.lastts = *(uint16_t *) buf - 1; ^ --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 70a9d773..a7a1d46a 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -1061,7 +1061,7 @@ static int receive_data(int fd, int revents, void *cb_data) /* Find first ts. */ if (devc->state.chunks_downloaded == 0) { - devc->state.lastts = *(uint16_t *) buf - 1; + devc->state.lastts = RL16(buf) - 1; devc->state.lastsample = 0; }