1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12: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:
Simon Tatham
2018-05-26 08:31:34 +01:00
parent 2fc29577df
commit 7babe66a83
40 changed files with 283 additions and 263 deletions

View File

@ -6629,7 +6629,7 @@ int term_ldisc(Terminal *term, int option)
return FALSE;
}
int term_data(Terminal *term, int is_stderr, const char *data, int len)
int term_data(Terminal *term, int is_stderr, const void *data, int len)
{
bufchain_add(&term->inbuf, data, len);
@ -6673,8 +6673,9 @@ int term_data(Terminal *term, int is_stderr, const char *data, int len)
* The only control character that should be honoured is \n (which
* will behave as a CRLF).
*/
int term_data_untrusted(Terminal *term, const char *data, int len)
int term_data_untrusted(Terminal *term, const void *vdata, int len)
{
const char *data = (const char *)vdata;
int i;
/* FIXME: more sophisticated checking? */
for (i = 0; i < len; i++) {