1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-23 15:09:24 -05:00

Add missing 'static' on file-internal declarations.

sk_startup and sk_nextaddr are entirely internal to winnet.c; nearly
all of import.c and minibidi.c's internal routines should have been
static and weren't; {read,write}_utf8 are internal to charset/utf8.c
(and didn't even need separate declarations at all); do_sftp_cleanup
is internal to psftp.c, and get_listitemheight to gtkdlg.c.

While I was editing those prototypes anyway, I've also added missing
'const' to the 'char *' passphrase parameters in import,c.
This commit is contained in:
Simon Tatham 2018-11-03 08:25:28 +00:00
parent c089827ea0
commit 91d16881ab
6 changed files with 64 additions and 69 deletions

View File

@ -7,16 +7,11 @@
#include "charset.h" #include "charset.h"
#include "internal.h" #include "internal.h"
void read_utf8(charset_spec const *, long int, charset_state *,
void (*)(void *, long int), void *);
void write_utf8(charset_spec const *, long int,
charset_state *, void (*)(void *, long int), void *);
/* /*
* UTF-8 has no associated data, so `charset' may be ignored. * UTF-8 has no associated data, so `charset' may be ignored.
*/ */
void read_utf8(charset_spec const *charset, long int input_chr, static void read_utf8(charset_spec const *charset, long int input_chr,
charset_state *state, charset_state *state,
void (*emit)(void *ctx, long int output), void *emitctx) void (*emit)(void *ctx, long int output), void *emitctx)
{ {
@ -186,7 +181,7 @@ void read_utf8(charset_spec const *charset, long int input_chr,
* charset_state. * charset_state.
*/ */
void write_utf8(charset_spec const *charset, long int input_chr, static void write_utf8(charset_spec const *charset, long int input_chr,
charset_state *state, charset_state *state,
void (*emit)(void *ctx, long int output), void *emitctx) void (*emit)(void *ctx, long int output), void *emitctx)
{ {

View File

@ -12,26 +12,24 @@
#include "ssh.h" #include "ssh.h"
#include "misc.h" #include "misc.h"
bool openssh_pem_encrypted(const Filename *filename); static bool openssh_pem_encrypted(const Filename *file);
bool openssh_new_encrypted(const Filename *filename); static bool openssh_new_encrypted(const Filename *file);
struct ssh2_userkey *openssh_pem_read(const Filename *filename, static struct ssh2_userkey *openssh_pem_read(
char *passphrase, const Filename *file, const char *passphrase, const char **errmsg_p);
const char **errmsg_p); static struct ssh2_userkey *openssh_new_read(
struct ssh2_userkey *openssh_new_read(const Filename *filename, const Filename *file, const char *passphrase, const char **errmsg_p);
char *passphrase, static bool openssh_auto_write(
const char **errmsg_p); const Filename *file, struct ssh2_userkey *key, const char *passphrase);
bool openssh_auto_write(const Filename *filename, struct ssh2_userkey *key, static bool openssh_pem_write(
char *passphrase); const Filename *file, struct ssh2_userkey *key, const char *passphrase);
bool openssh_pem_write(const Filename *filename, struct ssh2_userkey *key, static bool openssh_new_write(
char *passphrase); const Filename *file, struct ssh2_userkey *key, const char *passphrase);
bool openssh_new_write(const Filename *filename, struct ssh2_userkey *key,
char *passphrase);
bool sshcom_encrypted(const Filename *filename, char **comment); static bool sshcom_encrypted(const Filename *file, char **comment);
struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase, static struct ssh2_userkey *sshcom_read(
const char **errmsg_p); const Filename *file, const char *passphrase, const char **errmsg_p);
bool sshcom_write(const Filename *filename, struct ssh2_userkey *key, static bool sshcom_write(
char *passphrase); const Filename *file, struct ssh2_userkey *key, const char *passphrase);
/* /*
* Given a key type, determine whether we know how to import it. * Given a key type, determine whether we know how to import it.
@ -482,7 +480,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename,
return NULL; return NULL;
} }
bool openssh_pem_encrypted(const Filename *filename) static bool openssh_pem_encrypted(const Filename *filename)
{ {
struct openssh_pem_key *key = load_openssh_pem_key(filename, NULL); struct openssh_pem_key *key = load_openssh_pem_key(filename, NULL);
bool ret; bool ret;
@ -496,9 +494,8 @@ bool openssh_pem_encrypted(const Filename *filename)
return ret; return ret;
} }
struct ssh2_userkey *openssh_pem_read(const Filename *filename, static struct ssh2_userkey *openssh_pem_read(
char *passphrase, const Filename *filename, const char *passphrase, const char **errmsg_p)
const char **errmsg_p)
{ {
struct openssh_pem_key *key = load_openssh_pem_key(filename, errmsg_p); struct openssh_pem_key *key = load_openssh_pem_key(filename, errmsg_p);
struct ssh2_userkey *retkey; struct ssh2_userkey *retkey;
@ -775,8 +772,8 @@ struct ssh2_userkey *openssh_pem_read(const Filename *filename,
return retval; return retval;
} }
bool openssh_pem_write(const Filename *filename, struct ssh2_userkey *key, static bool openssh_pem_write(
char *passphrase) const Filename *filename, struct ssh2_userkey *key, const char *passphrase)
{ {
strbuf *pubblob, *privblob, *outblob; strbuf *pubblob, *privblob, *outblob;
unsigned char *spareblob; unsigned char *spareblob;
@ -1319,7 +1316,7 @@ static struct openssh_new_key *load_openssh_new_key(const Filename *filename,
return NULL; return NULL;
} }
bool openssh_new_encrypted(const Filename *filename) static bool openssh_new_encrypted(const Filename *filename)
{ {
struct openssh_new_key *key = load_openssh_new_key(filename, NULL); struct openssh_new_key *key = load_openssh_new_key(filename, NULL);
bool ret; bool ret;
@ -1334,9 +1331,8 @@ bool openssh_new_encrypted(const Filename *filename)
return ret; return ret;
} }
struct ssh2_userkey *openssh_new_read(const Filename *filename, static struct ssh2_userkey *openssh_new_read(
char *passphrase, const Filename *filename, const char *passphrase, const char **errmsg_p)
const char **errmsg_p)
{ {
struct openssh_new_key *key = load_openssh_new_key(filename, errmsg_p); struct openssh_new_key *key = load_openssh_new_key(filename, errmsg_p);
struct ssh2_userkey *retkey = NULL; struct ssh2_userkey *retkey = NULL;
@ -1515,8 +1511,8 @@ struct ssh2_userkey *openssh_new_read(const Filename *filename,
return retval; return retval;
} }
bool openssh_new_write(const Filename *filename, struct ssh2_userkey *key, static bool openssh_new_write(
char *passphrase) const Filename *filename, struct ssh2_userkey *key, const char *passphrase)
{ {
strbuf *pubblob, *privblob, *cblob; strbuf *pubblob, *privblob, *cblob;
int padvalue, i; int padvalue, i;
@ -1644,8 +1640,8 @@ bool openssh_new_write(const Filename *filename, struct ssh2_userkey *key,
* The switch function openssh_auto_write(), which chooses one of the * The switch function openssh_auto_write(), which chooses one of the
* concrete OpenSSH output formats based on the key type. * concrete OpenSSH output formats based on the key type.
*/ */
bool openssh_auto_write(const Filename *filename, struct ssh2_userkey *key, static bool openssh_auto_write(
char *passphrase) const Filename *filename, struct ssh2_userkey *key, const char *passphrase)
{ {
/* /*
* The old OpenSSH format supports a fixed list of key types. We * The old OpenSSH format supports a fixed list of key types. We
@ -1905,7 +1901,7 @@ static struct sshcom_key *load_sshcom_key(const Filename *filename,
return NULL; return NULL;
} }
bool sshcom_encrypted(const Filename *filename, char **comment) static bool sshcom_encrypted(const Filename *filename, char **comment)
{ {
struct sshcom_key *key = load_sshcom_key(filename, NULL); struct sshcom_key *key = load_sshcom_key(filename, NULL);
BinarySource src[1]; BinarySource src[1];
@ -1970,8 +1966,8 @@ static ptrlen BinarySource_get_mp_sshcom_as_string(BinarySource *src)
#define get_mp_sshcom_as_string(bs) \ #define get_mp_sshcom_as_string(bs) \
BinarySource_get_mp_sshcom_as_string(BinarySource_UPCAST(bs)) BinarySource_get_mp_sshcom_as_string(BinarySource_UPCAST(bs))
struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase, static struct ssh2_userkey *sshcom_read(
const char **errmsg_p) const Filename *filename, const char *passphrase, const char **errmsg_p)
{ {
struct sshcom_key *key = load_sshcom_key(filename, errmsg_p); struct sshcom_key *key = load_sshcom_key(filename, errmsg_p);
const char *errmsg; const char *errmsg;
@ -2181,8 +2177,8 @@ struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase,
return ret; return ret;
} }
bool sshcom_write(const Filename *filename, struct ssh2_userkey *key, static bool sshcom_write(
char *passphrase) const Filename *filename, struct ssh2_userkey *key, const char *passphrase)
{ {
strbuf *pubblob, *privblob, *outblob; strbuf *pubblob, *privblob, *outblob;
ptrlen numbers[6]; ptrlen numbers[6];

View File

@ -55,14 +55,15 @@ typedef struct bidi_char {
} bidi_char; } bidi_char;
/* function declarations */ /* function declarations */
void flipThisRun(bidi_char *from, unsigned char* level, int max, int count); static void flipThisRun(
int findIndexOfRun(unsigned char* level , int start, int count, int tlevel); bidi_char *from, unsigned char *level, int max, int count);
unsigned char getType(int ch); static int findIndexOfRun(
unsigned char setOverrideBits(unsigned char level, unsigned char override); unsigned char *level, int start, int count, int tlevel);
int getPreviousLevel(unsigned char* level, int from); static unsigned char getType(int ch);
int do_shape(bidi_char *line, bidi_char *to, int count); static unsigned char setOverrideBits(
int do_bidi(bidi_char *line, int count); unsigned char level, unsigned char override);
void doMirror(unsigned int *ch); static int getPreviousLevel(unsigned char *level, int from);
static void doMirror(unsigned int *ch);
/* character types */ /* character types */
enum { enum {
@ -297,7 +298,8 @@ const shape_node shapetypes[] = {
* max: the maximum level found in this line (should be unsigned char) * max: the maximum level found in this line (should be unsigned char)
* count: line size in bidi_char * count: line size in bidi_char
*/ */
void flipThisRun(bidi_char *from, unsigned char *level, int max, int count) static void flipThisRun(
bidi_char *from, unsigned char *level, int max, int count)
{ {
int i, j, k, tlevel; int i, j, k, tlevel;
bidi_char temp; bidi_char temp;
@ -323,7 +325,8 @@ void flipThisRun(bidi_char *from, unsigned char *level, int max, int count)
/* /*
* Finds the index of a run with level equals tlevel * Finds the index of a run with level equals tlevel
*/ */
int findIndexOfRun(unsigned char* level , int start, int count, int tlevel) static int findIndexOfRun(
unsigned char *level , int start, int count, int tlevel)
{ {
int i; int i;
for (i=start; i<count; i++) { for (i=start; i<count; i++) {
@ -355,7 +358,7 @@ perl -ne 'split ";"; $num = hex $_[0]; $type = $_[4];' \
UnicodeData.txt UnicodeData.txt
*/ */
unsigned char getType(int ch) static unsigned char getType(int ch)
{ {
static const struct { static const struct {
int first, last, type; int first, last, type;
@ -1045,7 +1048,8 @@ int is_rtl(int c)
* This function sets the override bits of level according * This function sets the override bits of level according
* to the value in override, and reurns the new byte. * to the value in override, and reurns the new byte.
*/ */
unsigned char setOverrideBits(unsigned char level, unsigned char override) static unsigned char setOverrideBits(
unsigned char level, unsigned char override)
{ {
if (override == ON) if (override == ON)
return level; return level;
@ -1061,7 +1065,7 @@ unsigned char setOverrideBits(unsigned char level, unsigned char override)
* return the value _before_ it. Used to process U+202C POP * return the value _before_ it. Used to process U+202C POP
* DIRECTIONAL FORMATTING. * DIRECTIONAL FORMATTING.
*/ */
int getPreviousLevel(unsigned char* level, int from) static int getPreviousLevel(unsigned char *level, int from)
{ {
if (from > 0) { if (from > 0) {
unsigned char current = level[--from]; unsigned char current = level[--from];
@ -1630,7 +1634,7 @@ int do_bidi(bidi_char *line, int count)
* takes a pointer to a character that is checked for * takes a pointer to a character that is checked for
* having a mirror glyph. * having a mirror glyph.
*/ */
void doMirror(unsigned int *ch) static void doMirror(unsigned int *ch)
{ {
if ((*ch & 0xFF00) == 0) { if ((*ch & 0xFF00) == 0) {
switch (*ch) { switch (*ch) {

View File

@ -26,7 +26,7 @@ const char *const appname = "PSFTP";
static int psftp_connect(char *userhost, char *user, int portnumber); static int psftp_connect(char *userhost, char *user, int portnumber);
static int do_sftp_init(void); static int do_sftp_init(void);
void do_sftp_cleanup(); static void do_sftp_cleanup(void);
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* sftp client state. * sftp client state.
@ -2383,7 +2383,7 @@ static int do_sftp_init(void)
return 0; return 0;
} }
void do_sftp_cleanup() static void do_sftp_cleanup(void)
{ {
char ch; char ch;
if (backend) { if (backend) {

View File

@ -150,7 +150,7 @@ static void coloursel_ok(GtkButton *button, gpointer data);
static void coloursel_cancel(GtkButton *button, gpointer data); static void coloursel_cancel(GtkButton *button, gpointer data);
#endif #endif
static void dlgparam_destroy(GtkWidget *widget, gpointer data); static void dlgparam_destroy(GtkWidget *widget, gpointer data);
int get_listitemheight(GtkWidget *widget); static int get_listitemheight(GtkWidget *widget);
static int uctrl_cmp_byctrl(void *av, void *bv) static int uctrl_cmp_byctrl(void *av, void *bv)
{ {
@ -2836,7 +2836,7 @@ void shortcut_add(struct Shortcuts *scs, GtkWidget *labelw,
shortcut_highlight(labelw, chr); shortcut_highlight(labelw, chr);
} }
int get_listitemheight(GtkWidget *w) static int get_listitemheight(GtkWidget *w)
{ {
#if !GTK_CHECK_VERSION(2,0,0) #if !GTK_CHECK_VERSION(2,0,0)
GtkWidget *listitem = gtk_list_item_new_with_label("foo"); GtkWidget *listitem = gtk_list_item_new_with_label("foo");

View File

@ -206,7 +206,7 @@ static HMODULE winsock2_module = NULL;
static HMODULE wship6_module = NULL; static HMODULE wship6_module = NULL;
#endif #endif
bool sk_startup(int hi, int lo) static bool sk_startup(int hi, int lo)
{ {
WORD winsock_ver; WORD winsock_ver;
@ -590,7 +590,7 @@ SockAddr *sk_namedpipe_addr(const char *pipename)
return ret; return ret;
} }
bool sk_nextaddr(SockAddr *addr, SockAddrStep *step) static bool sk_nextaddr(SockAddr *addr, SockAddrStep *step)
{ {
#ifndef NO_IPV6 #ifndef NO_IPV6
if (step->ai) { if (step->ai) {