1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

A bunch of further warning fixes in the Windows code.

These ones are stylistic rather than potential bugs: mostly signedness
of char pointers in cases where they clearly aren't going to cause the
wrong thing to actually happen, and one thing in winsecur.c where
clang would have preferred an extra pair of braces around some
initialisers but it's legal with or without. But since some of clang's
warnings turn out to be quite useful, it seems worth silencing these
harmless ones so as to be able to see the rest.
This commit is contained in:
Simon Tatham 2017-02-03 19:37:59 +00:00
parent 7acc0a2aa1
commit 095072fa46
5 changed files with 20 additions and 19 deletions

View File

@ -3131,7 +3131,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
*/
term_seen_key_event(term);
if (ldisc)
ldisc_send(ldisc, buf, len, 1);
ldisc_send(ldisc, (char *)buf, len, 1);
show_mouseptr(0);
}
}
@ -3199,7 +3199,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
case WM_IME_CHAR:
if (wParam & 0xFF00) {
unsigned char buf[2];
char buf[2];
buf[1] = wParam;
buf[0] = wParam >> 8;
@ -4604,7 +4604,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
break;
}
if (xkey) {
p += format_arrow_key(p, term, xkey, shift_state);
p += format_arrow_key((char *)p, term, xkey, shift_state);
return p - output;
}
}

View File

@ -91,7 +91,7 @@ struct ssh_gss_liblist *ssh_gss_setup(Conf *conf)
if (ret == ERROR_SUCCESS && type == REG_SZ) {
buffer = snewn(size + 20, char);
ret = RegQueryValueEx(regkey, "InstallDir", NULL,
&type, buffer, &size);
&type, (LPBYTE)buffer, &size);
if (ret == ERROR_SUCCESS && type == REG_SZ) {
strcat(buffer, "\\bin\\gssapi32.dll");
module = LoadLibrary(buffer);

View File

@ -30,7 +30,7 @@ static int printer_add_enum(int param, DWORD level, char **buffer,
* we'll need for the output. Discard the return value since it
* will almost certainly be a failure due to lack of space.
*/
EnumPrinters(param, NULL, level, (*buffer)+offset, 512,
EnumPrinters(param, NULL, level, (LPBYTE)((*buffer)+offset), 512,
&needed, &nprinters);
if (needed < 512)
@ -38,7 +38,7 @@ static int printer_add_enum(int param, DWORD level, char **buffer,
*buffer = sresize(*buffer, offset+needed, char);
if (EnumPrinters(param, NULL, level, (*buffer)+offset,
if (EnumPrinters(param, NULL, level, (LPBYTE)((*buffer)+offset),
needed, &needed, &nprinters) == 0)
return FALSE;
@ -139,7 +139,7 @@ printer_job *printer_start_job(char *printer)
docinfo.pOutputFile = NULL;
docinfo.pDatatype = "RAW";
if (!StartDocPrinter(ret->hprinter, 1, (LPSTR)&docinfo))
if (!StartDocPrinter(ret->hprinter, 1, (LPBYTE)&docinfo))
goto error;
jobstarted = 1;

View File

@ -94,8 +94,8 @@ PSID get_user_sid(void)
int getsids(char **error)
{
SID_IDENTIFIER_AUTHORITY world_auth = SECURITY_WORLD_SID_AUTHORITY;
SID_IDENTIFIER_AUTHORITY nt_auth = SECURITY_NT_AUTHORITY;
SID_IDENTIFIER_AUTHORITY world_auth = { SECURITY_WORLD_SID_AUTHORITY };
SID_IDENTIFIER_AUTHORITY nt_auth = { SECURITY_NT_AUTHORITY };
int ret = FALSE;
*error = NULL;

View File

@ -110,7 +110,7 @@ void *open_settings_w(const char *sessionname, char **errmsg)
void write_setting_s(void *handle, const char *key, const char *value)
{
if (handle)
RegSetValueEx((HKEY) handle, key, 0, REG_SZ, value,
RegSetValueEx((HKEY) handle, key, 0, REG_SZ, (CONST BYTE *)value,
1 + strlen(value));
}
@ -168,7 +168,7 @@ char *read_setting_s(void *handle, const char *key)
allocsize = size+1; /* allow for an extra NUL if needed */
ret = snewn(allocsize, char);
if (RegQueryValueEx((HKEY) handle, key, 0,
&type, ret, &size) != ERROR_SUCCESS ||
&type, (BYTE *)ret, &size) != ERROR_SUCCESS ||
type != REG_SZ) {
sfree(ret);
return NULL;
@ -372,7 +372,8 @@ int verify_host_key(const char *hostname, int port,
readlen = len;
otherstr = snewn(len, char);
ret = RegQueryValueEx(rkey, regname, NULL, &type, otherstr, &readlen);
ret = RegQueryValueEx(rkey, regname, NULL,
&type, (BYTE *)otherstr, &readlen);
if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA &&
!strcmp(keytype, "rsa")) {
@ -385,7 +386,7 @@ int verify_host_key(const char *hostname, int port,
char *oldstyle = snewn(len + 10, char); /* safety margin */
readlen = len;
ret = RegQueryValueEx(rkey, justhost, NULL, &type,
oldstyle, &readlen);
(BYTE *)oldstyle, &readlen);
if (ret == ERROR_SUCCESS && type == REG_SZ) {
/*
@ -431,7 +432,7 @@ int verify_host_key(const char *hostname, int port,
* wrong, and hyper-cautiously do nothing.
*/
if (!strcmp(otherstr, key))
RegSetValueEx(rkey, regname, 0, REG_SZ, otherstr,
RegSetValueEx(rkey, regname, 0, REG_SZ, (BYTE *)otherstr,
strlen(otherstr) + 1);
}
@ -476,7 +477,7 @@ void store_host_key(const char *hostname, int port,
if (RegCreateKey(HKEY_CURRENT_USER, PUTTY_REG_POS "\\SshHostKeys",
&rkey) == ERROR_SUCCESS) {
RegSetValueEx(rkey, regname, 0, REG_SZ, key, strlen(key) + 1);
RegSetValueEx(rkey, regname, 0, REG_SZ, (BYTE *)key, strlen(key) + 1);
RegCloseKey(rkey);
} /* else key does not exist in registry */
@ -536,7 +537,7 @@ static HANDLE access_random_seed(int action)
if (RegOpenKey(HKEY_CURRENT_USER, PUTTY_REG_POS, &rkey) ==
ERROR_SUCCESS) {
int ret = RegQueryValueEx(rkey, "RandSeedFile",
0, &type, seedpath, &size);
0, &type, (BYTE *)seedpath, &size);
if (ret != ERROR_SUCCESS || type != REG_SZ)
seedpath[0] = '\0';
RegCloseKey(rkey);
@ -672,7 +673,7 @@ static int transform_jumplist_registry
value_length = 200;
old_value = snewn(value_length, char);
ret = RegQueryValueEx(pjumplist_key, reg_jumplist_value, NULL, &type,
old_value, &value_length);
(BYTE *)old_value, &value_length);
/* When the passed buffer is too small, ERROR_MORE_DATA is
* returned and the required size is returned in the length
* argument. */
@ -680,7 +681,7 @@ static int transform_jumplist_registry
sfree(old_value);
old_value = snewn(value_length, char);
ret = RegQueryValueEx(pjumplist_key, reg_jumplist_value, NULL, &type,
old_value, &value_length);
(BYTE *)old_value, &value_length);
}
if (ret == ERROR_FILE_NOT_FOUND) {
@ -754,7 +755,7 @@ static int transform_jumplist_registry
/* Save the new list to the registry. */
ret = RegSetValueEx(pjumplist_key, reg_jumplist_value, 0, REG_MULTI_SZ,
new_value, piterator_new - new_value);
(BYTE *)new_value, piterator_new - new_value);
sfree(old_value);
old_value = new_value;