From: Aurelien Jacobs Date: Thu, 4 Sep 2014 18:13:55 +0000 (+0200) Subject: linux_termios: fix return types to actually match returned values X-Git-Tag: libserialport-0.1.1~103 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=546e9ae5c5b2fd488bb4267c0dfa57cdc751fb88;p=libserialport.git linux_termios: fix return types to actually match returned values This fixes the following warning : linux_termios.c: In function 'get_termios_get_ioctl': linux_termios.c:42:2: warning: overflow in implicit constant conversion [-Woverflow] return TCGETS2; ^ This fixes bug #396. --- diff --git a/linux_termios.c b/linux_termios.c index 7c1540a..23c7ae9 100644 --- a/linux_termios.c +++ b/linux_termios.c @@ -33,10 +33,11 @@ * TCSETX/TCGETX ioctls used with struct termiox, others do not. */ +#include #include #include "linux_termios.h" -SP_PRIV int get_termios_get_ioctl(void) +SP_PRIV unsigned long get_termios_get_ioctl(void) { #ifdef HAVE_TERMIOS2 return TCGETS2; @@ -45,7 +46,7 @@ SP_PRIV int get_termios_get_ioctl(void) #endif } -SP_PRIV int get_termios_set_ioctl(void) +SP_PRIV unsigned long get_termios_set_ioctl(void) { #ifdef HAVE_TERMIOS2 return TCSETS2; @@ -54,7 +55,7 @@ SP_PRIV int get_termios_set_ioctl(void) #endif } -SP_PRIV int get_termios_size(void) +SP_PRIV size_t get_termios_size(void) { #ifdef HAVE_TERMIOS2 return sizeof(struct termios2); @@ -91,7 +92,7 @@ SP_PRIV void set_termios_speed(void *data, int speed) #endif #ifdef HAVE_TERMIOX -SP_PRIV int get_termiox_size(void) +SP_PRIV size_t get_termiox_size(void) { return sizeof(struct termiox); } diff --git a/linux_termios.h b/linux_termios.h index 37d4dc9..e7c86e7 100644 --- a/linux_termios.h +++ b/linux_termios.h @@ -20,12 +20,14 @@ #ifndef LIBSERIALPORT_LINUX_TERMIOS_H #define LIBSERIALPORT_LINUX_TERMIOS_H -SP_PRIV int get_termios_get_ioctl(void); -SP_PRIV int get_termios_set_ioctl(void); -SP_PRIV int get_termios_size(void); +#include + +SP_PRIV unsigned long get_termios_get_ioctl(void); +SP_PRIV unsigned long get_termios_set_ioctl(void); +SP_PRIV size_t get_termios_size(void); SP_PRIV int get_termios_speed(void *data); SP_PRIV void set_termios_speed(void *data, int speed); -SP_PRIV int get_termiox_size(void); +SP_PRIV size_t get_termiox_size(void); SP_PRIV int get_termiox_flow(void *data, int *rts, int *cts, int *dtr, int *dsr); SP_PRIV void set_termiox_flow(void *data, int rts, int cts, int dtr, int dsr);