1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Add an assortment of missing consts I've just noticed.

[originally from svn r9972]
This commit is contained in:
Simon Tatham 2013-07-27 18:35:48 +00:00
parent a5fd6ad272
commit 808df44e54
7 changed files with 19 additions and 18 deletions

View File

@ -116,7 +116,7 @@ void sk_cleanup(void); /* called just before program exit */
SockAddr sk_namelookup(const char *host, char **canonicalname, int address_family); SockAddr sk_namelookup(const char *host, char **canonicalname, int address_family);
SockAddr sk_nonamelookup(const char *host); SockAddr sk_nonamelookup(const char *host);
void sk_getaddr(SockAddr addr, char *buf, int buflen); void sk_getaddr(SockAddr addr, char *buf, int buflen);
int sk_hostname_is_local(char *name); int sk_hostname_is_local(const char *name);
int sk_address_is_local(SockAddr addr); int sk_address_is_local(SockAddr addr);
int sk_address_is_special_local(SockAddr addr); int sk_address_is_special_local(SockAddr addr);
int sk_addrtype(SockAddr addr); int sk_addrtype(SockAddr addr);

View File

@ -277,8 +277,8 @@ static int plug_proxy_accepting (Plug p, OSSocket sock)
* This function can accept a NULL pointer as `addr', in which case * This function can accept a NULL pointer as `addr', in which case
* it will only check the host name. * it will only check the host name.
*/ */
static int proxy_for_destination (SockAddr addr, char *hostname, int port, static int proxy_for_destination (SockAddr addr, const char *hostname,
Conf *conf) int port, Conf *conf)
{ {
int s = 0, e = 0; int s = 0, e = 0;
char hostip[64]; char hostip[64];

17
ssh.c
View File

@ -460,14 +460,14 @@ struct Packet;
static struct Packet *ssh1_pkt_init(int pkt_type); static struct Packet *ssh1_pkt_init(int pkt_type);
static struct Packet *ssh2_pkt_init(int pkt_type); static struct Packet *ssh2_pkt_init(int pkt_type);
static void ssh_pkt_ensure(struct Packet *, int length); static void ssh_pkt_ensure(struct Packet *, int length);
static void ssh_pkt_adddata(struct Packet *, void *data, int len); static void ssh_pkt_adddata(struct Packet *, const void *data, int len);
static void ssh_pkt_addbyte(struct Packet *, unsigned char value); static void ssh_pkt_addbyte(struct Packet *, unsigned char value);
static void ssh2_pkt_addbool(struct Packet *, unsigned char value); static void ssh2_pkt_addbool(struct Packet *, unsigned char value);
static void ssh_pkt_adduint32(struct Packet *, unsigned long value); static void ssh_pkt_adduint32(struct Packet *, unsigned long value);
static void ssh_pkt_addstring_start(struct Packet *); static void ssh_pkt_addstring_start(struct Packet *);
static void ssh_pkt_addstring_str(struct Packet *, char *data); static void ssh_pkt_addstring_str(struct Packet *, const char *data);
static void ssh_pkt_addstring_data(struct Packet *, char *data, int len); static void ssh_pkt_addstring_data(struct Packet *, const char *data, int len);
static void ssh_pkt_addstring(struct Packet *, char *data); static void ssh_pkt_addstring(struct Packet *, const char *data);
static unsigned char *ssh2_mpint_fmt(Bignum b, int *len); static unsigned char *ssh2_mpint_fmt(Bignum b, int *len);
static void ssh1_pkt_addmp(struct Packet *, Bignum b); static void ssh1_pkt_addmp(struct Packet *, Bignum b);
static void ssh2_pkt_addmp(struct Packet *, Bignum b); static void ssh2_pkt_addmp(struct Packet *, Bignum b);
@ -1829,7 +1829,7 @@ static void ssh_pkt_ensure(struct Packet *pkt, int length)
if (body) pkt->body = pkt->data + offset; if (body) pkt->body = pkt->data + offset;
} }
} }
static void ssh_pkt_adddata(struct Packet *pkt, void *data, int len) static void ssh_pkt_adddata(struct Packet *pkt, const void *data, int len)
{ {
if (pkt->logmode != PKTLOG_EMIT) { if (pkt->logmode != PKTLOG_EMIT) {
pkt->nblanks++; pkt->nblanks++;
@ -1863,17 +1863,18 @@ static void ssh_pkt_addstring_start(struct Packet *pkt)
ssh_pkt_adduint32(pkt, 0); ssh_pkt_adduint32(pkt, 0);
pkt->savedpos = pkt->length; pkt->savedpos = pkt->length;
} }
static void ssh_pkt_addstring_str(struct Packet *pkt, char *data) static void ssh_pkt_addstring_str(struct Packet *pkt, const char *data)
{ {
ssh_pkt_adddata(pkt, data, strlen(data)); ssh_pkt_adddata(pkt, data, strlen(data));
PUT_32BIT(pkt->data + pkt->savedpos - 4, pkt->length - pkt->savedpos); PUT_32BIT(pkt->data + pkt->savedpos - 4, pkt->length - pkt->savedpos);
} }
static void ssh_pkt_addstring_data(struct Packet *pkt, char *data, int len) static void ssh_pkt_addstring_data(struct Packet *pkt, const char *data,
int len)
{ {
ssh_pkt_adddata(pkt, data, len); ssh_pkt_adddata(pkt, data, len);
PUT_32BIT(pkt->data + pkt->savedpos - 4, pkt->length - pkt->savedpos); PUT_32BIT(pkt->data + pkt->savedpos - 4, pkt->length - pkt->savedpos);
} }
static void ssh_pkt_addstring(struct Packet *pkt, char *data) static void ssh_pkt_addstring(struct Packet *pkt, const char *data)
{ {
ssh_pkt_addstring_start(pkt); ssh_pkt_addstring_start(pkt);
ssh_pkt_addstring_str(pkt, data); ssh_pkt_addstring_str(pkt, data);

4
ssh.h
View File

@ -133,9 +133,9 @@ typedef struct {
uint32 lenhi, lenlo; uint32 lenhi, lenlo;
} SHA_State; } SHA_State;
void SHA_Init(SHA_State * s); void SHA_Init(SHA_State * s);
void SHA_Bytes(SHA_State * s, void *p, int len); void SHA_Bytes(SHA_State * s, const void *p, int len);
void SHA_Final(SHA_State * s, unsigned char *output); void SHA_Final(SHA_State * s, unsigned char *output);
void SHA_Simple(void *p, int len, unsigned char *output); void SHA_Simple(const void *p, int len, unsigned char *output);
void hmac_sha1_simple(void *key, int keylen, void *data, int datalen, void hmac_sha1_simple(void *key, int keylen, void *data, int datalen,
unsigned char *output); unsigned char *output);

View File

@ -126,9 +126,9 @@ void SHA_Init(SHA_State * s)
s->lenhi = s->lenlo = 0; s->lenhi = s->lenlo = 0;
} }
void SHA_Bytes(SHA_State * s, void *p, int len) void SHA_Bytes(SHA_State * s, const void *p, int len)
{ {
unsigned char *q = (unsigned char *) p; const unsigned char *q = (const unsigned char *) p;
uint32 wordblock[16]; uint32 wordblock[16];
uint32 lenw = len; uint32 lenw = len;
int i; int i;
@ -207,7 +207,7 @@ void SHA_Final(SHA_State * s, unsigned char *output)
} }
} }
void SHA_Simple(void *p, int len, unsigned char *output) void SHA_Simple(const void *p, int len, unsigned char *output)
{ {
SHA_State s; SHA_State s;

View File

@ -341,7 +341,7 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen)
} }
} }
int sk_hostname_is_local(char *name) int sk_hostname_is_local(const char *name)
{ {
return !strcmp(name, "localhost") || return !strcmp(name, "localhost") ||
!strcmp(name, "::1") || !strcmp(name, "::1") ||

View File

@ -672,7 +672,7 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen)
} }
} }
int sk_hostname_is_local(char *name) int sk_hostname_is_local(const char *name)
{ {
return !strcmp(name, "localhost") || return !strcmp(name, "localhost") ||
!strcmp(name, "::1") || !strcmp(name, "::1") ||