1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Introduce a typedef for frontend handles.

This is another major source of unexplained 'void *' parameters
throughout the code.

In particular, the currently unused testback.c actually gave the wrong
pointer type to its internal store of the frontend handle - it cast
the input void * to a Terminal *, from which it got implicitly cast
back again when calling from_backend, and nobody noticed. Now it uses
the right type internally as well as externally.
This commit is contained in:
Simon Tatham
2018-09-12 09:10:51 +01:00
parent eefebaaa9e
commit 8dfb2a1186
40 changed files with 357 additions and 406 deletions

9
pscp.c
View File

@ -118,7 +118,7 @@ void nonfatal(const char *fmt, ...)
sfree(str2);
errs++;
}
void connection_fatal(void *frontend, const char *fmt, ...)
void connection_fatal(Frontend *frontend, const char *fmt, ...)
{
char *str, *str2;
va_list ap;
@ -157,7 +157,8 @@ static unsigned char *outptr; /* where to put the data */
static unsigned outlen; /* how much data required */
static unsigned char *pending = NULL; /* any spare data */
static unsigned pendlen = 0, pendsize = 0; /* length and phys. size of buffer */
int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
int from_backend(Frontend *frontend, int is_stderr,
const void *data, int datalen)
{
unsigned char *p = (unsigned char *) data;
unsigned len = (unsigned) datalen;
@ -195,7 +196,7 @@ int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
return 0;
}
int from_backend_untrusted(void *frontend_handle, const void *data, int len)
int from_backend_untrusted(Frontend *frontend, const void *data, int len)
{
/*
* No "untrusted" output should get here (the way the code is
@ -204,7 +205,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len)
assert(!"Unexpected call to from_backend_untrusted()");
return 0; /* not reached */
}
int from_backend_eof(void *frontend)
int from_backend_eof(Frontend *frontend)
{
/*
* We usually expect to be the party deciding when to close the