mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22: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:
@ -11,8 +11,9 @@ typedef struct {
|
||||
unsigned char i, j, s[256];
|
||||
} ArcfourContext;
|
||||
|
||||
static void arcfour_block(void *handle, unsigned char *blk, int len)
|
||||
static void arcfour_block(void *handle, void *vblk, int len)
|
||||
{
|
||||
unsigned char *blk = (unsigned char *)vblk;
|
||||
ArcfourContext *ctx = (ArcfourContext *)handle;
|
||||
unsigned k;
|
||||
unsigned char tmp, i, j, *s;
|
||||
@ -79,21 +80,21 @@ static void arcfour_stir(ArcfourContext *ctx)
|
||||
sfree(junk);
|
||||
}
|
||||
|
||||
static void arcfour128_key(void *handle, unsigned char *key)
|
||||
static void arcfour128_key(void *handle, const void *key)
|
||||
{
|
||||
ArcfourContext *ctx = (ArcfourContext *)handle;
|
||||
arcfour_setkey(ctx, key, 16);
|
||||
arcfour_stir(ctx);
|
||||
}
|
||||
|
||||
static void arcfour256_key(void *handle, unsigned char *key)
|
||||
static void arcfour256_key(void *handle, const void *key)
|
||||
{
|
||||
ArcfourContext *ctx = (ArcfourContext *)handle;
|
||||
arcfour_setkey(ctx, key, 32);
|
||||
arcfour_stir(ctx);
|
||||
}
|
||||
|
||||
static void arcfour_iv(void *handle, unsigned char *key)
|
||||
static void arcfour_iv(void *handle, const void *iv)
|
||||
{
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user