Skip to content

Commit b301113

Browse files
committed
add a couple explicit type casts
1 parent 03c7060 commit b301113

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

core/src/main/c/common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ inline int create_can_isotp_socket() {
4747
int bind_can_socket(int sock, uint32_t interface, uint32_t rx, uint32_t tx) {
4848
struct sockaddr_can addr = {0};
4949
addr.can_family = AF_CAN;
50-
addr.can_ifindex = interface;
50+
addr.can_ifindex = (int) interface;
5151
addr.can_addr.tp.rx_id = rx;
5252
addr.can_addr.tp.tx_id = tx;
5353

@@ -57,7 +57,7 @@ int bind_can_socket(int sock, uint32_t interface, uint32_t rx, uint32_t tx) {
5757
int connect_can_socket(int sock, uint32_t interface, uint32_t rx, uint32_t tx) {
5858
struct sockaddr_can addr = {0};
5959
addr.can_family = AF_CAN;
60-
addr.can_ifindex = interface;
60+
addr.can_ifindex = (int) interface;
6161
addr.can_addr.tp.rx_id = rx;
6262
addr.can_addr.tp.tx_id = tx;
6363

@@ -67,8 +67,8 @@ int connect_can_socket(int sock, uint32_t interface, uint32_t rx, uint32_t tx) {
6767
int set_timeout(int sock, int type, uint64_t seconds, uint64_t nanos) {
6868
socklen_t timeout_len = sizeof(struct timeval);
6969
struct timeval timeout;
70-
timeout.tv_sec = seconds;
71-
timeout.tv_usec = nanos / 1000;
70+
timeout.tv_sec = (__time_t) seconds;
71+
timeout.tv_usec = (__suseconds_t) nanos / 1000;
7272

7373
return setsockopt(sock, SOL_SOCKET, type, &timeout, timeout_len);
7474
}

0 commit comments

Comments
 (0)