From ef315ed66215c95b998c523704de987ae073d5cc Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de> Date: Sat, 21 Dec 2013 16:56:42 +0100 Subject: [PATCH] improve nativenet send functions return type --- cpu/native/include/nativenet_internal.h | 1 + cpu/native/include/tap.h | 1 - cpu/native/net/tap.c | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/native/include/nativenet_internal.h b/cpu/native/include/nativenet_internal.h index 80879203a8..58a2f2d7c1 100644 --- a/cpu/native/include/nativenet_internal.h +++ b/cpu/native/include/nativenet_internal.h @@ -40,4 +40,5 @@ struct rx_buffer_s { extern struct rx_buffer_s _nativenet_rx_buffer[RX_BUF_SIZE]; void _nativenet_handle_packet(radio_packet_t *packet); +int8_t send_buf(radio_packet_t *packet); #endif /* NATIVENET_INTERNAL_H */ diff --git a/cpu/native/include/tap.h b/cpu/native/include/tap.h index 719c0b351b..9a20295caf 100644 --- a/cpu/native/include/tap.h +++ b/cpu/native/include/tap.h @@ -31,7 +31,6 @@ * On OSX a name has to be provided. */ int tap_init(char *name); -int send_buf(radio_packet_t *packet); extern int _native_tap_fd; extern unsigned char _native_tap_mac[ETHER_ADDR_LEN]; diff --git a/cpu/native/net/tap.c b/cpu/native/net/tap.c index d4be66bd0a..df6fd94ed7 100644 --- a/cpu/native/net/tap.c +++ b/cpu/native/net/tap.c @@ -162,7 +162,7 @@ int _native_marshall_ethernet(uint8_t *framebuf, radio_packet_t *packet) return data_len + ETHER_HDR_LEN; } -int send_buf(radio_packet_t *packet) +int8_t send_buf(radio_packet_t *packet) { uint8_t buf[TAP_BUFFER_LENGTH]; int nsent, to_send; @@ -178,7 +178,7 @@ int send_buf(radio_packet_t *packet) warn("write"); return -1; } - return 0; + return (nsent > INT8_MAX ? INT8_MAX : nsent); } int tap_init(char *name) -- GitLab