зеркало из https://github.com/github/putty.git
Add some missing 'const' in the compressor API.
This commit is contained in:
Родитель
898cb8835a
Коммит
6329890046
4
ssh.h
4
ssh.h
|
@ -833,12 +833,12 @@ struct ssh_compression_alg {
|
|||
const char *delayed_name;
|
||||
ssh_compressor *(*compress_new)(void);
|
||||
void (*compress_free)(ssh_compressor *);
|
||||
void (*compress)(ssh_compressor *, unsigned char *block, int len,
|
||||
void (*compress)(ssh_compressor *, const unsigned char *block, int len,
|
||||
unsigned char **outblock, int *outlen,
|
||||
int minlen);
|
||||
ssh_decompressor *(*decompress_new)(void);
|
||||
void (*decompress_free)(ssh_decompressor *);
|
||||
bool (*decompress)(ssh_decompressor *, unsigned char *block, int len,
|
||||
bool (*decompress)(ssh_decompressor *, const unsigned char *block, int len,
|
||||
unsigned char **outblock, int *outlen);
|
||||
const char *text_name;
|
||||
};
|
||||
|
|
|
@ -39,13 +39,13 @@ static void ssh_decomp_none_cleanup(ssh_decompressor *handle)
|
|||
{
|
||||
}
|
||||
static void ssh_comp_none_block(ssh_compressor *handle,
|
||||
unsigned char *block, int len,
|
||||
const unsigned char *block, int len,
|
||||
unsigned char **outblock, int *outlen,
|
||||
int minlen)
|
||||
{
|
||||
}
|
||||
static bool ssh_decomp_none_block(ssh_decompressor *handle,
|
||||
unsigned char *block, int len,
|
||||
const unsigned char *block, int len,
|
||||
unsigned char **outblock, int *outlen)
|
||||
{
|
||||
return false;
|
||||
|
|
12
sshzlib.c
12
sshzlib.c
|
@ -94,7 +94,7 @@ static int lz77_init(struct LZ77Context *ctx);
|
|||
* instead call literal() for everything.
|
||||
*/
|
||||
static void lz77_compress(struct LZ77Context *ctx,
|
||||
unsigned char *data, int len, bool compress);
|
||||
const unsigned char *data, int len, bool compress);
|
||||
|
||||
/*
|
||||
* Modifiable parameters.
|
||||
|
@ -136,7 +136,7 @@ struct LZ77InternalContext {
|
|||
int npending;
|
||||
};
|
||||
|
||||
static int lz77_hash(unsigned char *data)
|
||||
static int lz77_hash(const unsigned char *data)
|
||||
{
|
||||
return (257 * data[0] + 263 * data[1] + 269 * data[2]) % HASHMAX;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ static void lz77_advance(struct LZ77InternalContext *st,
|
|||
#define CHARAT(k) ( (k)<0 ? st->data[(st->winpos+k)&(WINSIZE-1)] : data[k] )
|
||||
|
||||
static void lz77_compress(struct LZ77Context *ctx,
|
||||
unsigned char *data, int len, bool compress)
|
||||
const unsigned char *data, int len, bool compress)
|
||||
{
|
||||
struct LZ77InternalContext *st = ctx->ictx;
|
||||
int i, distance, off, nmatch, matchlen, advance;
|
||||
|
@ -629,7 +629,8 @@ void zlib_compress_cleanup(ssh_compressor *sc)
|
|||
sfree(comp);
|
||||
}
|
||||
|
||||
void zlib_compress_block(ssh_compressor *sc, unsigned char *block, int len,
|
||||
void zlib_compress_block(ssh_compressor *sc,
|
||||
const unsigned char *block, int len,
|
||||
unsigned char **outblock, int *outlen,
|
||||
int minlen)
|
||||
{
|
||||
|
@ -967,7 +968,8 @@ static void zlib_emit_char(struct zlib_decompress_ctx *dctx, int c)
|
|||
|
||||
#define EATBITS(n) ( dctx->nbits -= (n), dctx->bits >>= (n) )
|
||||
|
||||
bool zlib_decompress_block(ssh_decompressor *dc, unsigned char *block, int len,
|
||||
bool zlib_decompress_block(ssh_decompressor *dc,
|
||||
const unsigned char *block, int len,
|
||||
unsigned char **outblock, int *outlen)
|
||||
{
|
||||
struct zlib_decompress_ctx *dctx =
|
||||
|
|
Загрузка…
Ссылка в новой задаче