1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05: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:
Simon Tatham
2020-01-29 06:35:53 +00:00
parent 8d747d8029
commit 76430f8237
12 changed files with 63 additions and 50 deletions

View File

@ -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");
}
}