mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Make lots of 'int' length fields into size_t.
This is a general cleanup which has been overdue for some time: lots of length fields are now the machine word type rather than the (in practice) fixed 'int'.
This commit is contained in:
@ -314,8 +314,8 @@ static char *gtk_seat_get_ttymode(Seat *seat, const char *mode)
|
||||
return term_get_ttymode(inst->term, mode);
|
||||
}
|
||||
|
||||
static int gtk_seat_output(Seat *seat, bool is_stderr,
|
||||
const void *data, int len)
|
||||
static size_t gtk_seat_output(Seat *seat, bool is_stderr,
|
||||
const void *data, size_t len)
|
||||
{
|
||||
GtkFrontend *inst = container_of(seat, GtkFrontend, seat);
|
||||
return term_data(inst->term, is_stderr, data, len);
|
||||
|
@ -490,7 +490,7 @@ static void console_close(FILE *outfp, int infd)
|
||||
fclose(outfp); /* will automatically close infd too */
|
||||
}
|
||||
|
||||
static void console_prompt_text(FILE *outfp, const char *data, int len)
|
||||
static void console_prompt_text(FILE *outfp, const char *data, size_t len)
|
||||
{
|
||||
bufchain sanitised;
|
||||
void *vdata;
|
||||
|
@ -163,7 +163,8 @@ static int fdsocket_try_send(FdSocket *fds)
|
||||
|
||||
while (bufchain_size(&fds->pending_output_data) > 0) {
|
||||
void *data;
|
||||
int len, ret;
|
||||
size_t len;
|
||||
ssize_t ret;
|
||||
|
||||
bufchain_prefix(&fds->pending_output_data, &data, &len);
|
||||
ret = write(fds->outfd, data, len);
|
||||
@ -198,7 +199,7 @@ static int fdsocket_try_send(FdSocket *fds)
|
||||
return sent;
|
||||
}
|
||||
|
||||
static int fdsocket_write(Socket *s, const void *data, int len)
|
||||
static size_t fdsocket_write(Socket *s, const void *data, size_t len)
|
||||
{
|
||||
FdSocket *fds = container_of(s, FdSocket, sock);
|
||||
|
||||
@ -211,7 +212,7 @@ static int fdsocket_write(Socket *s, const void *data, int len)
|
||||
return bufchain_size(&fds->pending_output_data);
|
||||
}
|
||||
|
||||
static int fdsocket_write_oob(Socket *s, const void *data, int len)
|
||||
static size_t fdsocket_write_oob(Socket *s, const void *data, size_t len)
|
||||
{
|
||||
/*
|
||||
* oob data is treated as inband; nasty, but nothing really
|
||||
|
15
unix/uxnet.c
15
unix/uxnet.c
@ -69,7 +69,7 @@ struct NetSocket {
|
||||
bool frozen; /* this causes readability notifications to be ignored */
|
||||
bool localhost_only; /* for listening sockets */
|
||||
char oobdata[1];
|
||||
int sending_oob;
|
||||
size_t sending_oob;
|
||||
bool oobpending; /* is there OOB data available to read? */
|
||||
bool oobinline;
|
||||
enum { EOF_NO, EOF_PENDING, EOF_SENT } outgoingeof;
|
||||
@ -500,8 +500,8 @@ static void sk_net_flush(Socket *s)
|
||||
}
|
||||
|
||||
static void sk_net_close(Socket *s);
|
||||
static int sk_net_write(Socket *s, const void *data, int len);
|
||||
static int sk_net_write_oob(Socket *s, const void *data, int len);
|
||||
static size_t sk_net_write(Socket *s, const void *data, size_t len);
|
||||
static size_t sk_net_write_oob(Socket *s, const void *data, size_t len);
|
||||
static void sk_net_write_eof(Socket *s);
|
||||
static void sk_net_set_frozen(Socket *s, bool is_frozen);
|
||||
static SocketPeerInfo *sk_net_peer_info(Socket *s);
|
||||
@ -1112,7 +1112,8 @@ void try_send(NetSocket *s)
|
||||
int nsent;
|
||||
int err;
|
||||
void *data;
|
||||
int len, urgentflag;
|
||||
size_t len;
|
||||
int urgentflag;
|
||||
|
||||
if (s->sending_oob) {
|
||||
urgentflag = MSG_OOB;
|
||||
@ -1186,7 +1187,7 @@ void try_send(NetSocket *s)
|
||||
uxsel_tell(s);
|
||||
}
|
||||
|
||||
static int sk_net_write(Socket *sock, const void *buf, int len)
|
||||
static size_t sk_net_write(Socket *sock, const void *buf, size_t len)
|
||||
{
|
||||
NetSocket *s = container_of(sock, NetSocket, sock);
|
||||
|
||||
@ -1212,7 +1213,7 @@ static int sk_net_write(Socket *sock, const void *buf, int len)
|
||||
return bufchain_size(&s->output_data);
|
||||
}
|
||||
|
||||
static int sk_net_write_oob(Socket *sock, const void *buf, int len)
|
||||
static size_t sk_net_write_oob(Socket *sock, const void *buf, size_t len)
|
||||
{
|
||||
NetSocket *s = container_of(sock, NetSocket, sock);
|
||||
|
||||
@ -1451,7 +1452,7 @@ static void net_select_result(int fd, int event)
|
||||
s->writable = true;
|
||||
uxsel_tell(s);
|
||||
} else {
|
||||
int bufsize_before, bufsize_after;
|
||||
size_t bufsize_before, bufsize_after;
|
||||
s->writable = true;
|
||||
bufsize_before = s->sending_oob + bufchain_size(&s->output_data);
|
||||
try_send(s);
|
||||
|
@ -155,8 +155,8 @@ void chan_no_request_response(Channel *chan, bool success) {}
|
||||
*/
|
||||
static void x11_log(Plug *p, int type, SockAddr *addr, int port,
|
||||
const char *error_msg, int error_code) {}
|
||||
static void x11_receive(Plug *plug, int urgent, const char *data, int len) {}
|
||||
static void x11_sent(Plug *plug, int bufsize) {}
|
||||
static void x11_receive(Plug *plug, int urgent, const char *data, size_t len) {}
|
||||
static void x11_sent(Plug *plug, size_t bufsize) {}
|
||||
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
bool calling_back)
|
||||
{
|
||||
|
@ -325,12 +325,13 @@ void cleanup_termios(void)
|
||||
bufchain stdout_data, stderr_data;
|
||||
enum { EOF_NO, EOF_PENDING, EOF_SENT } outgoingeof;
|
||||
|
||||
int try_output(bool is_stderr)
|
||||
size_t try_output(bool is_stderr)
|
||||
{
|
||||
bufchain *chain = (is_stderr ? &stderr_data : &stdout_data);
|
||||
int fd = (is_stderr ? STDERR_FILENO : STDOUT_FILENO);
|
||||
void *senddata;
|
||||
int sendlen, ret;
|
||||
size_t sendlen;
|
||||
ssize_t ret;
|
||||
|
||||
if (bufchain_size(chain) > 0) {
|
||||
bool prev_nonblock = nonblock(fd);
|
||||
@ -354,7 +355,8 @@ int try_output(bool is_stderr)
|
||||
return bufchain_size(&stdout_data) + bufchain_size(&stderr_data);
|
||||
}
|
||||
|
||||
static int plink_output(Seat *seat, bool is_stderr, const void *data, int len)
|
||||
static size_t plink_output(
|
||||
Seat *seat, bool is_stderr, const void *data, size_t len)
|
||||
{
|
||||
if (is_stderr) {
|
||||
bufchain_add(&stderr_data, data, len);
|
||||
|
@ -1310,7 +1310,8 @@ static void pty_free(Backend *be)
|
||||
static void pty_try_write(Pty *pty)
|
||||
{
|
||||
void *data;
|
||||
int len, ret;
|
||||
size_t len;
|
||||
ssize_t ret;
|
||||
|
||||
assert(pty->master_i >= 0);
|
||||
|
||||
@ -1348,7 +1349,7 @@ static void pty_try_write(Pty *pty)
|
||||
/*
|
||||
* Called to send data down the pty.
|
||||
*/
|
||||
static int pty_send(Backend *be, const char *buf, int len)
|
||||
static size_t pty_send(Backend *be, const char *buf, size_t len)
|
||||
{
|
||||
Pty *pty = container_of(be, Pty, backend);
|
||||
|
||||
@ -1393,7 +1394,7 @@ static void pty_close(Pty *pty)
|
||||
/*
|
||||
* Called to query the current socket sendability status.
|
||||
*/
|
||||
static int pty_sendbuffer(Backend *be)
|
||||
static size_t pty_sendbuffer(Backend *be)
|
||||
{
|
||||
/* Pty *pty = container_of(be, Pty, backend); */
|
||||
return 0;
|
||||
@ -1494,7 +1495,7 @@ static bool pty_sendok(Backend *be)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void pty_unthrottle(Backend *be, int backlog)
|
||||
static void pty_unthrottle(Backend *be, size_t backlog)
|
||||
{
|
||||
/* Pty *pty = container_of(be, Pty, backend); */
|
||||
/* do nothing */
|
||||
|
11
unix/uxser.c
11
unix/uxser.c
@ -23,7 +23,7 @@ struct Serial {
|
||||
LogContext *logctx;
|
||||
int fd;
|
||||
bool finished;
|
||||
int inbufsize;
|
||||
size_t inbufsize;
|
||||
bufchain output_data;
|
||||
Backend backend;
|
||||
};
|
||||
@ -423,7 +423,8 @@ static void serial_uxsel_setup(Serial *serial)
|
||||
static void serial_try_write(Serial *serial)
|
||||
{
|
||||
void *data;
|
||||
int len, ret;
|
||||
size_t len;
|
||||
ssize_t ret;
|
||||
|
||||
assert(serial->fd >= 0);
|
||||
|
||||
@ -450,7 +451,7 @@ static void serial_try_write(Serial *serial)
|
||||
/*
|
||||
* Called to send data down the serial connection.
|
||||
*/
|
||||
static int serial_send(Backend *be, const char *buf, int len)
|
||||
static size_t serial_send(Backend *be, const char *buf, size_t len)
|
||||
{
|
||||
Serial *serial = container_of(be, Serial, backend);
|
||||
|
||||
@ -466,7 +467,7 @@ static int serial_send(Backend *be, const char *buf, int len)
|
||||
/*
|
||||
* Called to query the current sendability status.
|
||||
*/
|
||||
static int serial_sendbuffer(Backend *be)
|
||||
static size_t serial_sendbuffer(Backend *be)
|
||||
{
|
||||
Serial *serial = container_of(be, Serial, backend);
|
||||
return bufchain_size(&serial->output_data);
|
||||
@ -519,7 +520,7 @@ static bool serial_sendok(Backend *be)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void serial_unthrottle(Backend *be, int backlog)
|
||||
static void serial_unthrottle(Backend *be, size_t backlog)
|
||||
{
|
||||
Serial *serial = container_of(be, Serial, backend);
|
||||
serial->inbufsize = backlog;
|
||||
|
Reference in New Issue
Block a user