[PATCH 1/5] Reduce variable scope

Nikolay Sivov nsivov at codeweavers.com
Fri Feb 25 02:34:55 CST 2011


---
 dlls/comctl32/comboex.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index 10d8b87..319696d 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -1741,7 +1741,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
 	    return DefSubclassProc(hwnd, uMsg, wParam, lParam);
 
 	case WM_KEYDOWN: {
-	    INT_PTR oldItem, selected, step = 1;
+	    INT_PTR oldItem, selected;
 	    CBE_ITEMDATA *item;
 
 	    switch ((INT)wParam)
@@ -1851,13 +1851,15 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
 		break;
 
 	    case VK_UP:
-		step = -1;
 	    case VK_DOWN:
-		/* by default, step is 1 */
+	    {
+		INT step = wParam == VK_DOWN ? 1 : -1;
+
 		oldItem = SendMessageW (infoPtr->hwndSelf, CB_GETCURSEL, 0, 0);
 		if (oldItem >= 0 && oldItem + step >= 0)
 		    SendMessageW (infoPtr->hwndSelf, CB_SETCURSEL, oldItem + step, 0);
 	    	return 0;
+	    }
 	    default:
 		return DefSubclassProc(hwnd, uMsg, wParam, lParam);
 	    }
-- 
1.5.6.5


--------------020603050908020106000305--



More information about the wine-patches mailing list