mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 11:32:48 -05:00
Make lots of generic data parameters into 'void *'.
This is a cleanup I started to notice a need for during the BinarySink work. It removes a lot of faffing about casting things to char * or unsigned char * so that some API will accept them, even though lots of such APIs really take a plain 'block of raw binary data' argument and don't care what C thinks the signedness of that data might be - they may well reinterpret it back and forth internally. So I've tried to arrange for all the function call APIs that ought to have a void * (or const void *) to have one, and those that need to do pointer arithmetic on the parameter internally can cast it back at the top of the function. That saves endless ad-hoc casts at the call sites.
This commit is contained in:
@ -304,13 +304,13 @@ char *get_ttymode(void *frontend, const char *mode)
|
||||
return term_get_ttymode(inst->term, mode);
|
||||
}
|
||||
|
||||
int from_backend(void *frontend, int is_stderr, const char *data, int len)
|
||||
int from_backend(void *frontend, int is_stderr, const void *data, int len)
|
||||
{
|
||||
struct gui_data *inst = (struct gui_data *)frontend;
|
||||
return term_data(inst->term, is_stderr, data, len);
|
||||
}
|
||||
|
||||
int from_backend_untrusted(void *frontend, const char *data, int len)
|
||||
int from_backend_untrusted(void *frontend, const void *data, int len)
|
||||
{
|
||||
struct gui_data *inst = (struct gui_data *)frontend;
|
||||
return term_data_untrusted(inst->term, data, len);
|
||||
|
@ -509,8 +509,8 @@ static void sk_tcp_flush(Socket s)
|
||||
}
|
||||
|
||||
static void sk_tcp_close(Socket s);
|
||||
static int sk_tcp_write(Socket s, const char *data, int len);
|
||||
static int sk_tcp_write_oob(Socket s, const char *data, int len);
|
||||
static int sk_tcp_write(Socket s, const void *data, int len);
|
||||
static int sk_tcp_write_oob(Socket s, const void *data, int len);
|
||||
static void sk_tcp_write_eof(Socket s);
|
||||
static void sk_tcp_set_frozen(Socket s, int is_frozen);
|
||||
static char *sk_tcp_peer_info(Socket s);
|
||||
@ -1189,7 +1189,7 @@ void try_send(Actual_Socket s)
|
||||
uxsel_tell(s);
|
||||
}
|
||||
|
||||
static int sk_tcp_write(Socket sock, const char *buf, int len)
|
||||
static int sk_tcp_write(Socket sock, const void *buf, int len)
|
||||
{
|
||||
Actual_Socket s = (Actual_Socket) sock;
|
||||
|
||||
@ -1215,7 +1215,7 @@ static int sk_tcp_write(Socket sock, const char *buf, int len)
|
||||
return bufchain_size(&s->output_data);
|
||||
}
|
||||
|
||||
static int sk_tcp_write_oob(Socket sock, const char *buf, int len)
|
||||
static int sk_tcp_write_oob(Socket sock, const void *buf, int len)
|
||||
{
|
||||
Actual_Socket s = (Actual_Socket) sock;
|
||||
|
||||
|
@ -93,7 +93,7 @@ FontSpec *platform_default_fontspec(const char *name) { return fontspec_new("");
|
||||
Filename *platform_default_filename(const char *name) { return filename_from_str(""); }
|
||||
char *x_get_default(const char *key) { return NULL; }
|
||||
void log_eventlog(void *handle, const char *event) {}
|
||||
int from_backend(void *frontend, int is_stderr, const char *data, int datalen)
|
||||
int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
|
||||
{ assert(!"only here to satisfy notional call from backend_socket_log"); }
|
||||
|
||||
/*
|
||||
@ -156,7 +156,8 @@ static int time_to_die = FALSE;
|
||||
* used, because in LIFE_X11 mode we connect to the X server using a
|
||||
* straightforward Socket and don't try to create an ersatz SSH
|
||||
* forwarding too. */
|
||||
int sshfwd_write(struct ssh_channel *c, char *data, int len) { return 0; }
|
||||
int sshfwd_write(struct ssh_channel *c, const void *data, int len)
|
||||
{ return 0; }
|
||||
void sshfwd_write_eof(struct ssh_channel *c) { }
|
||||
void sshfwd_unclean_close(struct ssh_channel *c, const char *err) { }
|
||||
void sshfwd_unthrottle(struct ssh_channel *c, int bufsize) {}
|
||||
|
@ -402,7 +402,7 @@ int try_output(int is_stderr)
|
||||
}
|
||||
|
||||
int from_backend(void *frontend_handle, int is_stderr,
|
||||
const char *data, int len)
|
||||
const void *data, int len)
|
||||
{
|
||||
if (is_stderr) {
|
||||
bufchain_add(&stderr_data, data, len);
|
||||
@ -414,7 +414,7 @@ int from_backend(void *frontend_handle, int is_stderr,
|
||||
}
|
||||
}
|
||||
|
||||
int from_backend_untrusted(void *frontend_handle, const char *data, int len)
|
||||
int from_backend_untrusted(void *frontend_handle, const void *data, int len)
|
||||
{
|
||||
/*
|
||||
* No "untrusted" output should get here (the way the code is
|
||||
|
@ -175,7 +175,7 @@ static int localproxy_try_send(Local_Proxy_Socket ps)
|
||||
return sent;
|
||||
}
|
||||
|
||||
static int sk_localproxy_write (Socket s, const char *data, int len)
|
||||
static int sk_localproxy_write (Socket s, const void *data, int len)
|
||||
{
|
||||
Local_Proxy_Socket ps = (Local_Proxy_Socket) s;
|
||||
|
||||
@ -188,7 +188,7 @@ static int sk_localproxy_write (Socket s, const char *data, int len)
|
||||
return bufchain_size(&ps->pending_output_data);
|
||||
}
|
||||
|
||||
static int sk_localproxy_write_oob (Socket s, const char *data, int len)
|
||||
static int sk_localproxy_write_oob (Socket s, const void *data, int len)
|
||||
{
|
||||
/*
|
||||
* oob data is treated as inband; nasty, but nothing really
|
||||
|
Reference in New Issue
Block a user