[PATCH v3 05/10] shell32/autocomplete: Get rid of control and filled BOOLs and simplify the code
Huw Davies
huw at codeweavers.com
Mon Sep 10 03:45:05 CDT 2018
On Sat, Sep 08, 2018 at 02:50:51PM +0300, Gabriel Ivăncescu wrote:
> There's no need to have filled, since cpt can already provide the same
> information.
Looks good.
>
> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
> ---
> dlls/shell32/autocomplete.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
> index 93be8e3..3fed020 100644
> --- a/dlls/shell32/autocomplete.c
> +++ b/dlls/shell32/autocomplete.c
> @@ -138,7 +138,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
> HRESULT hr;
> WCHAR hwndText[255];
> RECT r;
> - BOOL control, filled, displayall = FALSE;
> + BOOL displayall = FALSE;
> int cpt, height, sel;
>
> if (!This->enabled) return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
> @@ -164,8 +164,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
> switch(wParam) {
> case VK_RETURN:
> /* If quickComplete is set and control is pressed, replace the string */
> - control = GetKeyState(VK_CONTROL) & 0x8000;
> - if (control && This->quickComplete) {
> + if (This->quickComplete && (GetKeyState(VK_CONTROL) & 0x8000))
> + {
> WCHAR *buf;
> size_t len = strlenW(hwndText);
> size_t sz = strlenW(This->quickComplete) + 1 + len;
> @@ -250,7 +250,6 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
> break;
>
> IEnumString_Reset(This->enumstr);
> - filled = FALSE;
> for(cpt = 0;;) {
> LPOLESTR strs = NULL;
> ULONG fetched;
> @@ -260,7 +259,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
> break;
>
> if (!strncmpiW(hwndText, strs, len)) {
> - if (!filled && (This->options & ACO_AUTOAPPEND)) {
> + if (cpt == 0 && (This->options & ACO_AUTOAPPEND)) {
> WCHAR buffW[255];
>
> strcpyW(buffW, hwndText);
> @@ -273,19 +272,17 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
> }
> }
>
> - if (This->options & ACO_AUTOSUGGEST) {
> + if (This->options & ACO_AUTOSUGGEST)
> SendMessageW(This->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs);
> - cpt++;
> - }
>
> - filled = TRUE;
> + cpt++;
> }
>
> CoTaskMemFree(strs);
> }
>
> if (This->options & ACO_AUTOSUGGEST) {
> - if (filled) {
> + if (cpt) {
> height = SendMessageW(This->hwndListBox, LB_GETITEMHEIGHT, 0, 0);
> SendMessageW(This->hwndListBox, LB_CARETOFF, 0, 0);
> GetWindowRect(hwnd, &r);
> --
> 1.9.1
>
>
>
More information about the wine-devel
mailing list