mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-08 08:58:00 +00:00
Assorted benign warning fixes.
These were just too footling for even me to bother splitting up into
multiple commits:
- a couple of int -> size_t changes left out of the big-bang commit
0cda34c6f
- a few 'const' added to pointer-type casts that are only going to be
read from (leaving out the const provokes a warning if the pointer
was const _before_ the cast)
- a couple of 'return' statements trying to pass the void return of
one function through to another.
- another missing (void) in a declaration in putty.h (but this one
didn't cause any knock-on confusion).
- a few tweaks to macros, to arrange that they eat a semicolon after
the macro call (extra do ... while (0) wrappers, mostly, and one
case where I had to do it another way because the macro included a
variable declaration intended to remain in scope)
- reworked key_type_to_str to stop putting an unreachable 'break'
statement after every 'return'
- removed yet another type-check of a function loaded from a Windows
system DLL
- and finally, a totally spurious semicolon right after an open brace
in mainchan.c.
This commit is contained in:
parent
8d747d8029
commit
76430f8237
@ -858,9 +858,8 @@ int cmdline_process_param(const char *p, char *value,
|
||||
|
||||
void cmdline_run_saved(Conf *conf)
|
||||
{
|
||||
int pri, i;
|
||||
for (pri = 0; pri < NPRIORITIES; pri++) {
|
||||
for (i = 0; i < saves[pri].nsaved; i++) {
|
||||
for (size_t pri = 0; pri < NPRIORITIES; pri++) {
|
||||
for (size_t i = 0; i < saves[pri].nsaved; i++) {
|
||||
cmdline_process_param(saves[pri].params[i].p,
|
||||
saves[pri].params[i].value, 0, conf);
|
||||
sfree(saves[pri].params[i].p);
|
||||
|
@ -364,7 +364,7 @@ void log_packet(LogContext *ctx, int direction, int type,
|
||||
c = 'X';
|
||||
sprintf(smalldata, "XX");
|
||||
} else { /* PKTLOG_EMIT */
|
||||
c = ((unsigned char *)data)[p];
|
||||
c = ((const unsigned char *)data)[p];
|
||||
sprintf(smalldata, "%02x", c);
|
||||
}
|
||||
dumpdata[10+2+3*(p%16)] = smalldata[0];
|
||||
|
@ -142,7 +142,7 @@ static void mainchan_open_confirmation(Channel *chan)
|
||||
struct X11FakeAuth *x11auth;
|
||||
bool retry_cmd_now = false;
|
||||
|
||||
if (conf_get_bool(mc->conf, CONF_x11_forward)) {;
|
||||
if (conf_get_bool(mc->conf, CONF_x11_forward)) {
|
||||
char *x11_setup_err;
|
||||
if ((x11disp = x11_setup_display(
|
||||
conf_get_str(mc->conf, CONF_x11_display),
|
||||
|
4
mpint.c
4
mpint.c
@ -187,7 +187,7 @@ mp_int *mp_from_decimal_pl(ptrlen decimal)
|
||||
|
||||
mp_int *x = mp_make_sized(words);
|
||||
for (size_t i = 0; i < decimal.len; i++) {
|
||||
mp_add_integer_into(x, x, ((char *)decimal.ptr)[i] - '0');
|
||||
mp_add_integer_into(x, x, ((const char *)decimal.ptr)[i] - '0');
|
||||
|
||||
if (i+1 == decimal.len)
|
||||
break;
|
||||
@ -216,7 +216,7 @@ mp_int *mp_from_hex_pl(ptrlen hex)
|
||||
words = size_t_max(words, 1);
|
||||
mp_int *x = mp_make_sized(words);
|
||||
for (size_t nibble = 0; nibble < hex.len; nibble++) {
|
||||
BignumInt digit = ((char *)hex.ptr)[hex.len-1 - nibble];
|
||||
BignumInt digit = ((const char *)hex.ptr)[hex.len-1 - nibble];
|
||||
|
||||
BignumInt lmask = ~-((BignumInt)((digit-'a')|('f'-digit))
|
||||
>> (BIGNUM_INT_BITS-1));
|
||||
|
@ -283,8 +283,8 @@ static void list_keys(BinarySink *bs, int ssh_version)
|
||||
}
|
||||
}
|
||||
|
||||
void pageant_make_keylist1(BinarySink *bs) { return list_keys(bs, 1); }
|
||||
void pageant_make_keylist2(BinarySink *bs) { return list_keys(bs, 2); }
|
||||
void pageant_make_keylist1(BinarySink *bs) { list_keys(bs, 1); }
|
||||
void pageant_make_keylist2(BinarySink *bs) { list_keys(bs, 2); }
|
||||
|
||||
void pageant_register_client(PageantClient *pc)
|
||||
{
|
||||
|
2
putty.h
2
putty.h
@ -1790,7 +1790,7 @@ void random_unref(void);
|
||||
void random_clear(void);
|
||||
/* random_setup_special is used by PuTTYgen. It makes an extra-big
|
||||
* random number generator. */
|
||||
void random_setup_special();
|
||||
void random_setup_special(void);
|
||||
/* Manually drop a random seed into the random number generator, e.g.
|
||||
* just before generating a key. */
|
||||
void random_reseed(ptrlen seed);
|
||||
|
3
ssh.c
3
ssh.c
@ -457,7 +457,8 @@ static void ssh_initiate_connection_close(Ssh *ssh)
|
||||
va_list ap; \
|
||||
va_start(ap, fmt); \
|
||||
msg = dupvprintf(fmt, ap); \
|
||||
va_end(ap);
|
||||
va_end(ap); \
|
||||
((void)0) /* eat trailing semicolon */
|
||||
|
||||
void ssh_remote_error(Ssh *ssh, const char *fmt, ...)
|
||||
{
|
||||
|
4
ssh.h
4
ssh.h
@ -720,8 +720,8 @@ struct ssh_hashalg {
|
||||
void (*copyfrom)(ssh_hash *dest, ssh_hash *src);
|
||||
void (*digest)(ssh_hash *, unsigned char *);
|
||||
void (*free)(ssh_hash *);
|
||||
int hlen; /* output length in bytes */
|
||||
int blocklen; /* length of the hash's input block, or 0 for N/A */
|
||||
size_t hlen; /* output length in bytes */
|
||||
size_t blocklen; /* length of the hash's input block, or 0 for N/A */
|
||||
const char *text_basename; /* the semantic name of the hash */
|
||||
const char *annotation; /* extra info, e.g. which of multiple impls */
|
||||
const char *text_name; /* both combined, e.g. "SHA-n (unaccelerated)" */
|
||||
|
14
sshcr.h
14
sshcr.h
@ -25,19 +25,19 @@
|
||||
* Database for Edit and Continue'.
|
||||
*/
|
||||
|
||||
#define crBegin(v) { int *crLine = &v; switch(v) { case 0:;
|
||||
#define crBegin(v) do { int *crLine = &v; switch(v) { case 0:
|
||||
#define crBeginState crBegin(s->crLine)
|
||||
#define crStateP(t, v) \
|
||||
struct t *s; \
|
||||
if (!(v)) { s = (v) = snew(struct t); s->crLine = 0; } \
|
||||
s = (v);
|
||||
#define crState(t) crStateP(t, ssh->t)
|
||||
#define crFinish(z) } *crLine = 0; return (z); }
|
||||
#define crFinishV } *crLine = 0; return; }
|
||||
#define crFinishFreed(z) } return (z); }
|
||||
#define crFinishFreedV } return; }
|
||||
#define crFinishFree(z) } sfree(s); return (z); }
|
||||
#define crFinishFreeV } sfree(s); return; }
|
||||
#define crFinish(z) } *crLine = 0; return (z); } while (0)
|
||||
#define crFinishV } *crLine = 0; return; } while (0)
|
||||
#define crFinishFreed(z) } return (z); } while (0)
|
||||
#define crFinishFreedV } return; } while (0)
|
||||
#define crFinishFree(z) } sfree(s); return (z); } while (0)
|
||||
#define crFinishFreeV } sfree(s); return; } while (0)
|
||||
#define crReturn(z) \
|
||||
do {\
|
||||
*crLine =__LINE__; return (z); case __LINE__:;\
|
||||
|
37
sshpubk.c
37
sshpubk.c
@ -1664,23 +1664,36 @@ int key_type(const Filename *filename)
|
||||
const char *key_type_to_str(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case SSH_KEYTYPE_UNOPENABLE: return "unable to open file"; break;
|
||||
case SSH_KEYTYPE_UNKNOWN: return "not a recognised key file format"; break;
|
||||
case SSH_KEYTYPE_SSH1_PUBLIC: return "SSH-1 public key"; break;
|
||||
case SSH_KEYTYPE_SSH2_PUBLIC_RFC4716: return "SSH-2 public key (RFC 4716 format)"; break;
|
||||
case SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH: return "SSH-2 public key (OpenSSH format)"; break;
|
||||
case SSH_KEYTYPE_SSH1: return "SSH-1 private key"; break;
|
||||
case SSH_KEYTYPE_SSH2: return "PuTTY SSH-2 private key"; break;
|
||||
case SSH_KEYTYPE_OPENSSH_PEM: return "OpenSSH SSH-2 private key (old PEM format)"; break;
|
||||
case SSH_KEYTYPE_OPENSSH_NEW: return "OpenSSH SSH-2 private key (new format)"; break;
|
||||
case SSH_KEYTYPE_SSHCOM: return "ssh.com SSH-2 private key"; break;
|
||||
case SSH_KEYTYPE_UNOPENABLE:
|
||||
return "unable to open file";
|
||||
case SSH_KEYTYPE_UNKNOWN:
|
||||
return "not a recognised key file format";
|
||||
case SSH_KEYTYPE_SSH1_PUBLIC:
|
||||
return "SSH-1 public key";
|
||||
case SSH_KEYTYPE_SSH2_PUBLIC_RFC4716:
|
||||
return "SSH-2 public key (RFC 4716 format)";
|
||||
case SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH:
|
||||
return "SSH-2 public key (OpenSSH format)";
|
||||
case SSH_KEYTYPE_SSH1:
|
||||
return "SSH-1 private key";
|
||||
case SSH_KEYTYPE_SSH2:
|
||||
return "PuTTY SSH-2 private key";
|
||||
case SSH_KEYTYPE_OPENSSH_PEM:
|
||||
return "OpenSSH SSH-2 private key (old PEM format)";
|
||||
case SSH_KEYTYPE_OPENSSH_NEW:
|
||||
return "OpenSSH SSH-2 private key (new format)";
|
||||
case SSH_KEYTYPE_SSHCOM:
|
||||
return "ssh.com SSH-2 private key";
|
||||
|
||||
/*
|
||||
* This function is called with a key type derived from
|
||||
* looking at an actual key file, so the output-only type
|
||||
* OPENSSH_AUTO should never get here, and is much an INTERNAL
|
||||
* ERROR as a code we don't even understand.
|
||||
*/
|
||||
case SSH_KEYTYPE_OPENSSH_AUTO: return "INTERNAL ERROR (OPENSSH_AUTO)"; break;
|
||||
default: return "INTERNAL ERROR"; break;
|
||||
case SSH_KEYTYPE_OPENSSH_AUTO:
|
||||
unreachable("OPENSSH_AUTO should never reach key_type_to_str");
|
||||
default:
|
||||
unreachable("bad key type in key_type_to_str");
|
||||
}
|
||||
}
|
||||
|
27
sshsh512.c
27
sshsh512.c
@ -150,19 +150,20 @@ static void SHA512_Block(SHA512_State *s, uint64_t *block) {
|
||||
for (t = 0; t < 80; t+=8) {
|
||||
uint64_t tmp, p, q, r;
|
||||
|
||||
#define ROUND(j,a,b,c,d,e,f,g,h) \
|
||||
bigsigma1(p, tmp, e); \
|
||||
Ch(q, tmp, e, f, g); \
|
||||
add(r, p, q); \
|
||||
add(p, r, k[j]) ; \
|
||||
add(q, p, w[j]); \
|
||||
add(r, q, h); \
|
||||
bigsigma0(p, tmp, a); \
|
||||
Maj(tmp, q, a, b, c); \
|
||||
add(q, tmp, p); \
|
||||
add(p, r, d); \
|
||||
d = p; \
|
||||
add(h, q, r);
|
||||
#define ROUND(j,a,b,c,d,e,f,g,h) do { \
|
||||
bigsigma1(p, tmp, e); \
|
||||
Ch(q, tmp, e, f, g); \
|
||||
add(r, p, q); \
|
||||
add(p, r, k[j]) ; \
|
||||
add(q, p, w[j]); \
|
||||
add(r, q, h); \
|
||||
bigsigma0(p, tmp, a); \
|
||||
Maj(tmp, q, a, b, c); \
|
||||
add(q, tmp, p); \
|
||||
add(p, r, d); \
|
||||
d = p; \
|
||||
add(h, q, r); \
|
||||
} while (0)
|
||||
|
||||
ROUND(t+0, a,b,c,d,e,f,g,h);
|
||||
ROUND(t+1, h,a,b,c,d,e,f,g);
|
||||
|
@ -299,13 +299,12 @@ void sk_init(void)
|
||||
GET_WINDOWS_FUNCTION(winsock_module, getservbyname);
|
||||
GET_WINDOWS_FUNCTION(winsock_module, inet_addr);
|
||||
GET_WINDOWS_FUNCTION(winsock_module, inet_ntoa);
|
||||
#if (defined _MSC_VER && _MSC_VER < 1900) || defined __MINGW32__
|
||||
/* Older Visual Studio, and MinGW as of Ubuntu 16.04, don't know
|
||||
* about this function at all, so can't type-check it */
|
||||
* about this function at all, so can't type-check it. Also there
|
||||
* seems to be some disagreement in the VS headers about whether
|
||||
* the second argument is void * or const void *, so I omit the
|
||||
* type check. */
|
||||
GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, inet_ntop);
|
||||
#else
|
||||
GET_WINDOWS_FUNCTION(winsock_module, inet_ntop);
|
||||
#endif
|
||||
GET_WINDOWS_FUNCTION(winsock_module, connect);
|
||||
GET_WINDOWS_FUNCTION(winsock_module, bind);
|
||||
GET_WINDOWS_FUNCTION(winsock_module, setsockopt);
|
||||
|
Loading…
Reference in New Issue
Block a user