~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix the gcc warnings in this module (since we now seem to be
[sgt/putty]
/
winstore.c
diff --git
a/winstore.c
b/winstore.c
index
651fbad
..
3199c1c
100644
(file)
--- a/
winstore.c
+++ b/
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 c
onst c
har hex[16] = "0123456789ABCDEF";
-static void mungestr(char *in, char *out)
+static void mungestr(c
onst c
har *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(c
onst c
har *in, char *out, int outlen)
{
while (*in) {
if (*in == '%' && in[1] && in[2]) {
{
while (*in) {
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(c
onst c
har *sessionname)
{
HKEY subkey1, sesskey;
int ret;
{
HKEY subkey1, sesskey;
int ret;
@@
-82,14
+82,14
@@
void *open_settings_w(char *sessionname)
return (void *) sesskey;
}
return (void *) sesskey;
}
-void write_setting_s(void *handle, c
har *key,
char *value)
+void write_setting_s(void *handle, c
onst char *key, const
char *value)
{
if (handle)
RegSetValueEx((HKEY) handle, key, 0, REG_SZ, value,
1 + strlen(value));
}
{
if (handle)
RegSetValueEx((HKEY) handle, key, 0, REG_SZ, value,
1 + strlen(value));
}
-void write_setting_i(void *handle, char *key, int value)
+void write_setting_i(void *handle, c
onst c
har *key, int value)
{
if (handle)
RegSetValueEx((HKEY) handle, key, 0, REG_DWORD,
{
if (handle)
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(c
onst c
har *sessionname)
{
HKEY subkey1, sesskey;
char *p;
{
HKEY subkey1, sesskey;
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, c
onst c
har *key, char *buffer, int buflen)
{
DWORD type, size;
size = buflen;
{
DWORD type, size;
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, c
onst c
har *key, int defvalue)
{
DWORD type, val, size;
size = sizeof(val);
{
DWORD type, val, size;
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(c
onst c
har *sessionname)
{
HKEY subkey1;
char *p;
{
HKEY subkey1;
char *p;
@@
-181,7
+181,7
@@
void *enum_settings_start(void)
struct enumsettings *ret;
HKEY key;
struct enumsettings *ret;
HKEY key;
- if (Reg
Create
Key(HKEY_CURRENT_USER, puttystr, &key) != ERROR_SUCCESS)
+ if (Reg
Open
Key(HKEY_CURRENT_USER, puttystr, &key) != ERROR_SUCCESS)
return NULL;
ret = smalloc(sizeof(*ret));
return NULL;
ret = smalloc(sizeof(*ret));
@@
-198,14
+198,14
@@
char *enum_settings_next(void *handle, char *buffer, int buflen)
struct enumsettings *e = (struct enumsettings *) handle;
char *otherbuf;
otherbuf = smalloc(3 * buflen);
struct enumsettings *e = (struct enumsettings *) handle;
char *otherbuf;
otherbuf = smalloc(3 * buflen);
- if (otherbuf && RegEnumKey(e->key, e->i++, otherbuf,
- 3 * buflen) == ERROR_SUCCESS) {
+ if (RegEnumKey(e->key, e->i++, otherbuf, 3 * buflen) == ERROR_SUCCESS) {
unmungestr(otherbuf, buffer, buflen);
sfree(otherbuf);
return buffer;
unmungestr(otherbuf, buffer, buflen);
sfree(otherbuf);
return buffer;
- } else
+ } else {
+ sfree(otherbuf);
return NULL;
return NULL;
-
+ }
}
void enum_settings_finish(void *handle)
}
void enum_settings_finish(void *handle)
@@
-215,8
+215,8
@@
void enum_settings_finish(void *handle)
sfree(e);
}
sfree(e);
}
-static void hostkey_regname(char *buffer, char *hostname,
- int port, char *keytype)
+static void hostkey_regname(char *buffer, c
onst c
har *hostname,
+ int port, c
onst c
har *keytype)
{
int len;
strcpy(buffer, keytype);
{
int len;
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;
int len;
{
char *otherstr, *regname;
int len;
@@
-246,8
+247,8
@@
int verify_host_key(char *hostname, int port, char *keytype, char *key)
hostkey_regname(regname, hostname, port, keytype);
hostkey_regname(regname, hostname, port, keytype);
- if (Reg
Create
Key(HKEY_CURRENT_USER, PUTTY_REG_POS "\\SshHostKeys",
-
&rkey) != ERROR_SUCCESS)
+ if (Reg
Open
Key(HKEY_CURRENT_USER, PUTTY_REG_POS "\\SshHostKeys",
+ &rkey) != ERROR_SUCCESS)
return 1; /* key does not exist in registry */
readlen = len;
return 1; /* key does not exist in registry */
readlen = 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;
HKEY rkey;
{
char *regname;
HKEY rkey;