X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinpgnt.c;h=7bdf6378f956f760b4a4a3d48207c6812536030f;hb=5471539a6738484b48fb938c88dce547a3e4b299;hp=70f8309eb174307b7995063cb7012ded6ff2bb15;hpb=8682246d33f21e369a3e5b38fa2fdec58b1e4425;p=PuTTY.git diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 70f8309e..7bdf6378 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -70,7 +70,7 @@ static int initial_menuitems_count; /* * Print a modal (Really Bad) message box and perform a fatal exit. */ -void modalfatalbox(char *fmt, ...) +void modalfatalbox(const char *fmt, ...) { va_list ap; char *buf; @@ -120,7 +120,7 @@ struct PassphraseProcStruct { /* * Dialog-box function for the Licence box. */ -static int CALLBACK LicenceProc(HWND hwnd, UINT msg, +static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -144,7 +144,7 @@ static int CALLBACK LicenceProc(HWND hwnd, UINT msg, /* * Dialog-box function for the About box. */ -static int CALLBACK AboutProc(HWND hwnd, UINT msg, +static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -179,7 +179,7 @@ static HWND passphrase_box; /* * Dialog-box function for the passphrase box. */ -static int CALLBACK PassphraseProc(HWND hwnd, UINT msg, +static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static char **passphrase = NULL; @@ -291,7 +291,7 @@ void keylist_update(void) } for (i = 0; NULL != (skey = pageant_nth_ssh2_key(i)); i++) { char *listentry, *p; - int pos, fp_len; + int pos; /* * Replace spaces with tabs in the fingerprint prefix, for * nice alignment in the list box, until we encounter a : @@ -299,13 +299,12 @@ void keylist_update(void) */ p = ssh2_fingerprint(skey->alg, skey->data); listentry = dupprintf("%s\t%s", p, skey->comment); - fp_len = strlen(listentry); sfree(p); pos = 0; while (1) { pos += strcspn(listentry + pos, " :"); - if (listentry[pos] == ':') + if (listentry[pos] == ':' || !listentry[pos]) break; listentry[pos++] = '\t'; } @@ -369,7 +368,7 @@ static void win_add_keyfile(Filename *filename) * comment to use in the passphrase prompt. */ while (1) { - int dlgret; + INT_PTR dlgret; struct PassphraseProcStruct pps; pps.passphrase = &passphrase; @@ -378,11 +377,11 @@ static void win_add_keyfile(Filename *filename) NULL, PassphraseProc, (LPARAM) &pps); passphrase_box = NULL; - sfree(err); - if (!dlgret) goto done; /* operation cancelled */ + sfree(err); + assert(passphrase != NULL); ret = pageant_add_keyfile(filename, passphrase, &err); @@ -462,7 +461,7 @@ static void prompt_add_keyfile(void) /* * Dialog-box function for the key list box. */ -static int CALLBACK KeyListProc(HWND hwnd, UINT msg, +static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct RSAKey *rkey; @@ -594,7 +593,7 @@ static int CALLBACK KeyListProc(HWND hwnd, UINT msg, case WM_HELP: { int id = ((LPHELPINFO)lParam)->iCtrlId; - char *topic = NULL; + const char *topic = NULL; switch (id) { case 100: topic = WINHELP_CTX_pageant_keylist; break; case 101: topic = WINHELP_CTX_pageant_addkey; break; @@ -745,7 +744,6 @@ PSID get_default_sid(void) static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - int ret; static int menuinprogress; static UINT msgTaskbarCreated = 0; @@ -780,10 +778,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, menuinprogress = 1; update_sessions(); SetForegroundWindow(hwnd); - ret = TrackPopupMenu(systray_menu, - TPM_RIGHTALIGN | TPM_BOTTOMALIGN | - TPM_RIGHTBUTTON, - wParam, lParam, 0, hwnd, NULL); + TrackPopupMenu(systray_menu, + TPM_RIGHTALIGN | TPM_BOTTOMALIGN | + TPM_RIGHTBUTTON, + wParam, lParam, 0, hwnd, NULL); menuinprogress = 0; } break; @@ -791,7 +789,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, case WM_SYSCOMMAND: switch (wParam & ~0xF) { /* low 4 bits reserved to Windows */ case IDM_PUTTY: - if((int)ShellExecute(hwnd, NULL, putty_path, _T(""), _T(""), + if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, _T(""), _T(""), SW_SHOW) <= 32) { MessageBox(NULL, "Unable to execute PuTTY!", "Error", MB_OK | MB_ICONERROR); @@ -858,7 +856,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, GetMenuItemInfo(session_menu, wParam, FALSE, &mii); strcpy(param, "@"); strcat(param, mii.dwTypeData); - if((int)ShellExecute(hwnd, NULL, putty_path, param, + if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param, _T(""), SW_SHOW) <= 32) { MessageBox(NULL, "Unable to execute PuTTY!", "Error", MB_OK | MB_ICONERROR); @@ -989,7 +987,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, /* * Fork and Exec the command in cmdline. [DBW] */ -void spawn_cmd(char *cmdline, char * args, int show) +void spawn_cmd(const char *cmdline, const char *args, int show) { if (ShellExecute(NULL, _T("open"), cmdline, args, NULL, show) <= (HINSTANCE) 32) { @@ -1023,7 +1021,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { WNDCLASS wndclass; MSG msg; - char *command = NULL; + const char *command = NULL; int added_keys = 0; int argc, i; char **argv, **argstart; @@ -1193,7 +1191,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) session_menu = CreateMenu(); AppendMenu(systray_menu, MF_ENABLED, IDM_PUTTY, "&New Session"); AppendMenu(systray_menu, MF_POPUP | MF_ENABLED, - (UINT) session_menu, "&Saved Sessions"); + (UINT_PTR) session_menu, "&Saved Sessions"); AppendMenu(systray_menu, MF_SEPARATOR, 0, 0); } AppendMenu(systray_menu, MF_ENABLED, IDM_VIEWKEYS,