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;
return;
}
-static void unmungestr(char *in, char *out, int outlen)
+static void unmungestr(const char *in, char *out, int outlen)
{
while (*in) {
if (*in == '%' && in[1] && in[2]) {
return;
}
-void *open_settings_w(char *sessionname)
+void *open_settings_w(const char *sessionname)
{
HKEY subkey1, sesskey;
int ret;
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)
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, const char *key, int value)
{
if (handle)
RegSetValueEx((HKEY) handle, key, 0, REG_DWORD,
RegCloseKey((HKEY) handle);
}
-void *open_settings_r(char *sessionname)
+void *open_settings_r(const char *sessionname)
{
HKEY subkey1, sesskey;
char *p;
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;
size = buflen;
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;
size = sizeof(val);
RegCloseKey((HKEY) handle);
}
-void del_settings(char *sessionname)
+void del_settings(const char *sessionname)
{
HKEY subkey1;
char *p;
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;
- } else
+ } else {
+ sfree(otherbuf);
return NULL;
-
+ }
}
void enum_settings_finish(void *handle)
sfree(e);
}
-static void hostkey_regname(char *buffer, char *hostname,
- int port, char *keytype)
+static void hostkey_regname(char *buffer, const char *hostname,
+ int port, const char *keytype)
{
int len;
strcpy(buffer, keytype);
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;
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;