mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Add some missing 'const'.
plug_receive(), sftp_senddata() and handle_gotdata() in particular now take const pointers. Also fixed 'char *receive_data' in struct ProxySocket.
This commit is contained in:
parent
eb16dee2a4
commit
0aa8cf7b0d
@ -31,7 +31,7 @@ static Filename *xlatlognam(Filename *s, char *hostname, int port,
|
||||
* isn't open, buffering data if it's in the process of being
|
||||
* opened asynchronously, etc.
|
||||
*/
|
||||
static void logwrite(LogContext *ctx, void *data, int len)
|
||||
static void logwrite(LogContext *ctx, const void *data, int len)
|
||||
{
|
||||
/*
|
||||
* In state L_CLOSED, we call logfopen, which will set the state
|
||||
|
@ -70,7 +70,7 @@ struct PlugVtable {
|
||||
/* error_msg is NULL iff it is not an error (ie it closed normally) */
|
||||
/* calling_back != 0 iff there is a Plug function */
|
||||
/* currently running (would cure the fixme in try_send()) */
|
||||
void (*receive) (Plug *p, int urgent, char *data, int len);
|
||||
void (*receive) (Plug *p, int urgent, const char *data, int len);
|
||||
/*
|
||||
* - urgent==0. `data' points to `len' bytes of perfectly
|
||||
* ordinary data.
|
||||
|
@ -17,7 +17,7 @@ static void nullplug_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
{
|
||||
}
|
||||
|
||||
static void nullplug_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void nullplug_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -755,7 +755,8 @@ static void pageant_conn_log(void *logctx, const char *fmt, va_list ap)
|
||||
sfree(formatted);
|
||||
}
|
||||
|
||||
static void pageant_conn_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void pageant_conn_receive(
|
||||
Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
struct pageant_conn_state *pc = container_of(
|
||||
plug, struct pageant_conn_state, plug);
|
||||
|
@ -192,7 +192,7 @@ static char *ipv6_to_string(ptrlen ipv6)
|
||||
(unsigned)GET_16BIT_MSB_FIRST(addr + 14));
|
||||
}
|
||||
|
||||
static void pfd_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void pfd_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
struct PortForwarding *pf =
|
||||
container_of(plug, struct PortForwarding, plug);
|
||||
|
2
proxy.c
2
proxy.c
@ -214,7 +214,7 @@ static void plug_proxy_closing (Plug *p, const char *error_msg,
|
||||
}
|
||||
}
|
||||
|
||||
static void plug_proxy_receive (Plug *p, int urgent, char *data, int len)
|
||||
static void plug_proxy_receive (Plug *p, int urgent, const char *data, int len)
|
||||
{
|
||||
ProxySocket *ps = container_of(p, ProxySocket, plugimpl);
|
||||
|
||||
|
2
proxy.h
2
proxy.h
@ -68,7 +68,7 @@ struct ProxySocket {
|
||||
|
||||
/* receive */
|
||||
bool receive_urgent;
|
||||
char *receive_data;
|
||||
const char *receive_data;
|
||||
int receive_len;
|
||||
|
||||
/* sent */
|
||||
|
2
pscp.c
2
pscp.c
@ -574,7 +574,7 @@ bool sftp_recvdata(char *buf, int len)
|
||||
{
|
||||
return ssh_scp_recv(buf, len);
|
||||
}
|
||||
bool sftp_senddata(char *buf, int len)
|
||||
bool sftp_senddata(const char *buf, int len)
|
||||
{
|
||||
backend_send(backend, buf, len);
|
||||
return true;
|
||||
|
2
psftp.c
2
psftp.c
@ -2493,7 +2493,7 @@ bool sftp_recvdata(char *buf, int len)
|
||||
|
||||
return true;
|
||||
}
|
||||
bool sftp_senddata(char *buf, int len)
|
||||
bool sftp_senddata(const char *buf, int len)
|
||||
{
|
||||
backend_send(backend, buf, len);
|
||||
return true;
|
||||
|
2
raw.c
2
raw.c
@ -89,7 +89,7 @@ static void raw_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
}
|
||||
}
|
||||
|
||||
static void raw_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void raw_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
Raw *raw = container_of(plug, Raw, plug);
|
||||
c_write(raw, data, len);
|
||||
|
4
rlogin.c
4
rlogin.c
@ -71,9 +71,11 @@ static void rlogin_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
} /* Otherwise, the remote side closed the connection normally. */
|
||||
}
|
||||
|
||||
static void rlogin_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void rlogin_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
Rlogin *rlogin = container_of(plug, Rlogin, plug);
|
||||
if (len == 0)
|
||||
return;
|
||||
if (urgent == 2) {
|
||||
char c;
|
||||
|
||||
|
2
sftp.h
2
sftp.h
@ -70,7 +70,7 @@
|
||||
* sftp_sendbuffer returns the size of the backlog of data in the
|
||||
* transmit queue.
|
||||
*/
|
||||
bool sftp_senddata(char *data, int len);
|
||||
bool sftp_senddata(const char *data, int len);
|
||||
int sftp_sendbuffer(void);
|
||||
bool sftp_recvdata(char *data, int len);
|
||||
|
||||
|
2
ssh.c
2
ssh.c
@ -573,7 +573,7 @@ static void ssh_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
}
|
||||
}
|
||||
|
||||
static void ssh_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void ssh_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
Ssh *ssh = container_of(plug, Ssh, plug);
|
||||
|
||||
|
@ -133,7 +133,7 @@ static void server_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
}
|
||||
}
|
||||
|
||||
static void server_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void server_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
server *srv = container_of(plug, server, plug);
|
||||
|
||||
|
@ -1754,7 +1754,7 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs,
|
||||
(c) = (unsigned char)*data++; \
|
||||
} while (0)
|
||||
|
||||
static void share_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void share_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
ssh_sharing_connstate *cs = container_of(
|
||||
plug, ssh_sharing_connstate, plug);
|
||||
|
4
telnet.c
4
telnet.c
@ -506,7 +506,7 @@ static void process_subneg(Telnet *telnet)
|
||||
}
|
||||
}
|
||||
|
||||
static void do_telnet_read(Telnet *telnet, char *buf, int len)
|
||||
static void do_telnet_read(Telnet *telnet, const char *buf, int len)
|
||||
{
|
||||
strbuf *outbuf = strbuf_new();
|
||||
|
||||
@ -654,7 +654,7 @@ static void telnet_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
/* Otherwise, the remote side closed the connection normally. */
|
||||
}
|
||||
|
||||
static void telnet_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void telnet_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
Telnet *telnet = container_of(plug, Telnet, plug);
|
||||
if (urgent)
|
||||
|
@ -155,7 +155,7 @@ 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, char *data, int len) {}
|
||||
static void x11_receive(Plug *plug, int urgent, const char *data, int len) {}
|
||||
static void x11_sent(Plug *plug, int bufsize) {}
|
||||
static void x11_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
bool calling_back)
|
||||
|
@ -45,7 +45,7 @@ typedef struct HandleSocket {
|
||||
Socket sock;
|
||||
} HandleSocket;
|
||||
|
||||
static int handle_gotdata(struct handle *h, void *data, int len)
|
||||
static int handle_gotdata(struct handle *h, const void *data, int len)
|
||||
{
|
||||
HandleSocket *hs = (HandleSocket *)handle_get_privdata(h);
|
||||
|
||||
@ -79,7 +79,7 @@ static int handle_gotdata(struct handle *h, void *data, int len)
|
||||
}
|
||||
}
|
||||
|
||||
static int handle_stderr(struct handle *h, void *data, int len)
|
||||
static int handle_stderr(struct handle *h, const void *data, int len)
|
||||
{
|
||||
HandleSocket *hs = (HandleSocket *)handle_get_privdata(h);
|
||||
|
||||
|
@ -205,7 +205,7 @@ char *do_select(SOCKET skt, bool startup)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int stdin_gotdata(struct handle *h, void *data, int len)
|
||||
int stdin_gotdata(struct handle *h, const void *data, int len)
|
||||
{
|
||||
if (len < 0) {
|
||||
/*
|
||||
|
@ -40,7 +40,7 @@ static void serial_terminate(Serial *serial)
|
||||
}
|
||||
}
|
||||
|
||||
static int serial_gotdata(struct handle *h, void *data, int len)
|
||||
static int serial_gotdata(struct handle *h, const void *data, int len)
|
||||
{
|
||||
Serial *serial = (Serial *)handle_get_privdata(h);
|
||||
if (len <= 0) {
|
||||
|
@ -603,7 +603,7 @@ void init_ucs(Conf *, struct unicode_data *);
|
||||
#define HANDLE_FLAG_IGNOREEOF 2
|
||||
#define HANDLE_FLAG_UNITBUFFER 4
|
||||
struct handle;
|
||||
typedef int (*handle_inputfn_t)(struct handle *h, void *data, int len);
|
||||
typedef int (*handle_inputfn_t)(struct handle *h, const void *data, int len);
|
||||
typedef void (*handle_outputfn_t)(struct handle *h, int new_backlog);
|
||||
struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata,
|
||||
void *privdata, int flags);
|
||||
|
2
x11fwd.c
2
x11fwd.c
@ -726,7 +726,7 @@ static void x11_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
}
|
||||
}
|
||||
|
||||
static void x11_receive(Plug *plug, int urgent, char *data, int len)
|
||||
static void x11_receive(Plug *plug, int urgent, const char *data, int len)
|
||||
{
|
||||
struct X11Connection *xconn = container_of(
|
||||
plug, struct X11Connection, plug);
|
||||
|
Loading…
Reference in New Issue
Block a user