latester: Fix GCC 4.9 warnings
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 17 Oct 2014 13:35:46 +0000 (15:35 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 17 Oct 2014 13:35:46 +0000 (15:35 +0200)
latester/canframelen.c

index 1fa6252..0859d48 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdbool.h>
 #include <string.h>
 #include <assert.h>
+#include <arpa/inet.h>
 
 /**
  * Functions and types for CRC checks.
@@ -126,7 +127,7 @@ unsigned calc_frame_length(struct can_frame *frame)
                bitmap[4] = (frame->can_id & 0x1) << 7              |
                            (!!(frame->can_id & CAN_RTR_FLAG)) << 6 |
                            0 << 4                                  | /* r1, r0 */
-                           frame->can_dlc & 0xf;
+                           (frame->can_dlc & 0xf);
                memcpy(&bitmap[5], &frame->data, frame->can_dlc);
                start = 1;
                end = 40 + 8*frame->can_dlc;
@@ -137,10 +138,10 @@ unsigned calc_frame_length(struct can_frame *frame)
                // bitmap[8-11] |55555555 66666666 77777777 ........| Data bytes
                bitmap[0] = (frame->can_id & CAN_SFF_MASK) >> 9;
                bitmap[1] = (frame->can_id >> 1) & 0xff;
-               bitmap[2] = (frame->can_id << 7) & 0xff |
+               bitmap[2] = ((frame->can_id << 7) & 0xff) |
                            (!!(frame->can_id & CAN_RTR_FLAG)) << 6 |
                            0 << 4 | /* IDE, r0 */
-                           frame->can_dlc & 0xf;
+                           (frame->can_dlc & 0xf);
                memcpy(&bitmap[3], &frame->data, frame->can_dlc);
                start = 5;
                end = 24 + 8*frame->can_dlc;