From d1582b2e76cf777e4da4e047faa5cccab135f663 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 6 Mar 2003 12:41:39 +0000 Subject: [PATCH] As usual, gcc is better at warnings than MSVC, so here are some pedantic fiddlings with the new config-box stuff to cure some. git-svn-id: svn://svn.tartarus.org/sgt/putty@2909 cda61777-01e9-0310-a592-d414129be87e --- dialog.c | 5 +++-- putty.h | 6 ++++++ winctrls.c | 42 +++++++++++++++++++++++------------------- winstuff.h | 13 +++++++++++++ 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/dialog.c b/dialog.c index d9d6aafd..ff221c01 100644 --- a/dialog.c +++ b/dialog.c @@ -6,6 +6,7 @@ #include #include #include +#include #define DEFINE_INTORPTR_FNS @@ -293,8 +294,8 @@ union control *ctrl_radiobuttons(struct controlset *s, char *label, while (va_arg(ap, char *) != NULL) { i++; if (c->radio.shortcut == NO_SHORTCUT) - va_arg(ap, int); /* char promotes to int in arg lists */ - va_arg(ap, intorptr); + (void)va_arg(ap, int); /* char promotes to int in arg lists */ + (void)va_arg(ap, intorptr); } va_end(ap); c->radio.nbuttons = i; diff --git a/putty.h b/putty.h index 5c5b1c18..256c61b2 100644 --- a/putty.h +++ b/putty.h @@ -777,6 +777,12 @@ extern int cmdline_tooltype; void cmdline_error(char *, ...); /* + * Exports from config.c. + */ +void setup_config_box(struct controlbox *b, struct sesslist *sesslist, + int midsession, int protocol); + +/* * X11 auth mechanisms we know about. */ enum { diff --git a/winctrls.c b/winctrls.c index 4d055f46..4c49f72a 100644 --- a/winctrls.c +++ b/winctrls.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "winstuff.h" #include "misc.h" @@ -94,7 +95,8 @@ HWND doctl(struct ctlpos *cp, RECT r, SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOZORDER); } - } + } else + ctl = NULL; return ctl; } @@ -384,7 +386,6 @@ void checkbox(struct ctlpos *cp, char *text, int id) */ char *staticwrap(struct ctlpos *cp, HWND hwnd, char *text, int *lines) { - HFONT font = (HFONT) cp->font; HDC hdc = GetDC(hwnd); int lpx = GetDeviceCaps(hdc, LOGPIXELSX); int width, nlines, j; @@ -1040,7 +1041,7 @@ int handle_prefslist(struct prefslist *hdl, if ((int)wParam == hdl->listid) { DRAGLISTINFO *dlm = (DRAGLISTINFO *)lParam; - int dest; + int dest = 0; /* initialise to placate gcc */ switch (dlm->uNotification) { case DL_BEGINDRAG: hdl->dummyitem = @@ -1321,9 +1322,10 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, struct ctlpos pos; - char shortcuts[MAX_SHORTCUTS_PER_CTRL], nshortcuts; + char shortcuts[MAX_SHORTCUTS_PER_CTRL]; + int nshortcuts; char *escaped; - int i, base_id, num_ids, orig_tabdelay; + int i, base_id, num_ids; void *data; base_id = *id; @@ -1365,8 +1367,6 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, for (i = 0; i < s->ncontrols; i++) { union control *ctrl = s->ctrls[i]; - orig_tabdelay = FALSE; - /* * Generic processing that pertains to all control types. * At the end of this if statement, we'll have produced @@ -1423,7 +1423,6 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, assert(!ctrl->generic.tabdelay); ctrl = ctrl->tabdelay.ctrl; - orig_tabdelay = TRUE; for (i = 0; i < ntabdelays; i++) if (tabdelayed[i] == ctrl) @@ -1432,6 +1431,8 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, pos = tabdelays[i]; /* structure copy */ + colstart = colspan = -1; /* indicate this was tab-delayed */ + } else { /* * If it wasn't one of those, it's a genuine control; @@ -1638,6 +1639,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, break; default: assert(!"Can't happen"); + num_ids = 0; /* placate gcc */ break; } @@ -1659,7 +1661,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, base_id += num_ids; } - if (!orig_tabdelay) { + if (colstart >= 0) { /* * Update the ypos in all columns crossed by this * control. @@ -1728,6 +1730,7 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, /* * Look up the control ID in our data. */ + c = NULL; for (i = 0; i < dp->nctrltrees; i++) { c = winctrl_findbyid(dp->controltrees[i], LOWORD(wParam)); if (c) @@ -1823,8 +1826,8 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, * checked before generating an event. */ if (msg == WM_COMMAND && - HIWORD(wParam) == BN_CLICKED || - HIWORD(wParam) == BN_DOUBLECLICKED && + (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) && IsDlgButtonChecked(dp->hwnd, LOWORD(wParam))) { ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE); } @@ -2014,6 +2017,7 @@ int winctrl_context_help(struct dlgparam *dp, HWND hwnd, int id) /* * Look up the control ID in our data. */ + c = NULL; for (i = 0; i < dp->nctrltrees; i++) { c = winctrl_findbyid(dp->controltrees[i], id); if (c) @@ -2117,8 +2121,8 @@ void dlg_listbox_clear(union control *ctrl, void *dlg) int msg; assert(c && (c->ctrl->generic.type == CTRL_LISTBOX || - c->ctrl->generic.type == CTRL_EDITBOX && - c->ctrl->editbox.has_list)); + (c->ctrl->generic.type == CTRL_EDITBOX && + c->ctrl->editbox.has_list))); msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ? LB_RESETCONTENT : CB_RESETCONTENT); SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, 0); @@ -2131,8 +2135,8 @@ void dlg_listbox_del(union control *ctrl, void *dlg, int index) int msg; assert(c && (c->ctrl->generic.type == CTRL_LISTBOX || - c->ctrl->generic.type == CTRL_EDITBOX && - c->ctrl->editbox.has_list)); + (c->ctrl->generic.type == CTRL_EDITBOX && + c->ctrl->editbox.has_list))); msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ? LB_DELETESTRING : CB_DELETESTRING); SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0); @@ -2145,8 +2149,8 @@ void dlg_listbox_add(union control *ctrl, void *dlg, char const *text) int msg; assert(c && (c->ctrl->generic.type == CTRL_LISTBOX || - c->ctrl->generic.type == CTRL_EDITBOX && - c->ctrl->editbox.has_list)); + (c->ctrl->generic.type == CTRL_EDITBOX && + c->ctrl->editbox.has_list))); msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ? LB_ADDSTRING : CB_ADDSTRING); SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, (LPARAM)text); @@ -2167,8 +2171,8 @@ void dlg_listbox_addwithindex(union control *ctrl, void *dlg, int msg, msg2, index; assert(c && (c->ctrl->generic.type == CTRL_LISTBOX || - c->ctrl->generic.type == CTRL_EDITBOX && - c->ctrl->editbox.has_list)); + (c->ctrl->generic.type == CTRL_EDITBOX && + c->ctrl->editbox.has_list))); msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ? LB_ADDSTRING : CB_ADDSTRING); msg2 = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ? diff --git a/winstuff.h b/winstuff.h index 21d7aa89..411fe171 100644 --- a/winstuff.h +++ b/winstuff.h @@ -266,6 +266,9 @@ struct winctrl { struct winctrls { tree234 *byctrl, *byid; }; +struct controlset; +struct controlbox; + void winctrl_init(struct winctrls *); void winctrl_cleanup(struct winctrls *); void winctrl_add(struct winctrls *, struct winctrl *); @@ -277,6 +280,14 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, struct ctlpos *cp, struct controlset *s, int *id); int winctrl_handle_command(struct dlgparam *dp, UINT msg, WPARAM wParam, LPARAM lParam); +void winctrl_rem_shortcuts(struct dlgparam *dp, struct winctrl *c); +int winctrl_context_help(struct dlgparam *dp, HWND hwnd, int id); + +/* + * Exports from wincfg.c. + */ +void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, + int midsession); /* * Exports from windlg.c. @@ -287,6 +298,8 @@ int do_reconfig(HWND); void showeventlog(HWND); void showabout(HWND); void force_normal(HWND hwnd); +void modal_about_box(HWND hwnd); +void show_help(HWND hwnd); /* * Exports from sizetip.c. -- 2.11.0