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

Gabriel Iv─âncescu gabrielopcode at gmail.com
Wed Aug 22 15:46:32 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/edit.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
index 10ff5fb..4e47647 100644
--- a/dlls/comctl32/edit.c
+++ b/dlls/comctl32/edit.c
@@ -4911,9 +4911,10 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
 
     case WM_MOUSEWHEEL:
     {
-        int wheelDelta;
-        UINT pulScrollLines = 3;
-        SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+        INT wheelDelta, pulScrollLines;
+        UINT tmp = 3;
+        SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+        pulScrollLines = tmp;
 
         if (wParam & (MK_SHIFT | MK_CONTROL))
         {
@@ -4931,10 +4932,10 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
 
         if (es->wheelDeltaRemainder && pulScrollLines)
         {
-            int cLineScroll;
-            pulScrollLines = (int) min((UINT) es->line_count, pulScrollLines);
-            cLineScroll = pulScrollLines * (float)es->wheelDeltaRemainder / WHEEL_DELTA;
-            es->wheelDeltaRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+            INT cLineScroll;
+            pulScrollLines = min((UINT)es->line_count, pulScrollLines);
+            cLineScroll = (pulScrollLines * es->wheelDeltaRemainder) / WHEEL_DELTA;
+            es->wheelDeltaRemainder -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
             result = EDIT_EM_LineScroll(es, 0, -cLineScroll);
         }
         break;
-- 
1.9.1




More information about the wine-devel mailing list