can-utils: fix sign-compare warnings
Fixing following build issues seen when building with clang (AOSP14):
cansend.c:168:11: error: comparison of integers of different signs:
'int' and 'unsigned long' [-Werror,-Wsign-compare]
if (mtu >= CANXL_MIN_MTU) {
~~~ ^ ~~~~~~~~~~~~~
lib.c:525:14: error: comparison of integers of different signs: 'int'
and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (maxsize > size - 1) {
~~~~~~~ ^ ~~~~~~~~
cangen.c:777:29: error: comparison of integers of different signs: 'int'
and 'unsigned long' [-Werror,-Wsign-compare]
if (canxl && (ifr.ifr_mtu < CANXL_MIN_MTU)) {
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
cangen.c:782:29: error: comparison of integers of different signs: 'int'
and 'unsigned long' [-Werror,-Wsign-compare]
if (canfd && (ifr.ifr_mtu < CANFD_MTU)) {
~~~~~~~~~~~ ^ ~~~~~~~~~
cangen.c:796:19: error: comparison of integers of different signs: 'int'
and 'unsigned long' [-Werror,-Wsign-compare]
if (ifr.ifr_mtu >= CANXL_MIN_MTU) {
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
cangen.c:1073:20: error: comparison of integers of different signs:
'int' and 'unsigned long' [-Werror,-Wsign-compare]
if (ifr.ifr_mtu >= CANXL_MIN_MTU)
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
candump.c:758:15: error: comparison of integers of different signs:
'int' and 'unsigned long' [-Werror,-Wsign-compare]
if (nbytes < CANXL_HDR_SIZE + CANXL_MIN_DLEN) {
~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
pull/512/head
parent
30a46d72bd
commit
f596f4ab47
|
|
@ -218,10 +218,10 @@ struct canxl_frame {
|
|||
__u8 data[CANXL_MAX_DLEN];
|
||||
};
|
||||
|
||||
#define CAN_MTU (sizeof(struct can_frame))
|
||||
#define CANFD_MTU (sizeof(struct canfd_frame))
|
||||
#define CANXL_MTU (sizeof(struct canxl_frame))
|
||||
#define CANXL_HDR_SIZE (offsetof(struct canxl_frame, data))
|
||||
#define CAN_MTU (int)(sizeof(struct can_frame))
|
||||
#define CANFD_MTU (int)(sizeof(struct canfd_frame))
|
||||
#define CANXL_MTU (int)(sizeof(struct canxl_frame))
|
||||
#define CANXL_HDR_SIZE (int)(offsetof(struct canxl_frame, data))
|
||||
#define CANXL_MIN_MTU (CANXL_HDR_SIZE + 64)
|
||||
#define CANXL_MAX_MTU CANXL_MTU
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue