mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Placate gcc's `-Wall' warnings.
[originally from svn r1121]
This commit is contained in:
parent
93e27a40ae
commit
fb473cc16c
27
pageant.c
27
pageant.c
@ -294,8 +294,8 @@ static void keylist_update(void)
|
||||
static void add_keyfile(char *filename)
|
||||
{
|
||||
char passphrase[PASSPHRASE_MAXLEN];
|
||||
struct RSAKey *rkey;
|
||||
struct ssh2_userkey *skey;
|
||||
struct RSAKey *rkey = NULL;
|
||||
struct ssh2_userkey *skey = NULL;
|
||||
int needs_pass;
|
||||
int ret;
|
||||
int attempts;
|
||||
@ -358,6 +358,7 @@ static void add_keyfile(char *filename)
|
||||
if (ver == 1) {
|
||||
if (already_running) {
|
||||
unsigned char *request, *response;
|
||||
void *vresponse;
|
||||
int reqlen, clen, resplen;
|
||||
|
||||
clen = strlen(rkey->comment);
|
||||
@ -391,7 +392,8 @@ static void add_keyfile(char *filename)
|
||||
reqlen += 4 + clen;
|
||||
PUT_32BIT(request, reqlen - 4);
|
||||
|
||||
agent_query(request, reqlen, &response, &resplen);
|
||||
agent_query(request, reqlen, &vresponse, &resplen);
|
||||
response = vresponse;
|
||||
if (resplen < 5 || response[4] != SSH_AGENT_SUCCESS)
|
||||
MessageBox(NULL, "The already running Pageant "
|
||||
"refused to add the key.", APPNAME,
|
||||
@ -403,6 +405,7 @@ static void add_keyfile(char *filename)
|
||||
} else {
|
||||
if (already_running) {
|
||||
unsigned char *request, *response;
|
||||
void *vresponse;
|
||||
int reqlen, alglen, clen, keybloblen, resplen;
|
||||
alglen = strlen(skey->alg->name);
|
||||
clen = strlen(skey->comment);
|
||||
@ -431,7 +434,8 @@ static void add_keyfile(char *filename)
|
||||
PUT_32BIT(request, reqlen - 4);
|
||||
reqlen += clen + 4;
|
||||
|
||||
agent_query(request, reqlen, &response, &resplen);
|
||||
agent_query(request, reqlen, &vresponse, &resplen);
|
||||
response = vresponse;
|
||||
if (resplen < 5 || response[4] != SSH_AGENT_SUCCESS)
|
||||
MessageBox(NULL, "The already running Pageant"
|
||||
"refused to add the key.", APPNAME,
|
||||
@ -938,11 +942,6 @@ static int cmpkeys_ssh2_asymm(void *av, void *bv)
|
||||
return c;
|
||||
}
|
||||
|
||||
static void error(char *s)
|
||||
{
|
||||
MessageBox(hwnd, s, APPNAME, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Prompt for a key file to add, and add it.
|
||||
*/
|
||||
@ -1135,9 +1134,12 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
COPYDATASTRUCT *cds;
|
||||
char *mapname;
|
||||
void *p;
|
||||
HANDLE filemap, proc;
|
||||
HANDLE filemap;
|
||||
#ifndef NO_SECURITY
|
||||
HANDLE proc;
|
||||
PSID mapowner, procowner;
|
||||
PSECURITY_DESCRIPTOR psd1 = NULL, psd2 = NULL;
|
||||
#endif
|
||||
int ret = 0;
|
||||
|
||||
cds = (COPYDATASTRUCT *) lParam;
|
||||
@ -1154,8 +1156,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
debug(("filemap is %p\n", filemap));
|
||||
#endif
|
||||
if (filemap != NULL && filemap != INVALID_HANDLE_VALUE) {
|
||||
int rc;
|
||||
#ifndef NO_SECURITY
|
||||
int rc;
|
||||
if (has_security) {
|
||||
if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE,
|
||||
GetCurrentProcessId())) ==
|
||||
@ -1234,7 +1236,7 @@ void spawn_cmd(char *cmdline, int show)
|
||||
NULL, NULL, show) <= (HINSTANCE) 32) {
|
||||
TCHAR sMsg[140];
|
||||
sprintf(sMsg, _T("Failed to run \"%.100s\", Error: %d"), cmdline,
|
||||
GetLastError());
|
||||
(int)GetLastError());
|
||||
MessageBox(NULL, sMsg, APPNAME, MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
@ -1367,7 +1369,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
char *p;
|
||||
int inquotes = 0;
|
||||
int ignorearg = 0;
|
||||
p = cmdline;
|
||||
while (*p) {
|
||||
while (*p && isspace(*p))
|
||||
|
@ -49,7 +49,7 @@ void agent_query(void *in, int inlen, void **out, int *outlen)
|
||||
debug(("hwnd is %p\n", hwnd));
|
||||
if (!hwnd)
|
||||
return;
|
||||
sprintf(mapname, "PageantRequest%08x", GetCurrentThreadId());
|
||||
sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
|
||||
filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
|
||||
0, AGENT_MAX_MSGLEN, mapname);
|
||||
if (!filemap)
|
||||
|
@ -77,6 +77,13 @@ static void progress_update(void *param, int phase, int iprogress)
|
||||
case 3:
|
||||
position = PHASE3START + progress * p->phase3mult;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Shouldn't happen, but having a default clause placates
|
||||
* gcc -Wall, which would otherwise complain that
|
||||
* `position' might be used uninitialised.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
SendMessage(p->progbar, PBM_SETPOS, position / DIVISOR, 0);
|
||||
@ -687,7 +694,7 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||
char *comment;
|
||||
struct PassphraseProcStruct pps;
|
||||
struct RSAKey newkey1;
|
||||
struct ssh2_userkey *newkey2;
|
||||
struct ssh2_userkey *newkey2 = NULL;
|
||||
|
||||
ver = keyfile_version(filename);
|
||||
if (ver == 0) {
|
||||
|
5
raw.c
5
raw.c
@ -15,11 +15,6 @@ static Socket s = NULL;
|
||||
|
||||
static void raw_size(void);
|
||||
|
||||
static int sb_opt, sb_len;
|
||||
static char *sb_buf = NULL;
|
||||
static int sb_size = 0;
|
||||
#define SB_DELTA 1024
|
||||
|
||||
static void c_write(char *buf, int len)
|
||||
{
|
||||
from_backend(0, buf, len);
|
||||
|
5
rlogin.c
5
rlogin.c
@ -16,11 +16,6 @@ static Socket s = NULL;
|
||||
|
||||
static void rlogin_size(void);
|
||||
|
||||
static int sb_opt, sb_len;
|
||||
static char *sb_buf = NULL;
|
||||
static int sb_size = 0;
|
||||
#define SB_DELTA 1024
|
||||
|
||||
static void c_write(char *buf, int len)
|
||||
{
|
||||
from_backend(0, buf, len);
|
||||
|
30
scp.c
30
scp.c
@ -71,8 +71,6 @@ static void sink(char *targ, char *src);
|
||||
static void tell_char(FILE * stream, char c);
|
||||
static void tell_str(FILE * stream, char *str);
|
||||
static void tell_user(FILE * stream, char *fmt, ...);
|
||||
static void send_char_msg(unsigned int msg_id, char c);
|
||||
static void send_str_msg(unsigned int msg_id, char *str);
|
||||
static void gui_update_stats(char *name, unsigned long size,
|
||||
int percentage, unsigned long elapsed);
|
||||
|
||||
@ -743,11 +741,9 @@ static void source(char *src)
|
||||
if (response())
|
||||
return;
|
||||
|
||||
if (statistics) {
|
||||
stat_bytes = 0;
|
||||
stat_starttime = time(NULL);
|
||||
stat_lasttime = 0;
|
||||
}
|
||||
stat_bytes = 0;
|
||||
stat_starttime = time(NULL);
|
||||
stat_lasttime = 0;
|
||||
|
||||
for (i = 0; i < size; i += 4096) {
|
||||
char transbuf[4096];
|
||||
@ -938,17 +934,15 @@ static void sink(char *targ, char *src)
|
||||
|
||||
back->send("", 1);
|
||||
|
||||
if (statistics) {
|
||||
stat_bytes = 0;
|
||||
stat_starttime = time(NULL);
|
||||
stat_lasttime = 0;
|
||||
if ((stat_name = strrchr(namebuf, '/')) == NULL)
|
||||
stat_name = namebuf;
|
||||
else
|
||||
stat_name++;
|
||||
if (strrchr(stat_name, '\\') != NULL)
|
||||
stat_name = strrchr(stat_name, '\\') + 1;
|
||||
}
|
||||
stat_bytes = 0;
|
||||
stat_starttime = time(NULL);
|
||||
stat_lasttime = 0;
|
||||
if ((stat_name = strrchr(namebuf, '/')) == NULL)
|
||||
stat_name = namebuf;
|
||||
else
|
||||
stat_name++;
|
||||
if (strrchr(stat_name, '\\') != NULL)
|
||||
stat_name = strrchr(stat_name, '\\') + 1;
|
||||
|
||||
for (i = 0; i < size; i += 4096) {
|
||||
char transbuf[4096];
|
||||
|
@ -271,7 +271,8 @@ void load_settings(char *section, int do_host, Config * cfg)
|
||||
gppi(sesskey, "SunkenEdge", 0, &cfg->sunken_edge);
|
||||
gppi(sesskey, "CurType", 0, &cfg->cursor_type);
|
||||
gppi(sesskey, "BlinkCur", 0, &cfg->blink_cur);
|
||||
gppi(sesskey, "Beep", 1, &cfg->beep);
|
||||
/* pedantic compiler tells me I can't use &cfg->beep as an int * :-) */
|
||||
gppi(sesskey, "Beep", 1, &i); cfg->beep = i;
|
||||
gpps(sesskey, "BellWaveFile", "", cfg->bell_wavefile,
|
||||
sizeof(cfg->bell_wavefile));
|
||||
gppi(sesskey, "BellOverload", 1, &cfg->bellovl);
|
||||
|
19
ssh.c
19
ssh.c
@ -1322,7 +1322,7 @@ static void ssh_detect_bugs(char *vstring)
|
||||
|
||||
static int do_ssh_init(unsigned char c)
|
||||
{
|
||||
static char vslen;
|
||||
static int vslen;
|
||||
static char version[10];
|
||||
static char *vstring;
|
||||
static int vstrsize;
|
||||
@ -1574,15 +1574,16 @@ static char *connect_to_host(char *host, int port, char **realhost)
|
||||
*/
|
||||
static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
|
||||
{
|
||||
int i, j, len;
|
||||
unsigned char *rsabuf, *keystr1, *keystr2;
|
||||
int i, j;
|
||||
static int len;
|
||||
static unsigned char *rsabuf, *keystr1, *keystr2;
|
||||
unsigned char cookie[8];
|
||||
struct RSAKey servkey, hostkey;
|
||||
struct MD5Context md5c;
|
||||
static unsigned long supported_ciphers_mask, supported_auths_mask;
|
||||
static int tried_publickey;
|
||||
static unsigned char session_id[16];
|
||||
int cipher_type;
|
||||
static int cipher_type;
|
||||
static char username[100];
|
||||
|
||||
crBegin;
|
||||
@ -1884,6 +1885,7 @@ static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
|
||||
ssh1_read_bignum(pktin.body, &challenge);
|
||||
{
|
||||
char *agentreq, *q, *ret;
|
||||
void *vret;
|
||||
int len, retlen;
|
||||
len = 1 + 4; /* message type, bit count */
|
||||
len += ssh1_bignum_length(key.exponent);
|
||||
@ -1903,7 +1905,8 @@ static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
|
||||
memcpy(q, session_id, 16);
|
||||
q += 16;
|
||||
PUT_32BIT(q, 1); /* response format */
|
||||
agent_query(agentreq, len + 4, &ret, &retlen);
|
||||
agent_query(agentreq, len + 4, &vret, &retlen);
|
||||
ret = vret;
|
||||
sfree(agentreq);
|
||||
if (ret) {
|
||||
if (ret[4] == SSH1_AGENT_RSA_RESPONSE) {
|
||||
@ -3085,8 +3088,6 @@ static void ssh2_try_send(struct ssh_channel *c)
|
||||
*/
|
||||
static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
||||
{
|
||||
static unsigned long remote_winsize;
|
||||
static unsigned long remote_maxpkt;
|
||||
static enum {
|
||||
AUTH_INVALID, AUTH_PUBLICKEY_AGENT, AUTH_PUBLICKEY_FILE,
|
||||
AUTH_PASSWORD
|
||||
@ -3366,6 +3367,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
||||
static int pklen, alglen, commentlen;
|
||||
static int siglen, retlen, len;
|
||||
static char *q, *agentreq, *ret;
|
||||
void *vret;
|
||||
|
||||
{
|
||||
char buf[64];
|
||||
@ -3444,7 +3446,8 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
||||
q += pktout.length - 5;
|
||||
/* And finally the (zero) flags word. */
|
||||
PUT_32BIT(q, 0);
|
||||
agent_query(agentreq, len + 4, &ret, &retlen);
|
||||
agent_query(agentreq, len + 4, &vret, &retlen);
|
||||
ret = vret;
|
||||
sfree(agentreq);
|
||||
if (ret) {
|
||||
if (ret[4] == SSH2_AGENT_SIGN_RESPONSE) {
|
||||
|
3
sshdh.c
3
sshdh.c
@ -34,7 +34,6 @@ static unsigned char G[] = { 2 };
|
||||
* Variables.
|
||||
*/
|
||||
static Bignum x, e, p, q, qmask, g;
|
||||
static int need_to_free_pg;
|
||||
|
||||
/*
|
||||
* Common DH initialisation.
|
||||
@ -116,7 +115,7 @@ Bignum dh_create_e(int nbits)
|
||||
} else {
|
||||
int b, nb;
|
||||
x = bn_power_2(nbits);
|
||||
nb = 0;
|
||||
b = nb = 0;
|
||||
for (i = 0; i < nbits; i++) {
|
||||
if (nb == 0) {
|
||||
nb = 8;
|
||||
|
10
sshzlib.c
10
sshzlib.c
@ -207,6 +207,7 @@ static void lz77_compress(struct LZ77Context *ctx,
|
||||
st->npending -= i;
|
||||
|
||||
defermatch.len = 0;
|
||||
deferchr = '\0';
|
||||
while (len > 0) {
|
||||
|
||||
/* Don't even look for a match, if we're not compressing. */
|
||||
@ -519,7 +520,8 @@ static void zlib_match(struct LZ77Context *ectx, int distance, int len)
|
||||
*/
|
||||
i = -1;
|
||||
j = sizeof(lencodes) / sizeof(*lencodes);
|
||||
while (j - i >= 2) {
|
||||
while (1) {
|
||||
assert(j - i >= 2);
|
||||
k = (j + i) / 2;
|
||||
if (thislen < lencodes[k].min)
|
||||
j = k;
|
||||
@ -554,7 +556,8 @@ static void zlib_match(struct LZ77Context *ectx, int distance, int len)
|
||||
*/
|
||||
i = -1;
|
||||
j = sizeof(distcodes) / sizeof(*distcodes);
|
||||
while (j - i >= 2) {
|
||||
while (1) {
|
||||
assert(j - i >= 2);
|
||||
k = (j + i) / 2;
|
||||
if (distance < distcodes[k].min)
|
||||
j = k;
|
||||
@ -656,7 +659,8 @@ int zlib_compress_block(unsigned char *block, int len,
|
||||
out->firstblock = 0;
|
||||
|
||||
in_block = FALSE;
|
||||
}
|
||||
} else
|
||||
in_block = TRUE;
|
||||
|
||||
if (out->comp_disabled) {
|
||||
if (in_block)
|
||||
|
15
terminal.c
15
terminal.c
@ -358,9 +358,9 @@ void term_init(void)
|
||||
*/
|
||||
void term_size(int newrows, int newcols, int newsavelines)
|
||||
{
|
||||
tree234 *newsb, *newscreen, *newalt;
|
||||
unsigned long *newdisp, *oldline, *line;
|
||||
int i, j, ccols;
|
||||
tree234 *newalt;
|
||||
unsigned long *newdisp, *line;
|
||||
int i, j;
|
||||
int sblen;
|
||||
int save_alt_which = alt_which;
|
||||
|
||||
@ -1444,7 +1444,7 @@ void term_out(void)
|
||||
case ANSI('5', '#'):
|
||||
nlattr = LATTR_NORM;
|
||||
break;
|
||||
case ANSI('6', '#'):
|
||||
default: /* spiritually case ANSI('6', '#'): */
|
||||
nlattr = LATTR_WIDE;
|
||||
break;
|
||||
}
|
||||
@ -2064,8 +2064,10 @@ void term_out(void)
|
||||
val = c - 'A' + 10;
|
||||
else if (c >= 'a' && c <= 'a' + max - 10)
|
||||
val = c - 'a' + 10;
|
||||
else
|
||||
else {
|
||||
termstate = TOPLEVEL;
|
||||
break;
|
||||
}
|
||||
osc_string[osc_strlen++] = val;
|
||||
if (osc_strlen >= 7) {
|
||||
palette_set(osc_string[0],
|
||||
@ -2359,6 +2361,7 @@ void term_out(void)
|
||||
ATTR_BLINK)));
|
||||
break;
|
||||
#endif
|
||||
default: break; /* placate gcc warning about enum use */
|
||||
}
|
||||
if (selstate != NO_SELECTION) {
|
||||
pos cursplus = curs;
|
||||
@ -2997,6 +3000,7 @@ void term_mouse(Mouse_Button b, Mouse_Action a, int x, int y,
|
||||
case MBT_WHEEL_DOWN:
|
||||
encstate = 0x61;
|
||||
break;
|
||||
default: break; /* placate gcc warning about enum use */
|
||||
}
|
||||
switch (a) {
|
||||
case MA_DRAG:
|
||||
@ -3013,6 +3017,7 @@ void term_mouse(Mouse_Button b, Mouse_Action a, int x, int y,
|
||||
return;
|
||||
is_down = b;
|
||||
break;
|
||||
default: break; /* placate gcc warning about enum use */
|
||||
}
|
||||
if (shift)
|
||||
encstate += 0x04;
|
||||
|
@ -658,9 +658,10 @@ int decode_codepage(char *cp_name)
|
||||
|
||||
if (cp_name && *cp_name) {
|
||||
d = cp_name;
|
||||
if (strnicmp(d, "cp", 2) == 0)
|
||||
if (tolower(d[0]) == 'c' && tolower(d[1]) == 'p')
|
||||
d += 2;
|
||||
if (strnicmp(d, "ibm", 3) == 0)
|
||||
if (tolower(d[0]) == 'i' && tolower(d[1]) == 'b'
|
||||
&& tolower(d[1]) == 'm')
|
||||
d += 3;
|
||||
for (s = d; *s >= '0' && *s <= '9'; s++);
|
||||
if (*s == 0 && s != d)
|
||||
|
7
window.c
7
window.c
@ -1142,6 +1142,7 @@ Mouse_Button translate_button(Mouse_Button button)
|
||||
return cfg.mouse_is_xterm ? MBT_PASTE : MBT_EXTEND;
|
||||
if (button == MBT_RIGHT)
|
||||
return cfg.mouse_is_xterm ? MBT_EXTEND : MBT_PASTE;
|
||||
return 0; /* shouldn't happen */
|
||||
}
|
||||
|
||||
static void show_mouseptr(int show)
|
||||
@ -1557,6 +1558,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
button = MBT_RIGHT;
|
||||
press = 0;
|
||||
break;
|
||||
default:
|
||||
button = press = 0; /* shouldn't happen */
|
||||
}
|
||||
show_mouseptr(1);
|
||||
if (press) {
|
||||
@ -3173,7 +3176,7 @@ void get_clip(wchar_t ** p, int *len)
|
||||
clipdata = NULL;
|
||||
return;
|
||||
} else if (OpenClipboard(NULL)) {
|
||||
if (clipdata = GetClipboardData(CF_UNICODETEXT)) {
|
||||
if ((clipdata = GetClipboardData(CF_UNICODETEXT))) {
|
||||
CloseClipboard();
|
||||
*p = GlobalLock(clipdata);
|
||||
if (*p) {
|
||||
@ -3181,7 +3184,7 @@ void get_clip(wchar_t ** p, int *len)
|
||||
*len = p2 - *p;
|
||||
return;
|
||||
}
|
||||
} else if (clipdata = GetClipboardData(CF_TEXT)) {
|
||||
} else if ( (clipdata = GetClipboardData(CF_TEXT)) ) {
|
||||
char *s;
|
||||
int i;
|
||||
CloseClipboard();
|
||||
|
10
winnet.c
10
winnet.c
@ -251,7 +251,7 @@ SockAddr sk_namelookup(char *host, char **canonicalname)
|
||||
*/
|
||||
if (ret->family == 0) {
|
||||
/*debug(("Resolving \"%s\" with gethostbyname() (IPv4 only)...\n", host)); */
|
||||
if (h = gethostbyname(host))
|
||||
if ( (h = gethostbyname(host)) )
|
||||
ret->family = AF_INET;
|
||||
}
|
||||
}
|
||||
@ -363,10 +363,10 @@ static void sk_tcp_flush(Socket s)
|
||||
*/
|
||||
}
|
||||
|
||||
void sk_tcp_close(Socket s);
|
||||
void sk_tcp_write(Socket s, char *data, int len);
|
||||
void sk_tcp_write_oob(Socket s, char *data, int len);
|
||||
char *sk_tcp_socket_error(Socket s);
|
||||
static void sk_tcp_close(Socket s);
|
||||
static void sk_tcp_write(Socket s, char *data, int len);
|
||||
static void sk_tcp_write_oob(Socket s, char *data, int len);
|
||||
static char *sk_tcp_socket_error(Socket s);
|
||||
|
||||
Socket sk_new(SockAddr addr, int port, int privport, int oobinline,
|
||||
Plug plug)
|
||||
|
Loading…
Reference in New Issue
Block a user