[PATCH v2 4/4] comctl32/treeview: Get rid of useless float cast

Gabriel Iv─âncescu gabrielopcode at gmail.com
Wed Aug 22 15:46:35 CDT 2018


Signed-off-by: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
---

v2: Use a signed variable to get rid of some casts.

 dlls/comctl32/treeview.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index bbef651..0f10292 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -5030,8 +5030,9 @@ scroll:
 static LRESULT
 TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-    short wheelDelta;
-    UINT pulScrollLines = 3;
+    SHORT wheelDelta;
+    INT pulScrollLines;
+    UINT tmp = 3;
 
     if (wParam & (MK_SHIFT | MK_CONTROL))
         return DefWindowProcW(infoPtr->hwnd, WM_MOUSEWHEEL, wParam, lParam);
@@ -5039,7 +5040,8 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
     if (infoPtr->firstVisible == NULL)
 	return TRUE;
 
-    SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &pulScrollLines, 0);
+    SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, &tmp, 0);
+    pulScrollLines = tmp;
 
     wheelDelta = GET_WHEEL_DELTA_WPARAM(wParam);
     /* if scrolling changes direction, ignore left overs */
@@ -5051,12 +5053,12 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
     if (infoPtr->wheelRemainder && pulScrollLines)
     {
-	int newDy;
-	int maxDy;
-	int lineScroll;
+	INT newDy;
+	INT maxDy;
+	INT lineScroll;
 
-	lineScroll = pulScrollLines * (float)infoPtr->wheelRemainder / WHEEL_DELTA;
-	infoPtr->wheelRemainder -= WHEEL_DELTA * lineScroll / (int)pulScrollLines;
+	lineScroll = (pulScrollLines * infoPtr->wheelRemainder) / WHEEL_DELTA;
+	infoPtr->wheelRemainder -= (lineScroll * WHEEL_DELTA) / pulScrollLines;
 
 	newDy = infoPtr->firstVisible->visibleOrder - lineScroll;
 	maxDy = infoPtr->maxVisibleOrder;
-- 
1.9.1




More information about the wine-devel mailing list