[PATCH v2 3/4] comctl32/listview: Get rid of useless float cast
Gabriel Ivăncescu
gabrielopcode at gmail.com
Wed Aug 22 15:46:34 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/listview.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 200bf93..b689680 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9893,7 +9893,8 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
{
- UINT pulScrollLines = 3;
+ INT pulScrollLines;
+ UINT tmp;
TRACE("(wheelDelta=%d)\n", wheelDelta);
@@ -9910,7 +9911,9 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
break;
case LV_VIEW_DETAILS:
- SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
+ tmp = 3;
+ SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &tmp, 0);
+ pulScrollLines = tmp;
/* if scrolling changes direction, ignore left overs */
if ((wheelDelta < 0 && infoPtr->cWheelRemainder < 0) ||
@@ -9920,10 +9923,10 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
infoPtr->cWheelRemainder = wheelDelta;
if (infoPtr->cWheelRemainder && pulScrollLines)
{
- int cLineScroll;
+ INT cLineScroll;
pulScrollLines = min((UINT)LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
- cLineScroll = pulScrollLines * (float)infoPtr->cWheelRemainder / WHEEL_DELTA;
- infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / (int)pulScrollLines;
+ cLineScroll = (pulScrollLines * infoPtr->cWheelRemainder) / WHEEL_DELTA;
+ infoPtr->cWheelRemainder -= (cLineScroll * WHEEL_DELTA) / pulScrollLines;
LISTVIEW_VScroll(infoPtr, SB_INTERNAL, -cLineScroll);
}
break;
--
1.9.1
More information about the wine-devel
mailing list