]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: fix incorrect pointer cast (non-aligned memory and endiannes issue)
authorAurelien Jacobs <redacted>
Fri, 27 Dec 2013 16:29:03 +0000 (17:29 +0100)
committerUwe Hermann <redacted>
Fri, 27 Dec 2013 16:36:08 +0000 (17:36 +0100)
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;
    ^

hardware/asix-sigma/asix-sigma.c

index 70a9d7731d35e50e249c213680b29e8f822fa7ab..a7a1d46a1d66da61df5a032f68bae31a1585fb39 100644 (file)
@@ -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;
                }