Avoid (s)size_t for portability

This commit is contained in:
Kim Woelders
2018-10-11 14:52:55 +02:00
parent 2d993212c5
commit 44ddf67386
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ extern tn_ctx_t *telnet_ctx_init(void *cctx, srv_tx_f * ftx, srv_rx_f * frx,
extern int telnet_open(tn_ctx_t * tcc); extern int telnet_open(tn_ctx_t * tcc);
extern int telnet_rx(tn_ctx_t * tcc, char *buf, size_t * plen); extern int telnet_rx(tn_ctx_t * tcc, char *buf, int *plen);
extern int telnet_tx(tn_ctx_t * tcc, const char *buf, int len); extern int telnet_tx(tn_ctx_t * tcc, const char *buf, int len);
extern void telnet_set_opt(tn_ctx_t * tcc, int opt, int prm, extern void telnet_set_opt(tn_ctx_t * tcc, int opt, int prm,
+3 -3
View File
@@ -121,18 +121,18 @@ static void _telnet_handle_opt(tn_ctx_t * tcc, int opt,
} }
} }
int telnet_rx(tn_ctx_t * tcc, char *buf, size_t * plen) int telnet_rx(tn_ctx_t * tcc, char *buf, int *plen)
{ {
char *s, *p; char *s, *p;
unsigned char *pu; unsigned char *pu;
size_t len, rem; int len, rem;
int np, nd; int np, nd;
int b1, b2; int b1, b2;
len = *plen; len = *plen;
tcc->bytes_rx += len; tcc->bytes_rx += len;
if (len < (size_t) tcc->off_rx) if (len < (int)tcc->off_rx)
tcc->off_rx = 0; tcc->off_rx = 0;
for (s = buf + tcc->off_rx, rem = len - tcc->off_rx; rem > 0; s = p) for (s = buf + tcc->off_rx, rem = len - tcc->off_rx; rem > 0; s = p)
+4 -4
View File
@@ -62,7 +62,7 @@ typedef struct {
struct pollfd fds[3]; struct pollfd fds[3];
char net_buf[NET_BUF_SIZE]; char net_buf[NET_BUF_SIZE];
size_t net_cnt; int net_cnt;
char tmp_buf[TMP_BUF_SIZE]; char tmp_buf[TMP_BUF_SIZE];
struct termios tio; struct termios tio;
@@ -191,7 +191,7 @@ static void _update_notify(ttynvt_t * tty, struct fuse_pollhandle *ph)
static void *_read_net(void *arg) static void *_read_net(void *arg)
{ {
ttynvt_t *tty = (ttynvt_t *) arg; ttynvt_t *tty = (ttynvt_t *) arg;
ssize_t res; int res;
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
@@ -324,7 +324,7 @@ static int _srv_read(void *cctx, int timeout)
NET_BUF_SIZE - tty->net_cnt); NET_BUF_SIZE - tty->net_cnt);
if (res <= 0) if (res <= 0)
return res; return res;
tty->net_cnt += (size_t) res; tty->net_cnt += res;
res = telnet_rx(tty->tn, tty->net_buf, &tty->net_cnt); res = telnet_rx(tty->tn, tty->net_buf, &tty->net_cnt);
if (res == 0) if (res == 0)
break; break;
@@ -516,7 +516,7 @@ ttynvt_write(fuse_req_t req, const char *data, size_t size, off_t off,
struct fuse_file_info *info) struct fuse_file_info *info)
{ {
ttynvt_t *tty = (ttynvt_t *) (uintptr_t) info->fh; ttynvt_t *tty = (ttynvt_t *) (uintptr_t) info->fh;
ssize_t res; int res;
if (size == 0) if (size == 0)