1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

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.
This commit is contained in:
Aurelien Jacobs 2014-09-04 20:13:55 +02:00
parent 23ef3bf125
commit 546e9ae5c5
2 changed files with 11 additions and 8 deletions

View File

@ -33,10 +33,11 @@
* TCSETX/TCGETX ioctls used with struct termiox, others do not.
*/
#include <stdlib.h>
#include <linux/termios.h>
#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);
}

View File

@ -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 <stdlib.h>
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);