mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -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:
7
ldisc.c
7
ldisc.c
@ -22,7 +22,7 @@
|
||||
(ldisc->back->ldisc(ldisc->backhandle, LD_EDIT) || \
|
||||
term_ldisc(ldisc->term, LD_EDIT))))
|
||||
|
||||
static void c_write(Ldisc ldisc, const char *buf, int len)
|
||||
static void c_write(Ldisc ldisc, const void *buf, int len)
|
||||
{
|
||||
from_backend(ldisc->frontend, 0, buf, len);
|
||||
}
|
||||
@ -47,7 +47,7 @@ static void pwrite(Ldisc ldisc, unsigned char c)
|
||||
if ((c >= 32 && c <= 126) ||
|
||||
(!in_utf(ldisc->term) && c >= 0xA0) ||
|
||||
(in_utf(ldisc->term) && c >= 0x80)) {
|
||||
c_write(ldisc, (char *)&c, 1);
|
||||
c_write(ldisc, &c, 1);
|
||||
} else if (c < 128) {
|
||||
char cc[2];
|
||||
cc[1] = (c == 127 ? '?' : c + 0x40);
|
||||
@ -134,8 +134,9 @@ void ldisc_echoedit_update(void *handle)
|
||||
frontend_echoedit_update(ldisc->frontend, ECHOING, EDITING);
|
||||
}
|
||||
|
||||
void ldisc_send(void *handle, const char *buf, int len, int interactive)
|
||||
void ldisc_send(void *handle, const void *vbuf, int len, int interactive)
|
||||
{
|
||||
const char *buf = (const char *)vbuf;
|
||||
Ldisc ldisc = (Ldisc) handle;
|
||||
int keyflag = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user