Eric Pouech : comdlg32: Removed useless casts to long.

Alexandre Julliard julliard at winehq.org
Tue Feb 1 15:21:35 CST 2022


Module: wine
Branch: master
Commit: 0c0f80a33357bc670a4d4096473fc92d3a1b57a8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0c0f80a33357bc670a4d4096473fc92d3a1b57a8

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Feb  1 14:05:51 2022 +0100

comdlg32: Removed useless casts to long.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comdlg32/colordlg.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/dlls/comdlg32/colordlg.c b/dlls/comdlg32/colordlg.c
index d5254736b24..1d459dd2d87 100644
--- a/dlls/comdlg32/colordlg.c
+++ b/dlls/comdlg32/colordlg.c
@@ -340,7 +340,7 @@ static BOOL CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *ver
  HWND hwnd;
  POINT point;
  RECT rect;
- long x,y;
+ int x,y;
 
  CONV_LPARAMTOPOINT(lParam, &point);
  ClientToScreen(hDlg, &point);
@@ -353,10 +353,8 @@ static BOOL CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *ver
  GetClientRect(hwnd, &rect);
  ScreenToClient(hwnd, &point);
 
- x = (long) point.x * MAXHORI;
- x /= rect.right;
- y = (long) (rect.bottom - point.y) * MAXVERT;
- y /= rect.bottom;
+ x = (point.x * MAXHORI) / rect.right;
+ y = ((rect.bottom - point.y) * MAXVERT) / rect.bottom;
 
  if (x < 0) x = 0;
  if (y < 0) y = 0;
@@ -398,7 +396,6 @@ static BOOL CC_MouseCheckResultWindow( HWND hDlg, LPARAM lParam )
 static int CC_CheckDigitsInEdit( HWND hwnd, int maxval )
 {
  int i, k, m, result, value;
- long editpos;
  char buffer[30];
 
  GetWindowTextA(hwnd, buffer, ARRAY_SIZE(buffer));
@@ -425,7 +422,7 @@ static int CC_CheckDigitsInEdit( HWND hwnd, int maxval )
  }
  if (result)
  {
-  editpos = SendMessageA(hwnd, EM_GETSEL, 0, 0);
+  LRESULT editpos = SendMessageA(hwnd, EM_GETSEL, 0, 0);
   SetWindowTextA(hwnd, buffer );
   SendMessageA(hwnd, EM_SETSEL, 0, editpos);
  }
@@ -465,7 +462,7 @@ static void CC_PaintSelectedColor(const CCPRIV *infoPtr)
 static void CC_PaintTriangle(CCPRIV *infoPtr)
 {
  HDC hDC;
- long temp;
+ int temp;
  int w = LOWORD(GetDialogBaseUnits()) / 2;
  POINT points[3];
  int height;
@@ -485,9 +482,9 @@ static void CC_PaintTriangle(CCPRIV *infoPtr)
    ScreenToClient(infoPtr->hwndSelf, points); /*  |<  |  */
    oben = points[0].y;                        /*  | \ |  */
                                               /*  |  \|  */
-   temp = (long)height * (long)infoPtr->l;
+   temp = height * infoPtr->l;
    points[0].x += 1;
-   points[0].y = oben + height - temp / (long)MAXVERT;
+   points[0].y = oben + height - temp / MAXVERT;
    points[1].y = points[0].y + w;
    points[2].y = points[0].y - w;
    points[2].x = points[1].x = points[0].x + w;
@@ -536,8 +533,8 @@ static void CC_PaintCross(CCPRIV *infoPtr)
    SelectClipRgn(hDC, region);
    DeleteObject(region);
 
-   point.x = ((long)rect.right * (long)x) / (long)MAXHORI;
-   point.y = rect.bottom - ((long)rect.bottom * (long)y) / (long)MAXVERT;
+   point.x = (rect.right * x) / MAXHORI;
+   point.y = rect.bottom - (rect.bottom * y) / MAXVERT;
    if ( infoPtr->oldcross.left != infoPtr->oldcross.right )
      BitBlt(hDC, infoPtr->oldcross.left, infoPtr->oldcross.top,
               infoPtr->oldcross.right - infoPtr->oldcross.left,




More information about the wine-cvs mailing list