mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Miscellaneous fixes to finish up `remove-statics'. rlogin.c had a
holdout static I hadn't noticed; unicode.c had one too; and a large number of statics that were perfectly OK due to being constants have been made `const', with assorted `const' repercussions all over the place. I now declare `remove-statics' to be fixed. [originally from svn r2594]
This commit is contained in:
parent
1f39efb94d
commit
f6cc852c5d
@ -57,7 +57,7 @@ struct pfwd_queue {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct PFwdPrivate {
|
struct PFwdPrivate {
|
||||||
struct plug_function_table *fn;
|
const struct plug_function_table *fn;
|
||||||
/* the above variable absolutely *must* be the first in this structure */
|
/* the above variable absolutely *must* be the first in this structure */
|
||||||
void *c; /* (channel) data used by ssh.c */
|
void *c; /* (channel) data used by ssh.c */
|
||||||
void *backhandle; /* instance of SSH backend itself */
|
void *backhandle; /* instance of SSH backend itself */
|
||||||
@ -111,7 +111,7 @@ static void pfd_sent(Plug plug, int bufsize)
|
|||||||
char *pfd_newconnect(Socket *s, char *hostname, int port, void *c,
|
char *pfd_newconnect(Socket *s, char *hostname, int port, void *c,
|
||||||
const Config *cfg)
|
const Config *cfg)
|
||||||
{
|
{
|
||||||
static struct plug_function_table fn_table = {
|
static const struct plug_function_table fn_table = {
|
||||||
pfd_closing,
|
pfd_closing,
|
||||||
pfd_receive,
|
pfd_receive,
|
||||||
pfd_sent,
|
pfd_sent,
|
||||||
@ -157,7 +157,7 @@ char *pfd_newconnect(Socket *s, char *hostname, int port, void *c,
|
|||||||
|
|
||||||
static int pfd_accepting(Plug p, void *sock)
|
static int pfd_accepting(Plug p, void *sock)
|
||||||
{
|
{
|
||||||
static struct plug_function_table fn_table = {
|
static const struct plug_function_table fn_table = {
|
||||||
pfd_closing,
|
pfd_closing,
|
||||||
pfd_receive,
|
pfd_receive,
|
||||||
pfd_sent,
|
pfd_sent,
|
||||||
@ -208,7 +208,7 @@ static int pfd_accepting(Plug p, void *sock)
|
|||||||
char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port,
|
char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port,
|
||||||
void *backhandle, const Config *cfg)
|
void *backhandle, const Config *cfg)
|
||||||
{
|
{
|
||||||
static struct plug_function_table fn_table = {
|
static const struct plug_function_table fn_table = {
|
||||||
pfd_closing,
|
pfd_closing,
|
||||||
pfd_receive, /* should not happen... */
|
pfd_receive, /* should not happen... */
|
||||||
pfd_sent, /* also should not happen */
|
pfd_sent, /* also should not happen */
|
||||||
|
4
putty.h
4
putty.h
@ -493,8 +493,8 @@ void registry_cleanup(void);
|
|||||||
* which I can reliably set aside to indicate `nil'. The string
|
* which I can reliably set aside to indicate `nil'. The string
|
||||||
* function is perfectly all right returning NULL, of course.)
|
* function is perfectly all right returning NULL, of course.)
|
||||||
*/
|
*/
|
||||||
char *platform_default_s(char *name);
|
char *platform_default_s(const char *name);
|
||||||
int platform_default_i(char *name, int def);
|
int platform_default_i(const char *name, int def);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exports from terminal.c.
|
* Exports from terminal.c.
|
||||||
|
7
rlogin.c
7
rlogin.c
@ -19,6 +19,7 @@ typedef struct rlogin_tag {
|
|||||||
|
|
||||||
Socket s;
|
Socket s;
|
||||||
int bufsize;
|
int bufsize;
|
||||||
|
int firstbyte;
|
||||||
int term_width, term_height;
|
int term_width, term_height;
|
||||||
void *frontend;
|
void *frontend;
|
||||||
} *Rlogin;
|
} *Rlogin;
|
||||||
@ -69,13 +70,12 @@ static int rlogin_receive(Plug plug, int urgent, char *data, int len)
|
|||||||
* byte is expected to be NULL and is ignored, and the rest
|
* byte is expected to be NULL and is ignored, and the rest
|
||||||
* is printed.
|
* is printed.
|
||||||
*/
|
*/
|
||||||
static int firstbyte = 1;
|
if (rlogin->firstbyte) {
|
||||||
if (firstbyte) {
|
|
||||||
if (data[0] == '\0') {
|
if (data[0] == '\0') {
|
||||||
data++;
|
data++;
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
firstbyte = 0;
|
rlogin->firstbyte = 0;
|
||||||
}
|
}
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
c_write(rlogin, data, len);
|
c_write(rlogin, data, len);
|
||||||
@ -116,6 +116,7 @@ static char *rlogin_init(void *frontend_handle, void **backend_handle,
|
|||||||
rlogin->frontend = frontend_handle;
|
rlogin->frontend = frontend_handle;
|
||||||
rlogin->term_width = cfg->width;
|
rlogin->term_width = cfg->width;
|
||||||
rlogin->term_height = cfg->height;
|
rlogin->term_height = cfg->height;
|
||||||
|
rlogin->firstbyte = 1;
|
||||||
*backend_handle = rlogin;
|
*backend_handle = rlogin;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -20,7 +20,8 @@ static const struct keyval ciphernames[] = {
|
|||||||
{ "des", CIPHER_DES }
|
{ "des", CIPHER_DES }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gpps(void *handle, char *name, char *def, char *val, int len)
|
static void gpps(void *handle, const char *name, const char *def,
|
||||||
|
char *val, int len)
|
||||||
{
|
{
|
||||||
if (!read_setting_s(handle, name, val, len)) {
|
if (!read_setting_s(handle, name, val, len)) {
|
||||||
char *pdef;
|
char *pdef;
|
||||||
@ -518,7 +519,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
|
|||||||
gppi(sesskey, "TryPalette", 0, &cfg->try_palette);
|
gppi(sesskey, "TryPalette", 0, &cfg->try_palette);
|
||||||
gppi(sesskey, "BoldAsColour", 1, &cfg->bold_colour);
|
gppi(sesskey, "BoldAsColour", 1, &cfg->bold_colour);
|
||||||
for (i = 0; i < 22; i++) {
|
for (i = 0; i < 22; i++) {
|
||||||
static char *defaults[] = {
|
static const char *const defaults[] = {
|
||||||
"187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0",
|
"187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0",
|
||||||
"0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85",
|
"0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85",
|
||||||
"0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187",
|
"0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187",
|
||||||
@ -541,7 +542,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
|
|||||||
gppi(sesskey, "RectSelect", 0, &cfg->rect_select);
|
gppi(sesskey, "RectSelect", 0, &cfg->rect_select);
|
||||||
gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
|
gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
|
||||||
for (i = 0; i < 256; i += 32) {
|
for (i = 0; i < 256; i += 32) {
|
||||||
static char *defaults[] = {
|
static const char *const defaults[] = {
|
||||||
"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||||
"0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1",
|
"0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1",
|
||||||
"1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2",
|
"1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2",
|
||||||
|
20
storage.h
20
storage.h
@ -26,9 +26,9 @@
|
|||||||
* Keys may be up to 255 characters long. String values have no length
|
* Keys may be up to 255 characters long. String values have no length
|
||||||
* limit.
|
* limit.
|
||||||
*/
|
*/
|
||||||
void *open_settings_w(char *sessionname);
|
void *open_settings_w(const char *sessionname);
|
||||||
void write_setting_s(void *handle, char *key, char *value);
|
void write_setting_s(void *handle, const char *key, const char *value);
|
||||||
void write_setting_i(void *handle, char *key, int value);
|
void write_setting_i(void *handle, const char *key, int value);
|
||||||
void close_settings_w(void *handle);
|
void close_settings_w(void *handle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -45,15 +45,15 @@ void close_settings_w(void *handle);
|
|||||||
* should invent a sensible default. If an integer setting is not
|
* should invent a sensible default. If an integer setting is not
|
||||||
* present, read_setting_i() returns its provided default.
|
* present, read_setting_i() returns its provided default.
|
||||||
*/
|
*/
|
||||||
void *open_settings_r(char *sessionname);
|
void *open_settings_r(const char *sessionname);
|
||||||
char *read_setting_s(void *handle, char *key, char *buffer, int buflen);
|
char *read_setting_s(void *handle, const char *key, char *buffer, int buflen);
|
||||||
int read_setting_i(void *handle, char *key, int defvalue);
|
int read_setting_i(void *handle, const char *key, int defvalue);
|
||||||
void close_settings_r(void *handle);
|
void close_settings_r(void *handle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete a whole saved session.
|
* Delete a whole saved session.
|
||||||
*/
|
*/
|
||||||
void del_settings(char *sessionname);
|
void del_settings(const char *sessionname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enumerate all saved sessions.
|
* Enumerate all saved sessions.
|
||||||
@ -71,13 +71,15 @@ void enum_settings_finish(void *handle);
|
|||||||
* be 0 (entry matches database), 1 (entry is absent in database),
|
* be 0 (entry matches database), 1 (entry is absent in database),
|
||||||
* or 2 (entry exists in database and is different).
|
* or 2 (entry exists in database and is different).
|
||||||
*/
|
*/
|
||||||
int verify_host_key(char *hostname, int port, char *keytype, char *key);
|
int verify_host_key(const char *hostname, int port,
|
||||||
|
const char *keytype, const char *key);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a host key into the database, overwriting any previous
|
* Write a host key into the database, overwriting any previous
|
||||||
* entry that might have been there.
|
* entry that might have been there.
|
||||||
*/
|
*/
|
||||||
void store_host_key(char *hostname, int port, char *keytype, char *key);
|
void store_host_key(const char *hostname, int port,
|
||||||
|
const char *keytype, const char *key);
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
* Functions to access PuTTY's random number seed file.
|
* Functions to access PuTTY's random number seed file.
|
||||||
|
6
telnet.c
6
telnet.c
@ -758,10 +758,10 @@ static int telnet_send(void *handle, char *buf, int len)
|
|||||||
{
|
{
|
||||||
Telnet telnet = (Telnet) handle;
|
Telnet telnet = (Telnet) handle;
|
||||||
unsigned char *p, *end;
|
unsigned char *p, *end;
|
||||||
static unsigned char iac[2] = { IAC, IAC };
|
static const unsigned char iac[2] = { IAC, IAC };
|
||||||
static unsigned char cr[2] = { CR, NUL };
|
static const unsigned char cr[2] = { CR, NUL };
|
||||||
#if 0
|
#if 0
|
||||||
static unsigned char nl[2] = { CR, LF };
|
static const unsigned char nl[2] = { CR, LF };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (telnet->s == NULL)
|
if (telnet->s == NULL)
|
||||||
|
26
unicode.c
26
unicode.c
@ -560,11 +560,11 @@ void init_ucs(Config *cfg, struct unicode_data *ucsdata)
|
|||||||
|
|
||||||
/* Last chance, if !unicode then try poorman links. */
|
/* Last chance, if !unicode then try poorman links. */
|
||||||
if (cfg->vtmode != VT_UNICODE) {
|
if (cfg->vtmode != VT_UNICODE) {
|
||||||
static char poorman_scoacs[] =
|
static const char poorman_scoacs[] =
|
||||||
"CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";
|
"CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";
|
||||||
static char poorman_latin1[] =
|
static const char poorman_latin1[] =
|
||||||
" !cL.Y|S\"Ca<--R~o+23'u|.,1o>///?AAAAAAACEEEEIIIIDNOOOOOxOUUUUYPBaaaaaaaceeeeiiiionooooo/ouuuuypy";
|
" !cL.Y|S\"Ca<--R~o+23'u|.,1o>///?AAAAAAACEEEEIIIIDNOOOOOxOUUUUYPBaaaaaaaceeeeiiiionooooo/ouuuuypy";
|
||||||
static char poorman_vt100[] = "*#****o~**+++++-----++++|****L.";
|
static const char poorman_vt100[] = "*#****o~**+++++-----++++|****L.";
|
||||||
|
|
||||||
for (i = 160; i < 256; i++)
|
for (i = 160; i < 256; i++)
|
||||||
if (!DIRECT_FONT(ucsdata->unitab_line[i]) &&
|
if (!DIRECT_FONT(ucsdata->unitab_line[i]) &&
|
||||||
@ -603,7 +603,7 @@ static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr)
|
|||||||
|
|
||||||
wchar_t xlat_uskbd2cyrllic(int ch)
|
wchar_t xlat_uskbd2cyrllic(int ch)
|
||||||
{
|
{
|
||||||
static wchar_t cyrtab[] = {
|
static const wchar_t cyrtab[] = {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7,
|
0, 1, 2, 3, 4, 5, 6, 7,
|
||||||
8, 9, 10, 11, 12, 13, 14, 15,
|
8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
16, 17, 18, 19, 20, 21, 22, 23,
|
16, 17, 18, 19, 20, 21, 22, 23,
|
||||||
@ -624,10 +624,10 @@ wchar_t xlat_uskbd2cyrllic(int ch)
|
|||||||
return cyrtab[ch&0x7F];
|
return cyrtab[ch&0x7F];
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_compose(int first, int second)
|
int check_compose_internal(int first, int second, int recurse)
|
||||||
{
|
{
|
||||||
|
|
||||||
static struct {
|
static const struct {
|
||||||
char first, second;
|
char first, second;
|
||||||
wchar_t composed;
|
wchar_t composed;
|
||||||
} composetbl[] = {
|
} composetbl[] = {
|
||||||
@ -961,7 +961,6 @@ int check_compose(int first, int second)
|
|||||||
0, 0, 0}
|
0, 0, 0}
|
||||||
}, *c;
|
}, *c;
|
||||||
|
|
||||||
static int recurse = 0;
|
|
||||||
int nc = -1;
|
int nc = -1;
|
||||||
|
|
||||||
for (c = composetbl; c->first; c++) {
|
for (c = composetbl; c->first; c++) {
|
||||||
@ -970,17 +969,20 @@ int check_compose(int first, int second)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (recurse == 0) {
|
if (recurse == 0) {
|
||||||
recurse = 1;
|
nc = check_compose_internal(second, first, 1);
|
||||||
nc = check_compose(second, first);
|
|
||||||
if (nc == -1)
|
if (nc == -1)
|
||||||
nc = check_compose(toupper(first), toupper(second));
|
nc = check_compose(toupper(first), toupper(second), 1);
|
||||||
if (nc == -1)
|
if (nc == -1)
|
||||||
nc = check_compose(toupper(second), toupper(first));
|
nc = check_compose(toupper(second), toupper(first), 1);
|
||||||
recurse = 0;
|
|
||||||
}
|
}
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int check_compose(int first, int second)
|
||||||
|
{
|
||||||
|
return check_compose_internal(first, second, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int decode_codepage(char *cp_name)
|
int decode_codepage(char *cp_name)
|
||||||
{
|
{
|
||||||
char *s, *d;
|
char *s, *d;
|
||||||
|
@ -80,7 +80,7 @@ static int send_raw_mouse;
|
|||||||
|
|
||||||
static char *app_name = "pterm";
|
static char *app_name = "pterm";
|
||||||
|
|
||||||
char *x_get_default(char *key)
|
char *x_get_default(const char *key)
|
||||||
{
|
{
|
||||||
return XGetDefault(GDK_DISPLAY(), app_name, key);
|
return XGetDefault(GDK_DISPLAY(), app_name, key);
|
||||||
}
|
}
|
||||||
@ -88,14 +88,14 @@ char *x_get_default(char *key)
|
|||||||
/*
|
/*
|
||||||
* Default settings that are specific to pterm.
|
* Default settings that are specific to pterm.
|
||||||
*/
|
*/
|
||||||
char *platform_default_s(char *name)
|
char *platform_default_s(const char *name)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "Font"))
|
if (!strcmp(name, "Font"))
|
||||||
return "fixed"; /* COE_NORMAL works badly in an xterm */
|
return "fixed"; /* COE_NORMAL works badly in an xterm */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_default_i(char *name, int def)
|
int platform_default_i(const char *name, int def)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "CloseOnExit"))
|
if (!strcmp(name, "CloseOnExit"))
|
||||||
return COE_ALWAYS; /* COE_NORMAL works badly in an xterm */
|
return COE_ALWAYS; /* COE_NORMAL works badly in an xterm */
|
||||||
|
@ -39,7 +39,7 @@ char *get_x_display(void *frontend);
|
|||||||
int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
|
int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
|
||||||
|
|
||||||
/* Things uxstore.c needs from pterm.c */
|
/* Things uxstore.c needs from pterm.c */
|
||||||
char *x_get_default(char *key);
|
char *x_get_default(const char *key);
|
||||||
|
|
||||||
/* Things uxstore.c provides to pterm.c */
|
/* Things uxstore.c provides to pterm.c */
|
||||||
void provide_xrm_string(char *string);
|
void provide_xrm_string(char *string);
|
||||||
|
@ -77,7 +77,7 @@ static Config cfg;
|
|||||||
/*
|
/*
|
||||||
* Default settings that are specific to pterm.
|
* Default settings that are specific to pterm.
|
||||||
*/
|
*/
|
||||||
char *platform_default_s(char *name)
|
char *platform_default_s(const char *name)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "X11Display"))
|
if (!strcmp(name, "X11Display"))
|
||||||
return getenv("DISPLAY");
|
return getenv("DISPLAY");
|
||||||
@ -125,7 +125,7 @@ char *platform_default_s(char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_default_i(char *name, int def)
|
int platform_default_i(const char *name, int def)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "TermWidth") ||
|
if (!strcmp(name, "TermWidth") ||
|
||||||
!strcmp(name, "TermHeight")) {
|
!strcmp(name, "TermHeight")) {
|
||||||
@ -136,7 +136,7 @@ int platform_default_i(char *name, int def)
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *x_get_default(char *key)
|
char *x_get_default(const char *key)
|
||||||
{
|
{
|
||||||
return NULL; /* this is a stub */
|
return NULL; /* this is a stub */
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,16 @@
|
|||||||
* file somewhere or other.
|
* file somewhere or other.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *open_settings_w(char *sessionname)
|
void *open_settings_w(const char *sessionname)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_setting_s(void *handle, char *key, char *value)
|
void write_setting_s(void *handle, const char *key, const char *value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_setting_i(void *handle, char *key, int value)
|
void write_setting_i(void *handle, const char *key, int value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ void close_settings_w(void *handle)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct xrm_string {
|
struct xrm_string {
|
||||||
char *key;
|
const char *key;
|
||||||
char *value;
|
const char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static tree234 *xrmtree = NULL;
|
static tree234 *xrmtree = NULL;
|
||||||
@ -63,7 +63,7 @@ int xrmcmp(void *av, void *bv)
|
|||||||
|
|
||||||
void provide_xrm_string(char *string)
|
void provide_xrm_string(char *string)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q, *key;
|
||||||
struct xrm_string *xrms, *ret;
|
struct xrm_string *xrms, *ret;
|
||||||
|
|
||||||
p = q = strchr(string, ':');
|
p = q = strchr(string, ':');
|
||||||
@ -76,9 +76,10 @@ void provide_xrm_string(char *string)
|
|||||||
while (p > string && p[-1] != '.' && p[-1] != '*')
|
while (p > string && p[-1] != '.' && p[-1] != '*')
|
||||||
p--;
|
p--;
|
||||||
xrms = smalloc(sizeof(struct xrm_string));
|
xrms = smalloc(sizeof(struct xrm_string));
|
||||||
xrms->key = smalloc(q-p);
|
key = smalloc(q-p);
|
||||||
memcpy(xrms->key, p, q-p);
|
memcpy(key, p, q-p);
|
||||||
xrms->key[q-p-1] = '\0';
|
key[q-p-1] = '\0';
|
||||||
|
xrms->key = key;
|
||||||
while (*q && isspace(*q))
|
while (*q && isspace(*q))
|
||||||
q++;
|
q++;
|
||||||
xrms->value = dupstr(q);
|
xrms->value = dupstr(q);
|
||||||
@ -94,7 +95,7 @@ void provide_xrm_string(char *string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_setting(char *key)
|
const char *get_setting(const char *key)
|
||||||
{
|
{
|
||||||
struct xrm_string tmp, *ret;
|
struct xrm_string tmp, *ret;
|
||||||
tmp.key = key;
|
tmp.key = key;
|
||||||
@ -106,15 +107,15 @@ char *get_setting(char *key)
|
|||||||
return x_get_default(key);
|
return x_get_default(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *open_settings_r(char *sessionname)
|
void *open_settings_r(const char *sessionname)
|
||||||
{
|
{
|
||||||
static int thing_to_return_an_arbitrary_non_null_pointer_to;
|
static int thing_to_return_an_arbitrary_non_null_pointer_to;
|
||||||
return &thing_to_return_an_arbitrary_non_null_pointer_to;
|
return &thing_to_return_an_arbitrary_non_null_pointer_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *read_setting_s(void *handle, char *key, char *buffer, int buflen)
|
char *read_setting_s(void *handle, const char *key, char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
char *val = get_setting(key);
|
const char *val = get_setting(key);
|
||||||
if (!val)
|
if (!val)
|
||||||
return NULL;
|
return NULL;
|
||||||
else {
|
else {
|
||||||
@ -124,9 +125,9 @@ char *read_setting_s(void *handle, char *key, char *buffer, int buflen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_setting_i(void *handle, char *key, int defvalue)
|
int read_setting_i(void *handle, const char *key, int defvalue)
|
||||||
{
|
{
|
||||||
char *val = get_setting(key);
|
const char *val = get_setting(key);
|
||||||
if (!val)
|
if (!val)
|
||||||
return defvalue;
|
return defvalue;
|
||||||
else
|
else
|
||||||
@ -137,7 +138,7 @@ void close_settings_r(void *handle)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void del_settings(char *sessionname)
|
void del_settings(const char *sessionname)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +207,8 @@ static char *fgetline(FILE *fp)
|
|||||||
*
|
*
|
||||||
* rsa@22:foovax.example.org 0x23,0x293487364395345345....2343
|
* rsa@22:foovax.example.org 0x23,0x293487364395345345....2343
|
||||||
*/
|
*/
|
||||||
int verify_host_key(char *hostname, int port, char *keytype, char *key)
|
int verify_host_key(const char *hostname, int port,
|
||||||
|
const char *keytype, const char *key)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char filename[FILENAME_MAX];
|
char filename[FILENAME_MAX];
|
||||||
@ -272,7 +274,8 @@ int verify_host_key(char *hostname, int port, char *keytype, char *key)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void store_host_key(char *hostname, int port, char *keytype, char *key)
|
void store_host_key(const char *hostname, int port,
|
||||||
|
const char *keytype, const char *key)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
|
|
||||||
char *platform_default_s(char *name)
|
char *platform_default_s(const char *name)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "Font"))
|
if (!strcmp(name, "Font"))
|
||||||
return "Courier New";
|
return "Courier New";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int platform_default_i(char *name, int def)
|
int platform_default_i(const char *name, int def)
|
||||||
{
|
{
|
||||||
if (!strcmp(name, "FontCharSet"))
|
if (!strcmp(name, "FontCharSet"))
|
||||||
return ANSI_CHARSET;
|
return ANSI_CHARSET;
|
||||||
|
8
winnet.c
8
winnet.c
@ -59,7 +59,7 @@
|
|||||||
((ntohl(addr.s_addr) & 0xFF000000L) == 0x7F000000L)
|
((ntohl(addr.s_addr) & 0xFF000000L) == 0x7F000000L)
|
||||||
|
|
||||||
struct Socket_tag {
|
struct Socket_tag {
|
||||||
struct socket_function_table *fn;
|
const struct socket_function_table *fn;
|
||||||
/* the above variable absolutely *must* be the first in this structure */
|
/* the above variable absolutely *must* be the first in this structure */
|
||||||
char *error;
|
char *error;
|
||||||
SOCKET s;
|
SOCKET s;
|
||||||
@ -471,7 +471,7 @@ extern char *do_select(SOCKET skt, int startup);
|
|||||||
|
|
||||||
Socket sk_register(void *sock, Plug plug)
|
Socket sk_register(void *sock, Plug plug)
|
||||||
{
|
{
|
||||||
static struct socket_function_table fn_table = {
|
static const struct socket_function_table fn_table = {
|
||||||
sk_tcp_plug,
|
sk_tcp_plug,
|
||||||
sk_tcp_close,
|
sk_tcp_close,
|
||||||
sk_tcp_write,
|
sk_tcp_write,
|
||||||
@ -528,7 +528,7 @@ Socket sk_register(void *sock, Plug plug)
|
|||||||
Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
|
Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
|
||||||
int nodelay, Plug plug)
|
int nodelay, Plug plug)
|
||||||
{
|
{
|
||||||
static struct socket_function_table fn_table = {
|
static const struct socket_function_table fn_table = {
|
||||||
sk_tcp_plug,
|
sk_tcp_plug,
|
||||||
sk_tcp_close,
|
sk_tcp_close,
|
||||||
sk_tcp_write,
|
sk_tcp_write,
|
||||||
@ -706,7 +706,7 @@ Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
|
|||||||
|
|
||||||
Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only)
|
Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only)
|
||||||
{
|
{
|
||||||
static struct socket_function_table fn_table = {
|
static const struct socket_function_table fn_table = {
|
||||||
sk_tcp_plug,
|
sk_tcp_plug,
|
||||||
sk_tcp_close,
|
sk_tcp_close,
|
||||||
sk_tcp_write,
|
sk_tcp_write,
|
||||||
|
30
winstore.c
30
winstore.c
@ -13,9 +13,9 @@ static const char *const puttystr = PUTTY_REG_POS "\\Sessions";
|
|||||||
|
|
||||||
static char seedpath[2 * MAX_PATH + 10] = "\0";
|
static char seedpath[2 * MAX_PATH + 10] = "\0";
|
||||||
|
|
||||||
static char hex[16] = "0123456789ABCDEF";
|
static const char hex[16] = "0123456789ABCDEF";
|
||||||
|
|
||||||
static void mungestr(char *in, char *out)
|
static void mungestr(const char *in, char *out)
|
||||||
{
|
{
|
||||||
int candot = 0;
|
int candot = 0;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ static void mungestr(char *in, char *out)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmungestr(char *in, char *out, int outlen)
|
static void unmungestr(const char *in, char *out, int outlen)
|
||||||
{
|
{
|
||||||
while (*in) {
|
while (*in) {
|
||||||
if (*in == '%' && in[1] && in[2]) {
|
if (*in == '%' && in[1] && in[2]) {
|
||||||
@ -60,7 +60,7 @@ static void unmungestr(char *in, char *out, int outlen)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *open_settings_w(char *sessionname)
|
void *open_settings_w(const char *sessionname)
|
||||||
{
|
{
|
||||||
HKEY subkey1, sesskey;
|
HKEY subkey1, sesskey;
|
||||||
int ret;
|
int ret;
|
||||||
@ -82,14 +82,14 @@ void *open_settings_w(char *sessionname)
|
|||||||
return (void *) sesskey;
|
return (void *) sesskey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_setting_s(void *handle, char *key, char *value)
|
void write_setting_s(void *handle, const char *key, const char *value)
|
||||||
{
|
{
|
||||||
if (handle)
|
if (handle)
|
||||||
RegSetValueEx((HKEY) handle, key, 0, REG_SZ, value,
|
RegSetValueEx((HKEY) handle, key, 0, REG_SZ, value,
|
||||||
1 + strlen(value));
|
1 + strlen(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_setting_i(void *handle, char *key, int value)
|
void write_setting_i(void *handle, const char *key, int value)
|
||||||
{
|
{
|
||||||
if (handle)
|
if (handle)
|
||||||
RegSetValueEx((HKEY) handle, key, 0, REG_DWORD,
|
RegSetValueEx((HKEY) handle, key, 0, REG_DWORD,
|
||||||
@ -101,7 +101,7 @@ void close_settings_w(void *handle)
|
|||||||
RegCloseKey((HKEY) handle);
|
RegCloseKey((HKEY) handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *open_settings_r(char *sessionname)
|
void *open_settings_r(const char *sessionname)
|
||||||
{
|
{
|
||||||
HKEY subkey1, sesskey;
|
HKEY subkey1, sesskey;
|
||||||
char *p;
|
char *p;
|
||||||
@ -123,7 +123,7 @@ void *open_settings_r(char *sessionname)
|
|||||||
return (void *) sesskey;
|
return (void *) sesskey;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *read_setting_s(void *handle, char *key, char *buffer, int buflen)
|
char *read_setting_s(void *handle, const char *key, char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
DWORD type, size;
|
DWORD type, size;
|
||||||
size = buflen;
|
size = buflen;
|
||||||
@ -136,7 +136,7 @@ char *read_setting_s(void *handle, char *key, char *buffer, int buflen)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_setting_i(void *handle, char *key, int defvalue)
|
int read_setting_i(void *handle, const char *key, int defvalue)
|
||||||
{
|
{
|
||||||
DWORD type, val, size;
|
DWORD type, val, size;
|
||||||
size = sizeof(val);
|
size = sizeof(val);
|
||||||
@ -155,7 +155,7 @@ void close_settings_r(void *handle)
|
|||||||
RegCloseKey((HKEY) handle);
|
RegCloseKey((HKEY) handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void del_settings(char *sessionname)
|
void del_settings(const char *sessionname)
|
||||||
{
|
{
|
||||||
HKEY subkey1;
|
HKEY subkey1;
|
||||||
char *p;
|
char *p;
|
||||||
@ -215,8 +215,8 @@ void enum_settings_finish(void *handle)
|
|||||||
sfree(e);
|
sfree(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hostkey_regname(char *buffer, char *hostname,
|
static void hostkey_regname(char *buffer, const char *hostname,
|
||||||
int port, char *keytype)
|
int port, const char *keytype)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
strcpy(buffer, keytype);
|
strcpy(buffer, keytype);
|
||||||
@ -226,7 +226,8 @@ static void hostkey_regname(char *buffer, char *hostname,
|
|||||||
mungestr(hostname, buffer + strlen(buffer));
|
mungestr(hostname, buffer + strlen(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
int verify_host_key(char *hostname, int port, char *keytype, char *key)
|
int verify_host_key(const char *hostname, int port,
|
||||||
|
const char *keytype, const char *key)
|
||||||
{
|
{
|
||||||
char *otherstr, *regname;
|
char *otherstr, *regname;
|
||||||
int len;
|
int len;
|
||||||
@ -331,7 +332,8 @@ int verify_host_key(char *hostname, int port, char *keytype, char *key)
|
|||||||
return 0; /* key matched OK in registry */
|
return 0; /* key matched OK in registry */
|
||||||
}
|
}
|
||||||
|
|
||||||
void store_host_key(char *hostname, int port, char *keytype, char *key)
|
void store_host_key(const char *hostname, int port,
|
||||||
|
const char *keytype, const char *key)
|
||||||
{
|
{
|
||||||
char *regname;
|
char *regname;
|
||||||
HKEY rkey;
|
HKEY rkey;
|
||||||
|
Loading…
Reference in New Issue
Block a user