From b5682742ef212b62c9494a2d462654a7d0301266 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 23 Jan 2007 12:17:04 +0000 Subject: Fix pile of warnings about differing signedness. One of them looks like a real buglet for some architectures. --- ax25io.c | 35 ++++++++++++++++++++++------------- axconfig.c | 2 +- axutils.c | 9 ++++++--- nrconfig.c | 2 +- rsconfig.c | 2 +- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/ax25io.c b/ax25io.c index 970529c..0ee2ccb 100644 --- a/ax25io.c +++ b/ax25io.c @@ -10,7 +10,7 @@ #include "ax25io.h" static inline int send_iac_iac(ax25io *p); -static inline int send_iac_cmd(ax25io *p, char cmd, char opt); +static inline int send_iac_cmd(ax25io *p, unsigned char cmd, unsigned char opt); static inline int send_linemode(ax25io *p); static ax25io *Iolist = NULL; @@ -233,7 +233,7 @@ int axio_flush(ax25io *p) return flushed; } -static int rsend(unsigned char *c, int len, ax25io *p) +static int rsend(char *c, int len, ax25io *p) { /* Don't go further until there is space */ if (p->paclen <= p->optr) { @@ -257,7 +257,7 @@ static int rsend(unsigned char *c, int len, ax25io *p) /* * One new character to input. */ - z->zout.next_in = c; + z->zout.next_in = (unsigned char *) c; z->zout.avail_in = len; /* * Now loop until deflate returns with avail_out != 0 @@ -591,10 +591,11 @@ char *axio_getline(ax25io *p) { int ret; - ret = axio_gets(p->gbuf + p->gbuf_usage, AXBUFLEN - p->gbuf_usage, p); + ret = axio_gets((char *) p->gbuf + p->gbuf_usage, + AXBUFLEN - p->gbuf_usage, p); if (ret > 0 || (ret == 0 && errno == 0)) { p->gbuf_usage = 0; - return p->gbuf; + return (char *) p->gbuf; } p->gbuf_usage += ret; return NULL; @@ -671,27 +672,35 @@ int axio_tn_wont_echo(ax25io *p) static inline int send_iac_iac(ax25io *p) { - char buf[2] = { IAC, IAC }; + unsigned char buf[2] = { IAC, IAC }; - return rsend(buf, 2, p); + return rsend((char *) buf, 2, p); } -static inline int send_iac_cmd(ax25io *p, char cmd, char opt) +static inline int send_iac_cmd(ax25io *p, unsigned char cmd, unsigned char opt) { - char buf[3]; + unsigned char buf[3]; buf[0] = IAC; buf[1] = cmd; buf[2] = opt; - return rsend(buf, 3, p); + return rsend((char *)buf, 3, p); } static inline int send_linemode(ax25io *p) { - char buf[7] = { IAC, SB, TELOPT_LINEMODE, LM_MODE, MODE_EDIT | MODE_TRAPSIG, IAC, SE }; - - return rsend(buf, 7, p); + unsigned char buf[7] = { + IAC, + SB, + TELOPT_LINEMODE, + LM_MODE, + MODE_EDIT | MODE_TRAPSIG, + IAC, + SE + }; + + return rsend((char *) buf, 7, p); } /* --------------------------------------------------------------------- */ diff --git a/axconfig.c b/axconfig.c index 396c780..4f64f9a 100644 --- a/axconfig.c +++ b/axconfig.c @@ -54,7 +54,7 @@ typedef struct _axiface static AX_Iface *ax25_ifaces = NULL; -static int ax25_hw_cmp(unsigned char *callsign, unsigned char *hw_addr) +static int ax25_hw_cmp(char *callsign, char *hw_addr) { ax25_address call; diff --git a/axutils.c b/axutils.c index b69a910..0e8f806 100644 --- a/axutils.c +++ b/axutils.c @@ -284,11 +284,14 @@ int rose_cmp(const rose_address *a, const rose_address *b) */ int ax25_validate(const char *call) { - unsigned char s[7]; + unsigned char c; + char s[7]; int n; - for (n = 0; n < 6; n++) - s[n] = (call[n] >> 1) & 0x7F; + for (n = 0; n < 6; n++) { + c = call[n]; + s[n] = (c >> 1) & 0x7F; + } s[6] = '\0'; if (strspn(s, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ") == 6) diff --git a/nrconfig.c b/nrconfig.c index 5c86a9f..fa64c26 100644 --- a/nrconfig.c +++ b/nrconfig.c @@ -42,7 +42,7 @@ typedef struct _nrport static NR_Port *nr_ports = NULL; static NR_Port *nr_port_tail = NULL; -static int ax25_hw_cmp(unsigned char *callsign, unsigned char *hw_addr) +static int ax25_hw_cmp(char *callsign, char *hw_addr) { ax25_address call; diff --git a/rsconfig.c b/rsconfig.c index 7d343e2..f83e3a0 100644 --- a/rsconfig.c +++ b/rsconfig.c @@ -41,7 +41,7 @@ typedef struct _rsport static RS_Port *rs_ports = NULL; static RS_Port *rs_port_tail = NULL; -static int rose_hw_cmp(unsigned char *address, unsigned char *hw_addr) +static int rose_hw_cmp(char *address, char *hw_addr) { rose_address addr; -- cgit v1.2.3