[PATCH v2 2/4] user32/edit: Get rid of useless float cast

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


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

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

 dlls/user32/edit.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 96ecbec..f9d08a0 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -5103,9 +5103,10 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
 
         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)) {
                         result = DefWindowProcW(hwnd, msg, wParam, lParam);
@@ -5120,10 +5121,10 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
                         es->wheelDeltaRemainder = wheelDelta;
                     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);
                     }
                 }
-- 
1.9.1




More information about the wine-devel mailing list