diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-22 13:11:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 07:54:51 +0100 |
commit | 9af8f190ed1bf3f76897ad0c078db16451d6fb69 (patch) | |
tree | 015089ee72a67eca7db999845cabb8104c8ce3aa /vcl/win | |
parent | 9602e63c818722c3910343b7af53917d031861c8 (diff) |
More loplugin:cstylecast on Windows
Automatic rewrite (of loplugin:cstylecast and loplugin:unnecessaryparen) after
cab0427cadddb3aaf1349c66f2fa13a4234ba4b2 "Enable loplugin:cstylecast for some
more cases" and a409d32e7f6fc09e041079d6dbc3c927497adfed "More
loplugin:cstylecast"
Change-Id: Ib3355159dd08333e1b7a8d091caf2069cdcc7862
Reviewed-on: https://gerrit.libreoffice.org/48317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/app/saldata.cxx | 2 | ||||
-rw-r--r-- | vcl/win/app/salinst.cxx | 14 | ||||
-rw-r--r-- | vcl/win/app/saltimer.cxx | 2 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.cxx | 134 | ||||
-rw-r--r-- | vcl/win/gdi/salbmp.cxx | 8 | ||||
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 12 | ||||
-rw-r--r-- | vcl/win/gdi/salgdi.cxx | 24 | ||||
-rw-r--r-- | vcl/win/gdi/salprn.cxx | 10 | ||||
-rw-r--r-- | vcl/win/gdi/salvd.cxx | 4 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 154 | ||||
-rw-r--r-- | vcl/win/window/salmenu.cxx | 2 | ||||
-rw-r--r-- | vcl/win/window/salobj.cxx | 26 |
12 files changed, 196 insertions, 196 deletions
diff --git a/vcl/win/app/saldata.cxx b/vcl/win/app/saldata.cxx index 0b45716a2980..c71954ea9ca8 100644 --- a/vcl/win/app/saldata.cxx +++ b/vcl/win/app/saldata.cxx @@ -62,7 +62,7 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ) c1 += 32; if ( (c2 >= 65) && (c2 <= 90) ) c2 += 32; - nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2)); + nRet = static_cast<sal_Int32>(c1)- static_cast<sal_Int32>(static_cast<unsigned char>(c2)); if ( nRet != 0 ) break; diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 5671361c987b..27f1aa73a57a 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -551,7 +551,7 @@ bool WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) if ( !IsMainThread() ) { bDidWork = SendMessageW( mhComWnd, SAL_MSG_THREADYIELD, - (WPARAM) false, (LPARAM) bHandleAllCurrentEvents ); + WPARAM(false), static_cast<LPARAM>(bHandleAllCurrentEvents) ); if ( !bDidWork && bWait ) { maWaitingYieldCond.reset(); @@ -594,7 +594,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, b switch ( nMsg ) { case SAL_MSG_THREADYIELD: - assert( !(bool)wParam ); + assert( !static_cast<bool>(wParam) ); nRet = static_cast<LRESULT>(ImplSalYield( false, static_cast<bool>( lParam ) )); break; @@ -883,7 +883,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType ) SalFrame* WinSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, SalFrameStyleFlags nSalFrameStyle ) { // to switch to Main-Thread - return reinterpret_cast<SalFrame*>((sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), reinterpret_cast<LPARAM>(pSystemParentData->hWnd) )); + return reinterpret_cast<SalFrame*>(static_cast<sal_IntPtr>(SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), reinterpret_cast<LPARAM>(pSystemParentData->hWnd) ))); } SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nSalFrameStyle ) @@ -894,7 +894,7 @@ SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nSa hWndParent = static_cast<WinSalFrame*>(pParent)->mhWnd; else hWndParent = nullptr; - return reinterpret_cast<SalFrame*>((sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), reinterpret_cast<LPARAM>(hWndParent) )); + return reinterpret_cast<SalFrame*>(static_cast<sal_IntPtr>(SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), reinterpret_cast<LPARAM>(hWndParent) ))); } void WinSalInstance::DestroyFrame( SalFrame* pFrame ) @@ -908,7 +908,7 @@ SalObject* WinSalInstance::CreateObject( SalFrame* pParent, bool /*bShow*/ ) { // to switch to Main-Thread - return reinterpret_cast<SalObject*>((sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEOBJECT, 0, reinterpret_cast<LPARAM>(static_cast<WinSalFrame*>(pParent)) )); + return reinterpret_cast<SalObject*>(static_cast<sal_IntPtr>(SendMessageW( mhComWnd, SAL_MSG_CREATEOBJECT, 0, reinterpret_cast<LPARAM>(static_cast<WinSalFrame*>(pParent)) ))); } void WinSalInstance::DestroyObject( SalObject* pObject ) @@ -1054,9 +1054,9 @@ OUString WinSalInstance::getOSVersion() VS_FIXEDFILEINFO *vinfo = static_cast<VS_FIXEDFILEINFO *>(pBlock); OUStringBuffer aVer; aVer.append("Windows "); - aVer.append((sal_Int32)HIWORD(vinfo->dwProductVersionMS)); + aVer.append(static_cast<sal_Int32>(HIWORD(vinfo->dwProductVersionMS))); aVer.append("."); - aVer.append((sal_Int32)LOWORD(vinfo->dwProductVersionMS)); + aVer.append(static_cast<sal_Int32>(LOWORD(vinfo->dwProductVersionMS))); return aVer.makeStringAndClear(); } } diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx index d23c7344ef31..c70189be4bba 100644 --- a/vcl/win/app/saltimer.cxx +++ b/vcl/win/app/saltimer.cxx @@ -105,7 +105,7 @@ void WinSalTimer::Start( sal_uLong nMS ) if ( pInst && !pInst->IsMainThread() ) { BOOL const ret = PostMessageW(pInst->mhComWnd, - SAL_MSG_STARTTIMER, 0, (LPARAM) tools::Time::GetSystemTicks() + nMS); + SAL_MSG_STARTTIMER, 0, static_cast<LPARAM>(tools::Time::GetSystemTicks()) + nMS); SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); } else diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 314d4a769d41..b34fa84d2f62 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -313,21 +313,21 @@ void WinSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcG (rPosAry.mnSrcHeight == rPosAry.mnDestHeight) ) { BitBlt( mrParent.getHDC(), - (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, - (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, + static_cast<int>(rPosAry.mnDestX), static_cast<int>(rPosAry.mnDestY), + static_cast<int>(rPosAry.mnDestWidth), static_cast<int>(rPosAry.mnDestHeight), hSrcDC, - (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, + static_cast<int>(rPosAry.mnSrcX), static_cast<int>(rPosAry.mnSrcY), nRop ); } else { int nOldStretchMode = SetStretchBltMode( mrParent.getHDC(), STRETCH_DELETESCANS ); StretchBlt( mrParent.getHDC(), - (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, - (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, + static_cast<int>(rPosAry.mnDestX), static_cast<int>(rPosAry.mnDestY), + static_cast<int>(rPosAry.mnDestWidth), static_cast<int>(rPosAry.mnDestHeight), hSrcDC, - (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, - (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight, + static_cast<int>(rPosAry.mnSrcX), static_cast<int>(rPosAry.mnSrcY), + static_cast<int>(rPosAry.mnSrcWidth), static_cast<int>(rPosAry.mnSrcHeight), nRop ); SetStretchBltMode( mrParent.getHDC(), nOldStretchMode ); } @@ -398,10 +398,10 @@ void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY, HWND hWnd; // restrict srcRect to this window (calc intersection) - aSrcRect.left = (int)nSrcX; - aSrcRect.top = (int)nSrcY; - aSrcRect.right = aSrcRect.left+(int)nSrcWidth; - aSrcRect.bottom = aSrcRect.top+(int)nSrcHeight; + aSrcRect.left = static_cast<int>(nSrcX); + aSrcRect.top = static_cast<int>(nSrcY); + aSrcRect.right = aSrcRect.left+static_cast<int>(nSrcWidth); + aSrcRect.bottom = aSrcRect.top+static_cast<int>(nSrcHeight); GetClientRect( mrParent.gethWnd(), &aClipRect ); if ( IntersectRect( &aSrcRect, &aSrcRect, &aClipRect ) ) { @@ -507,8 +507,8 @@ void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY, if ( (nRgnType != ERROR) && (nRgnType != NULLREGION) ) { // move the occluded parts to the destination pos - int nOffX = (int)(nDestX-nSrcX); - int nOffY = (int)(nDestY-nSrcY); + int nOffX = static_cast<int>(nDestX-nSrcX); + int nOffY = static_cast<int>(nDestY-nSrcY); OffsetRgn( hInvalidateRgn, nOffX-aPt.x, nOffY-aPt.y ); // by excluding hInvalidateRgn from the system's clip region @@ -525,10 +525,10 @@ void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY, } BitBlt( mrParent.getHDC(), - (int)nDestX, (int)nDestY, - (int)nSrcWidth, (int)nSrcHeight, + static_cast<int>(nDestX), static_cast<int>(nDestY), + static_cast<int>(nSrcWidth), static_cast<int>(nSrcHeight), mrParent.getHDC(), - (int)nSrcX, (int)nSrcY, + static_cast<int>(nSrcX), static_cast<int>(nSrcY), SRCCOPY ); if( bRestoreClipRgn ) @@ -597,10 +597,10 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS ); StretchDIBits( hDC, - (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, - (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, - (int)rPosAry.mnSrcX, (int)(pBI->bmiHeader.biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY), - (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight, + static_cast<int>(rPosAry.mnDestX), static_cast<int>(rPosAry.mnDestY), + static_cast<int>(rPosAry.mnDestWidth), static_cast<int>(rPosAry.mnDestHeight), + static_cast<int>(rPosAry.mnSrcX), static_cast<int>(pBI->bmiHeader.biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY), + static_cast<int>(rPosAry.mnSrcWidth), static_cast<int>(rPosAry.mnSrcHeight), pBits, pBI, DIB_RGB_COLORS, nDrawMode ); GlobalUnlock( hDrawDIB ); @@ -640,10 +640,10 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa (rPosAry.mnSrcHeight == rPosAry.mnDestHeight) ) { BitBlt( hDC, - (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, - (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, + static_cast<int>(rPosAry.mnDestX), static_cast<int>(rPosAry.mnDestY), + static_cast<int>(rPosAry.mnDestWidth), static_cast<int>(rPosAry.mnDestHeight), hBmpDC, - (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, + static_cast<int>(rPosAry.mnSrcX), static_cast<int>(rPosAry.mnSrcY), nDrawMode ); } else @@ -651,11 +651,11 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS ); StretchBlt( hDC, - (int)rPosAry.mnDestX, (int)rPosAry.mnDestY, - (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight, + static_cast<int>(rPosAry.mnDestX), static_cast<int>(rPosAry.mnDestY), + static_cast<int>(rPosAry.mnDestWidth), static_cast<int>(rPosAry.mnDestHeight), hBmpDC, - (int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY, - (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight, + static_cast<int>(rPosAry.mnSrcX), static_cast<int>(rPosAry.mnSrcY), + static_cast<int>(rPosAry.mnSrcWidth), static_cast<int>(rPosAry.mnSrcHeight), nDrawMode ); SetStretchBltMode( hDC, nOldStretchMode ); @@ -726,10 +726,10 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, const WinSalBitmap& rTransparentBitmap = static_cast<const WinSalBitmap&>(rSTransparentBitmap); SalTwoRect aPosAry = rPosAry; - int nDstX = (int)aPosAry.mnDestX; - int nDstY = (int)aPosAry.mnDestY; - int nDstWidth = (int)aPosAry.mnDestWidth; - int nDstHeight = (int)aPosAry.mnDestHeight; + int nDstX = static_cast<int>(aPosAry.mnDestX); + int nDstY = static_cast<int>(aPosAry.mnDestY); + int nDstWidth = static_cast<int>(aPosAry.mnDestWidth); + int nDstHeight = static_cast<int>(aPosAry.mnDestHeight); HDC hDC = mrParent.getHDC(); HBITMAP hMemBitmap = nullptr; HBITMAP hMaskBitmap = nullptr; @@ -798,7 +798,7 @@ bool WinSalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth, return false; // can only perform solid fills without XOR. HDC hMemDC = ImplGetCachedDC( CACHED_HDC_1 ); - SetPixel( hMemDC, (int)0, (int)0, mnBrushColor ); + SetPixel( hMemDC, int(0), int(0), mnBrushColor ); BLENDFUNCTION aFunc = { AC_SRC_OVER, @@ -866,7 +866,7 @@ SalBitmap* WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY ) HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_1, hBmpBitmap ); bool bRet; - bRet = BitBlt( hBmpDC, 0, 0, (int) nDX, (int) nDY, hDC, (int) nX, (int) nY, SRCCOPY ) ? TRUE : FALSE; + bRet = BitBlt( hBmpDC, 0, 0, static_cast<int>(nDX), static_cast<int>(nDY), hDC, static_cast<int>(nX), static_cast<int>(nY), SRCCOPY ) ? TRUE : FALSE; ImplReleaseCachedDC( CACHED_HDC_1 ); if( bRet ) @@ -890,7 +890,7 @@ SalBitmap* WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY ) SalColor WinSalGraphicsImpl::getPixel( long nX, long nY ) { - COLORREF aWinCol = ::GetPixel( mrParent.getHDC(), (int) nX, (int) nY ); + COLORREF aWinCol = ::GetPixel( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY) ); if ( CLR_INVALID == aWinCol ) return MAKE_SALCOLOR( 0, 0, 0 ); @@ -909,7 +909,7 @@ void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, Sa HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), GetStockBrush( NULL_BRUSH ) ); int nOldROP = SetROP2( mrParent.getHDC(), R2_NOT ); - Rectangle( mrParent.getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) ); + Rectangle( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY), static_cast<int>(nX+nWidth), static_cast<int>(nY+nHeight) ); SetROP2( mrParent.getHDC(), nOldROP ); SelectPen( mrParent.getHDC(), hOldPen ); @@ -935,10 +935,10 @@ void WinSalGraphicsImpl::invert( long nX, long nY, long nWidth, long nHeight, Sa else { RECT aRect; - aRect.left = (int)nX; - aRect.top = (int)nY; - aRect.right = (int)nX+nWidth; - aRect.bottom = (int)nY+nHeight; + aRect.left = static_cast<int>(nX); + aRect.top = static_cast<int>(nY); + aRect.right = static_cast<int>(nX)+nWidth; + aRect.bottom = static_cast<int>(nY)+nHeight; ::InvertRect( mrParent.getHDC(), &aRect ); } } @@ -986,12 +986,12 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal // for Windows 95 and its maximum number of points if ( nSalFlags & SalInvert::TrackFrame ) { - if ( !Polyline( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + if ( !Polyline( mrParent.getHDC(), pWinPtAry, static_cast<int>(nPoints) ) && (nPoints > MAX_64KSALPOINTS) ) Polyline( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } else { - if ( !Polygon( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + if ( !Polygon( mrParent.getHDC(), pWinPtAry, static_cast<int>(nPoints) ) && (nPoints > MAX_64KSALPOINTS) ) Polygon( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } @@ -1009,7 +1009,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal sal_uInt16 WinSalGraphicsImpl::GetBitCount() const { - return (sal_uInt16)GetDeviceCaps( mrParent.getHDC(), BITSPIXEL ); + return static_cast<sal_uInt16>(GetDeviceCaps( mrParent.getHDC(), BITSPIXEL )); } long WinSalGraphicsImpl::GetGraphicsWidth() const @@ -1250,29 +1250,29 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip ) { if(aRectIter->Left() < pBoundRect->left) { - pBoundRect->left = (int)aRectIter->Left(); + pBoundRect->left = static_cast<int>(aRectIter->Left()); } if(aRectIter->Top() < pBoundRect->top) { - pBoundRect->top = (int)aRectIter->Top(); + pBoundRect->top = static_cast<int>(aRectIter->Top()); } if(nRight > pBoundRect->right) { - pBoundRect->right = (int)nRight; + pBoundRect->right = static_cast<int>(nRight); } if(nBottom > pBoundRect->bottom) { - pBoundRect->bottom = (int)nBottom; + pBoundRect->bottom = static_cast<int>(nBottom); } } - pNextClipRect->left = (int)aRectIter->Left(); - pNextClipRect->top = (int)aRectIter->Top(); - pNextClipRect->right = (int)nRight; - pNextClipRect->bottom = (int)nBottom; + pNextClipRect->left = static_cast<int>(aRectIter->Left()); + pNextClipRect->top = static_cast<int>(aRectIter->Top()); + pNextClipRect->right = static_cast<int>(nRight); + pNextClipRect->bottom = static_cast<int>(nBottom); pNextClipRect++; } else @@ -1569,12 +1569,12 @@ void WinSalGraphicsImpl::drawPixelImpl( long nX, long nY, COLORREF crColor ) { HBRUSH hBrush = CreateSolidBrush( crColor ); HBRUSH hOldBrush = SelectBrush( mrParent.getHDC(), hBrush ); - PatBlt( mrParent.getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT ); + PatBlt( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY), int(1), int(1), PATINVERT ); SelectBrush( mrParent.getHDC(), hOldBrush ); DeleteBrush( hBrush ); } else - SetPixel( mrParent.getHDC(), (int)nX, (int)nY, crColor ); + SetPixel( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY), crColor ); } void WinSalGraphicsImpl::drawPixel( long nX, long nY ) @@ -1598,9 +1598,9 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor ) void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 ) { - MoveToEx( mrParent.getHDC(), (int)nX1, (int)nY1, nullptr ); + MoveToEx( mrParent.getHDC(), static_cast<int>(nX1), static_cast<int>(nY1), nullptr ); - LineTo( mrParent.getHDC(), (int)nX2, (int)nY2 ); + LineTo( mrParent.getHDC(), static_cast<int>(nX2), static_cast<int>(nY2) ); // LineTo doesn't draw the last pixel if ( !mrParent.isPrinter() ) @@ -1613,7 +1613,7 @@ void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight ) { if ( !mrParent.isPrinter() ) { - PatBlt( mrParent.getHDC(), (int)nX, (int)nY, (int)nWidth, (int)nHeight, + PatBlt( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY), static_cast<int>(nWidth), static_cast<int>(nHeight), mbXORMode ? PATINVERT : PATCOPY ); } else @@ -1627,7 +1627,7 @@ void WinSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight ) } } else - Rectangle( mrParent.getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) ); + Rectangle( mrParent.getHDC(), static_cast<int>(nX), static_cast<int>(nY), static_cast<int>(nX+nWidth), static_cast<int>(nY+nHeight) ); } void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) @@ -1638,7 +1638,7 @@ void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAr POINT const * pWinPtAry = reinterpret_cast<POINT const *>(pPtAry); // for Windows 95 and its maximum number of points - if ( !Polyline( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + if ( !Polyline( mrParent.getHDC(), pWinPtAry, static_cast<int>(nPoints) ) && (nPoints > MAX_64KSALPOINTS) ) Polyline( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS ); // Polyline seems to uses LineTo, which doesn't paint the last pixel (see 87eb8f8ee) @@ -1653,7 +1653,7 @@ void WinSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry POINT const * pWinPtAry = reinterpret_cast<POINT const *>(pPtAry); // for Windows 95 and its maximum number of points - if ( !Polygon( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) ) + if ( !Polygon( mrParent.getHDC(), pWinPtAry, static_cast<int>(nPoints) ) && (nPoints > MAX_64KSALPOINTS) ) Polygon( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS ); } @@ -1671,9 +1671,9 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pP else pWinPointAry = new UINT[nPoly]; - for ( i = 0; i < (UINT)nPoly; i++ ) + for ( i = 0; i < static_cast<UINT>(nPoly); i++ ) { - nPoints = (UINT)pPoints[i]+1; + nPoints = static_cast<UINT>(pPoints[i])+1; pWinPointAry[i] = nPoints; nPolyPolyPoints += nPoints; } @@ -1687,7 +1687,7 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pP // for NT, we can handover the array directly static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" ); UINT n = 0; - for ( i = 0; i < (UINT)nPoly; i++ ) + for ( i = 0; i < static_cast<UINT>(nPoly); i++ ) { nPoints = pWinPointAry[i]; const SalPoint* pPolyAry = pPtAry[i]; @@ -1696,20 +1696,20 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pP n += nPoints; } - if ( !PolyPolygon( mrParent.getHDC(), pWinPointAryAry, reinterpret_cast<int*>(pWinPointAry), (UINT)nPoly ) && + if ( !PolyPolygon( mrParent.getHDC(), pWinPointAryAry, reinterpret_cast<int*>(pWinPointAry), static_cast<UINT>(nPoly) ) && (nPolyPolyPoints > MAX_64KSALPOINTS) ) { nPolyPolyPoints = 0; nPoly = 0; do { - nPolyPolyPoints += pWinPointAry[(UINT)nPoly]; + nPolyPolyPoints += pWinPointAry[static_cast<UINT>(nPoly)]; nPoly++; } while ( nPolyPolyPoints < MAX_64KSALPOINTS ); nPoly--; - if ( pWinPointAry[(UINT)nPoly] > MAX_64KSALPOINTS ) - pWinPointAry[(UINT)nPoly] = MAX_64KSALPOINTS; + if ( pWinPointAry[static_cast<UINT>(nPoly)] > MAX_64KSALPOINTS ) + pWinPointAry[static_cast<UINT>(nPoly)] = MAX_64KSALPOINTS; if ( nPoly == 1 ) Polygon( mrParent.getHDC(), pWinPointAryAry, *pWinPointAry ); else @@ -1902,7 +1902,7 @@ bool WinSalGraphicsImpl::drawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPo if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) { Gdiplus::Graphics aGraphics(mrParent.getHDC()); - const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0)); + const sal_uInt8 aTrans(sal_uInt8(255) - static_cast<sal_uInt8>(basegfx::fround(fTransparency * 255.0))); const Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); const Gdiplus::SolidBrush aSolidBrush(aTestColor.GetValue()); Gdiplus::GraphicsPath aGraphicsPath(Gdiplus::FillModeAlternate); @@ -1968,7 +1968,7 @@ bool WinSalGraphicsImpl::drawPolyLine( if(mbPen && nCount) { Gdiplus::Graphics aGraphics(mrParent.getHDC()); - const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); + const sal_uInt8 aTrans = static_cast<sal_uInt8>(basegfx::fround( 255 * (1.0 - fTransparency) )); const Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); Gdiplus::Pen aPen(aTestColor.GetValue(), Gdiplus::REAL(rLineWidths.getX())); Gdiplus::GraphicsPath aGraphicsPath(Gdiplus::FillModeAlternate); diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx index e8110226ce2b..e33005efea6a 100644 --- a/vcl/win/gdi/salbmp.cxx +++ b/vcl/win/gdi/salbmp.cxx @@ -638,7 +638,7 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, sal_uInt16 nNewBitCount ) if( mhDIB ) { PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( mhDIB )); - const int nLines = (int) rSalBmp.maSize.Height(); + const int nLines = static_cast<int>(rSalBmp.maSize.Height()); HDC hDC = GetDC( nullptr ); PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize + ImplGetDIBColorCount( mhDIB ) * sizeof( RGBQUAD ); @@ -707,7 +707,7 @@ sal_uInt16 WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB ) if( pBI->bmiHeader.biBitCount <= 8 ) { if ( pBI->bmiHeader.biClrUsed ) - nColors = (sal_uInt16) pBI->bmiHeader.biClrUsed; + nColors = static_cast<sal_uInt16>(pBI->bmiHeader.biClrUsed); else nColors = 1 << pBI->bmiHeader.biBitCount; } @@ -733,7 +733,7 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBits, const // calculate bitmap size in Bytes const sal_uLong nAlignedWidth4Bytes = AlignedWidth4Bytes( nBits * rSize.Width() ); const sal_uLong nImageSize = nAlignedWidth4Bytes * rSize.Height(); - bool bOverflow = (nImageSize / nAlignedWidth4Bytes) != (sal_uLong) rSize.Height(); + bool bOverflow = (nImageSize / nAlignedWidth4Bytes) != static_cast<sal_uLong>(rSize.Height()); if( bOverflow ) return hDIB; @@ -872,7 +872,7 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ ) pBuffer->mnWidth = maSize.Width(); pBuffer->mnHeight = maSize.Height(); pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->biBitCount ); - pBuffer->mnBitCount = (sal_uInt16) pBIH->biBitCount; + pBuffer->mnBitCount = static_cast<sal_uInt16>(pBIH->biBitCount); if( pBuffer->mnBitCount <= 8 ) { diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 001518bf3e55..809db1b711f7 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -59,7 +59,7 @@ using namespace vcl; inline FIXED FixedFromDouble( double d ) { - const long l = (long) ( d * 65536. ); + const long l = static_cast<long>( d * 65536. ); return *reinterpret_cast<FIXED const *>(&l); } @@ -172,7 +172,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, OU // construct a Size structure as the parameter of constructor of class FontSelectPattern const Size aSize( pFace->GetWidth(), pFace->GetHeight() ); // create a FontSelectPattern object for getting s LOGFONT - const FontSelectPattern aFSD( *pFace, aSize, (float)aSize.Height(), 0, false ); + const FontSelectPattern aFSD( *pFace, aSize, static_cast<float>(aSize.Height()), 0, false ); // construct log font LOGFONTW aLogFont; ImplGetLogFontFromFontSelect( mhDC, &aFSD, aLogFont, true ); @@ -346,7 +346,7 @@ static rtl_TextEncoding ImplCharSetToSal( BYTE nCharSet ) if ( nCharSet == OEM_CHARSET ) { - UINT nCP = (sal_uInt16)GetOEMCP(); + UINT nCP = static_cast<sal_uInt16>(GetOEMCP()); switch ( nCP ) { // It is unclear why these two (undefined?) code page numbers are @@ -591,7 +591,7 @@ void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& rLogFont, Font& rFont ) nFontHeight += nDPIY/2; nFontHeight /= nDPIY; rFont.SetFontSize( Size( 0, nFontHeight ) ); - rFont.SetOrientation( (short)rLogFont.lfEscapement ); + rFont.SetOrientation( static_cast<short>(rLogFont.lfEscapement) ); if ( rLogFont.lfItalic ) rFont.SetItalic( ITALIC_NORMAL ); else @@ -790,8 +790,8 @@ void ImplGetLogFontFromFontSelect( HDC hDC, } rLogFont.lfWeight = ImplWeightToWin( pFont->GetWeight() ); - rLogFont.lfHeight = (LONG)-pFont->mnHeight; - rLogFont.lfWidth = (LONG)pFont->mnWidth; + rLogFont.lfHeight = static_cast<LONG>(-pFont->mnHeight); + rLogFont.lfWidth = static_cast<LONG>(pFont->mnWidth); rLogFont.lfUnderline = 0; rLogFont.lfStrikeOut = 0; rLogFont.lfItalic = BYTE(pFont->GetItalic() != ITALIC_NONE); diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index 9d6dcd55ec2b..ffdd874cdd50 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -174,10 +174,10 @@ void ImplInitSalGDI() pSalData->mpDitherDiff[ n ] = n - ( n & 248L ); for( n = 0; n < 256; n++ ) - pSalData->mpDitherLow[ n ] = (BYTE) ( n & 248 ); + pSalData->mpDitherLow[ n ] = static_cast<BYTE>( n & 248 ); for( n = 0; n < 256; n++ ) - pSalData->mpDitherHigh[ n ] = (BYTE) std::min( pSalData->mpDitherLow[ n ] + 8, 255 ); + pSalData->mpDitherHigh[ n ] = static_cast<BYTE>(std::min( pSalData->mpDitherLow[ n ] + 8, 255 )); } } else if ( (nRasterCaps & RC_PALETTE) && (nBitCount == 8) ) @@ -192,7 +192,7 @@ void ImplInitSalGDI() // create logical palette pLogPal = reinterpret_cast<LOGPALETTE*>(new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ]); pLogPal->palVersion = 0x0300; - pLogPal->palNumEntries = (sal_uInt16) nTotalCount; + pLogPal->palNumEntries = static_cast<sal_uInt16>(nTotalCount); pPalEntry = pLogPal->palPalEntry; // Standard colors @@ -246,16 +246,16 @@ void ImplInitSalGDI() pBIH->biBitCount = 8; for( n = 0; n < nDitherPalCount; n++ ) - pColors[ n ] = (short)( n + DITHER_MAX_SYSCOLOR ); + pColors[ n ] = static_cast<short>( n + DITHER_MAX_SYSCOLOR ); for( n = 0; n < 256; n++ ) pSalData->mpDitherDiff[ n ] = n % 51; for( n = 0; n < 256; n++ ) - pSalData->mpDitherLow[ n ] = (BYTE) ( n / 51 ); + pSalData->mpDitherLow[ n ] = static_cast<BYTE>( n / 51 ); for( n = 0; n < 256; n++ ) - pSalData->mpDitherHigh[ n ] = (BYTE)std::min( pSalData->mpDitherLow[ n ] + 1, 5 ); + pSalData->mpDitherHigh[ n ] = static_cast<BYTE>(std::min( pSalData->mpDitherLow[ n ] + 1, 5 )); } // get system color entries @@ -345,9 +345,9 @@ void ImplFreeSalGDI() int ImplIsSysColorEntry( SalColor nSalColor ) { SysColorEntry* pEntry = pFirstSysColor; - const DWORD nTestRGB = (DWORD)RGB( SALCOLOR_RED( nSalColor ), + const DWORD nTestRGB = static_cast<DWORD>(RGB( SALCOLOR_RED( nSalColor ), SALCOLOR_GREEN( nSalColor ), - SALCOLOR_BLUE( nSalColor ) ); + SALCOLOR_BLUE( nSalColor ) )); while ( pEntry ) { @@ -984,7 +984,7 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* // #107797# Write out buffer - *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)( aBuf.getLength() - 2 ); + *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = static_cast<sal_uInt16>( aBuf.getLength() - 2 ); Escape ( getHDC(), nEscape, aBuf.getLength(), aBuf.getStr(), nullptr ); // #107797# Write out EPS transformation code @@ -1003,7 +1003,7 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* aBuf.append( nY - ( dM22 * nBoundingBox[3] ) ); aBuf.append( "] concat\n" "%%BeginDocument:\n" ); - *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)( aBuf.getLength() - 2 ); + *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = static_cast<sal_uInt16>( aBuf.getLength() - 2 ); Escape ( getHDC(), nEscape, aBuf.getLength(), aBuf.getStr(), nullptr ); // #107797# Write out actual EPS content @@ -1017,7 +1017,7 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* nDoNow = POSTSCRIPT_BUFSIZE - 2; // the following is based on the string buffer allocation // of size POSTSCRIPT_BUFSIZE at construction time of aBuf - *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)nDoNow; + *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = static_cast<sal_uInt16>(nDoNow); memcpy( const_cast<char *>(aBuf.getStr() + 2), static_cast<BYTE*>(pPtr) + nSize - nToDo, nDoNow ); sal_uLong nResult = Escape ( getHDC(), nEscape, nDoNow + 2, aBuf.getStr(), nullptr ); if (!nResult ) @@ -1033,7 +1033,7 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* "count op_count_salWin sub {pop} repeat\n" "countdictstack dict_count_salWin sub {end} repeat\n" "b4_Inc_state_salWin restore\n\n" ); - *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)( aBuf.getLength() - 2 ); + *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = static_cast<sal_uInt16>( aBuf.getLength() - 2 ); Escape ( getHDC(), nEscape, aBuf.getLength(), aBuf.getStr(), nullptr ); bRetValue = TRUE; } diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 59aff3f27448..aa9c5173a1ba 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -328,7 +328,7 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter const * pPrinter, if ( (pSetupData->GetSystem() == JOBSETUP_SYSTEM_WINDOWS) && (pPrinter->maDriverName == pSetupData->GetDriver()) && (pSetupData->GetDriverDataLen() > sizeof( SalDriverData )) && - (long)(pSetupData->GetDriverDataLen() - pSetupDriverData->mnDriverOffset) == nSysJobSize && + static_cast<long>(pSetupData->GetDriverDataLen() - pSetupDriverData->mnDriverOffset) == nSysJobSize && pSetupDriverData->mnSysSignature == SAL_DRIVERDATA_SYSSIGN ) { if( pDevModeW && @@ -474,7 +474,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe { if( pDevModeW->dmDefaultSource == pBins[ i ] ) { - pSetupData->SetPaperBin( (sal_uInt16)i ); + pSetupData->SetPaperBin( static_cast<sal_uInt16>(i) ); break; } } @@ -960,8 +960,8 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter const * pPrinter, const Imp { pDevModeW->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH; pDevModeW->dmPaperSize = DMPAPER_USER; - pDevModeW->dmPaperWidth = (short)(pSetupData->GetPaperWidth()/10); - pDevModeW->dmPaperLength = (short)(pSetupData->GetPaperHeight()/10); + pDevModeW->dmPaperWidth = static_cast<short>(pSetupData->GetPaperWidth()/10); + pDevModeW->dmPaperLength = static_cast<short>(pSetupData->GetPaperHeight()/10); } if ( pPapers ) @@ -1332,7 +1332,7 @@ static DEVMODEW const * ImplSalSetCopies( DEVMODEW const * pDevMode, sal_uLong n LPDEVMODEW pNewDevMode = static_cast<LPDEVMODEW>(rtl_allocateMemory( nDevSize )); memcpy( pNewDevMode, pDevMode, nDevSize ); pNewDevMode->dmFields |= DM_COPIES; - pNewDevMode->dmCopies = (short)(sal_uInt16)nCopies; + pNewDevMode->dmCopies = static_cast<short>(static_cast<sal_uInt16>(nCopies)); pNewDevMode->dmFields |= DM_COLLATE; if ( bCollate ) pNewDevMode->dmCollate = DMCOLLATE_TRUE; diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx index 17b32862d52f..6a50509f876b 100644 --- a/vcl/win/gdi/salvd.cxx +++ b/vcl/win/gdi/salvd.cxx @@ -36,14 +36,14 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY, if ( nBitCount == 1 ) { - hBitmap = CreateBitmap( (int)nDX, (int)nDY, 1, 1, nullptr ); + hBitmap = CreateBitmap( static_cast<int>(nDX), static_cast<int>(nDY), 1, 1, nullptr ); SAL_WARN_IF( !hBitmap, "vcl", "CreateBitmap failed: " << WindowsErrorString( GetLastError() ) ); ppData = nullptr; } else { if (nBitCount == 0) - nBitCount = (WORD)GetDeviceCaps(hDC, BITSPIXEL); + nBitCount = static_cast<WORD>(GetDeviceCaps(hDC, BITSPIXEL)); // #146839# Don't use CreateCompatibleBitmap() - there seem to // be build-in limits for those HBITMAPs, at least this fails diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index aedba07f6a5e..22b870bde928 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -123,7 +123,7 @@ bool WinSalFrame::mbInReparent = FALSE; // Macros for support of WM_UNICHAR & Keyman 6.0 //#define Uni_UTF32ToSurrogate1(ch) (((unsigned long) (ch) - 0x10000) / 0x400 + 0xD800) -#define Uni_UTF32ToSurrogate2(ch) (((unsigned long) (ch) - 0x10000) % 0x400 + 0xDC00) +#define Uni_UTF32ToSurrogate2(ch) ((static_cast<unsigned long>(ch) - 0x10000) % 0x400 + 0xDC00) #define Uni_SupplementaryPlanesStart 0x10000 static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame ); @@ -680,7 +680,7 @@ static UINT ImplSalGetWheelScrollLines() if ( hWndMsWheel ) { UINT nGetScrollLinesMsgId = RegisterWindowMessageW( MSH_SCROLL_LINES ); - nScrLines = (UINT)SendMessageW( hWndMsWheel, nGetScrollLinesMsgId, 0, 0 ); + nScrLines = static_cast<UINT>(SendMessageW( hWndMsWheel, nGetScrollLinesMsgId, 0, 0 )); } if ( !nScrLines ) @@ -988,9 +988,9 @@ SalGraphics* WinSalFrame::AcquireGraphics() mpGraphics2->setHDC(nullptr); } - HDC hDC = reinterpret_cast<HDC>((sal_IntPtr)SendMessageW( pSalData->mpInstance->mhComWnd, + HDC hDC = reinterpret_cast<HDC>(static_cast<sal_IntPtr>(SendMessageW( pSalData->mpInstance->mhComWnd, SAL_MSG_GETDC, - reinterpret_cast<WPARAM>(mhWnd), 0 )); + reinterpret_cast<WPARAM>(mhWnd), 0 ))); if ( hDC ) { mpGraphics2->setHDC(hDC); @@ -1278,9 +1278,9 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, // Calculate window size including the border RECT aWinRect; aWinRect.left = 0; - aWinRect.right = (int)nWidth-1; + aWinRect.right = static_cast<int>(nWidth)-1; aWinRect.top = 0; - aWinRect.bottom = (int)nHeight-1; + aWinRect.bottom = static_cast<int>(nHeight)-1; AdjustWindowRectEx( &aWinRect, GetWindowStyle( mhWnd ), FALSE, GetWindowExStyle( mhWnd ) ); nWidth = aWinRect.right - aWinRect.left + 1; @@ -1431,7 +1431,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, if( !(mnStyle & SalFrameStyleFlags::FLOAT) ) nPosFlags |= SWP_NOZORDER; // do not change z-order - SetWindowPos( mhWnd, HWND_TOP, nX, nY, (int)nWidth, (int)nHeight, nPosFlags ); + SetWindowPos( mhWnd, HWND_TOP, nX, nY, static_cast<int>(nWidth), static_cast<int>(nHeight), nPosFlags ); UpdateFrameGeometry( mhWnd, this ); @@ -1508,9 +1508,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs // create a new hwnd with the same styles HWND hWndParent = hNewParentWnd; // forward to main thread - HWND hWnd = reinterpret_cast<HWND>((sal_IntPtr) SendMessageW( pSalData->mpInstance->mhComWnd, + HWND hWnd = reinterpret_cast<HWND>(static_cast<sal_IntPtr>(SendMessageW( pSalData->mpInstance->mhComWnd, bAsChild ? SAL_MSG_RECREATECHILDHWND : SAL_MSG_RECREATEHWND, - reinterpret_cast<WPARAM>(hWndParent), reinterpret_cast<LPARAM>(pThis->mhWnd) )); + reinterpret_cast<WPARAM>(hWndParent), reinterpret_cast<LPARAM>(pThis->mhWnd) ))); // succeeded ? SAL_WARN_IF( !IsWindow( hWnd ), "vcl", "WinSalFrame::SetParent not successful"); @@ -1525,9 +1525,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs if( bNeedCacheDC ) { // re-create cached DC - HDC hDC = reinterpret_cast<HDC>((sal_IntPtr)SendMessageW( pSalData->mpInstance->mhComWnd, + HDC hDC = reinterpret_cast<HDC>(static_cast<sal_IntPtr>(SendMessageW( pSalData->mpInstance->mhComWnd, SAL_MSG_GETDC, - reinterpret_cast<WPARAM>(hWnd), 0 )); + reinterpret_cast<WPARAM>(hWnd), 0 ))); if ( hDC ) { pThis->mpGraphics2->setHDC(hDC); @@ -1582,7 +1582,7 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs // Now destroy original HWND in the thread where it was created. SendMessageW( GetSalData()->mpInstance->mhComWnd, - SAL_MSG_DESTROYHWND, (WPARAM) 0, reinterpret_cast<LPARAM>(hWndOld)); + SAL_MSG_DESTROYHWND, WPARAM(0), reinterpret_cast<LPARAM>(hWndOld)); } void WinSalFrame::SetParent( SalFrame* pNewParent ) @@ -1662,19 +1662,19 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState ) if ( !(pState->mnMask & (WindowStateMask::Width | WindowStateMask::Height)) ) nPosSize |= SWP_NOSIZE; if ( pState->mnMask & WindowStateMask::X ) - nX = (int)pState->mnX - nLeftDeco; + nX = static_cast<int>(pState->mnX) - nLeftDeco; else nX = aWinRect.left; if ( pState->mnMask & WindowStateMask::Y ) - nY = (int)pState->mnY - nTopDeco; + nY = static_cast<int>(pState->mnY) - nTopDeco; else nY = aWinRect.top; if ( pState->mnMask & WindowStateMask::Width ) - nWidth = (int)pState->mnWidth + nLeftDeco + nRightDeco; + nWidth = static_cast<int>(pState->mnWidth) + nLeftDeco + nRightDeco; else nWidth = aWinRect.right-aWinRect.left; if ( pState->mnMask & WindowStateMask::Height ) - nHeight = (int)pState->mnHeight + nTopDeco + nBottomDeco; + nHeight = static_cast<int>(pState->mnHeight) + nTopDeco + nBottomDeco; else nHeight = aWinRect.bottom-aWinRect.top; @@ -2020,7 +2020,7 @@ void WinSalFrame::ToTop( SalFrameToTop nFlags ) // We post this message to avoid deadlocks if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) { - BOOL const ret = PostMessageW( mhWnd, SAL_MSG_TOTOP, (WPARAM)nFlags, 0 ); + BOOL const ret = PostMessageW( mhWnd, SAL_MSG_TOTOP, static_cast<WPARAM>(nFlags), 0 ); SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); } else @@ -2167,8 +2167,8 @@ void WinSalFrame::CaptureMouse( bool bCapture ) void WinSalFrame::SetPointerPos( long nX, long nY ) { POINT aPt; - aPt.x = (int)nX; - aPt.y = (int)nY; + aPt.x = static_cast<int>(nX); + aPt.y = static_cast<int>(nY); ClientToScreen( mhWnd, &aPt ); SetCursorPos( aPt.x, aPt.y ); } @@ -2263,7 +2263,7 @@ static void ImplSalFrameEndExtTextInput( HWND hWnd, EndExtTextInputFlags nFlags void WinSalFrame::EndExtTextInput( EndExtTextInputFlags nFlags ) { // Must be called in the main thread! - SendMessageW( mhWnd, SAL_MSG_ENDEXTTEXTINPUT, (WPARAM)nFlags, 0 ); + SendMessageW( mhWnd, SAL_MSG_ENDEXTTEXTINPUT, static_cast<WPARAM>(nFlags), 0 ); } static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, @@ -2346,21 +2346,21 @@ OUString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode ) if ( nKeyCode & KEY_MOD1 ) { nSysCode = MapVirtualKeyW( VK_CONTROL, 0 ); - nSysCode = (nSysCode << 16) | (((sal_uLong)1) << 25); + nSysCode = (nSysCode << 16) | ((sal_uLong(1)) << 25); ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen, nMaxKeyLen, "Ctrl" ); } if ( nKeyCode & KEY_MOD2 ) { nSysCode = MapVirtualKeyW( VK_MENU, 0 ); - nSysCode = (nSysCode << 16) | (((sal_uLong)1) << 25); + nSysCode = (nSysCode << 16) | ((sal_uLong(1)) << 25); ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen, nMaxKeyLen, "Alt" ); } if ( nKeyCode & KEY_SHIFT ) { nSysCode = MapVirtualKeyW( VK_SHIFT, 0 ); - nSysCode = (nSysCode << 16) | (((sal_uLong)1) << 25); + nSysCode = (nSysCode << 16) | ((sal_uLong(1)) << 25); ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen, nMaxKeyLen, "Shift" ); } @@ -2404,42 +2404,42 @@ OUString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode ) { case KEY_DOWN: nSysCode = VK_DOWN; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Down"; break; case KEY_UP: nSysCode = VK_UP; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Up"; break; case KEY_LEFT: nSysCode = VK_LEFT; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Left"; break; case KEY_RIGHT: nSysCode = VK_RIGHT; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Right"; break; case KEY_HOME: nSysCode = VK_HOME; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Home"; break; case KEY_END: nSysCode = VK_END; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "End"; break; case KEY_PAGEUP: nSysCode = VK_PRIOR; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Page Up"; break; case KEY_PAGEDOWN: nSysCode = VK_NEXT; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Page Down"; break; case KEY_RETURN: @@ -2464,12 +2464,12 @@ OUString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode ) break; case KEY_INSERT: nSysCode = VK_INSERT; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Insert"; break; case KEY_DELETE: nSysCode = VK_DELETE; - nSysCode2 = (((sal_uLong)1) << 24); + nSysCode2 = ((sal_uLong(1)) << 24); pReplace = "Delete"; break; @@ -2609,7 +2609,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS ) { if ( nType == REG_SZ ) - aMouseSettings.SetMenuDelay( (sal_uLong)ImplW2I( aValueBuf ) ); + aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) ); } RegCloseKey( hRegKey ); @@ -2798,11 +2798,11 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) { if ( nType == REG_SZ ) { - nValue = (sal_uLong)ImplW2I( aValueBuf ); + nValue = static_cast<sal_uLong>(ImplW2I( aValueBuf )); if ( (nValue > 1000) && (nValue < 10000) ) { MiscSettings aMiscSettings = rSettings.GetMiscSettings(); - utl::MiscCfg().SetYear2000( (sal_Int32)(nValue-99) ); + utl::MiscCfg().SetYear2000( static_cast<sal_Int32>(nValue-99) ); rSettings.SetMiscSettings( aMiscSettings ); } } @@ -2927,23 +2927,23 @@ void WinSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) else { if ( nX < pBoundRect->left ) - pBoundRect->left = (int)nX; + pBoundRect->left = static_cast<int>(nX); if ( nY < pBoundRect->top ) - pBoundRect->top = (int)nY; + pBoundRect->top = static_cast<int>(nY); if ( nRight > pBoundRect->right ) - pBoundRect->right = (int)nRight; + pBoundRect->right = static_cast<int>(nRight); if ( nBottom > pBoundRect->bottom ) - pBoundRect->bottom = (int)nBottom; + pBoundRect->bottom = static_cast<int>(nBottom); } - pRect->left = (int)nX; - pRect->top = (int)nY; - pRect->right = (int)nRight; - pRect->bottom = (int)nBottom; - if( (mpNextClipRect - reinterpret_cast<RECT*>(&mpClipRgnData->Buffer)) < (int)mpClipRgnData->rdh.nCount ) + pRect->left = static_cast<int>(nX); + pRect->top = static_cast<int>(nY); + pRect->right = static_cast<int>(nRight); + pRect->bottom = static_cast<int>(nBottom); + if( (mpNextClipRect - reinterpret_cast<RECT*>(&mpClipRgnData->Buffer)) < static_cast<int>(mpClipRgnData->rdh.nCount) ) mpNextClipRect++; } @@ -3010,8 +3010,8 @@ static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg, SalEvent nEvent = SalEvent::NONE; bool bCall = TRUE; - aMouseEvt.mnX = (short)LOWORD( lParam ); - aMouseEvt.mnY = (short)HIWORD( lParam ); + aMouseEvt.mnX = static_cast<short>(LOWORD( lParam )); + aMouseEvt.mnY = static_cast<short>(HIWORD( lParam )); aMouseEvt.mnCode = 0; aMouseEvt.mnTime = GetMessageTime(); @@ -3084,8 +3084,8 @@ static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg, } // Mouse-Coordinates are relative to the screen POINT aPt; - aPt.x = (short)LOWORD( lParam ); - aPt.y = (short)HIWORD( lParam ); + aPt.x = static_cast<short>(LOWORD( lParam )); + aPt.y = static_cast<short>(HIWORD( lParam )); ScreenToClient( hWnd, &aPt ); aMouseEvt.mnX = aPt.x; aMouseEvt.mnY = aPt.y; @@ -3177,8 +3177,8 @@ static bool ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar { WORD nWinModCode = LOWORD( wParam ); POINT aWinPt; - aWinPt.x = (short)LOWORD( lParam ); - aWinPt.y = (short)HIWORD( lParam ); + aWinPt.x = static_cast<short>(LOWORD( lParam )); + aWinPt.y = static_cast<short>(HIWORD( lParam )); ScreenToClient( hWnd, &aWinPt ); SalWheelMouseEvent aWheelEvt; @@ -3186,7 +3186,7 @@ static bool ImplHandleWheelMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar aWheelEvt.mnX = aWinPt.x; aWheelEvt.mnY = aWinPt.y; aWheelEvt.mnCode = 0; - aWheelEvt.mnDelta = (short)HIWORD( wParam ); + aWheelEvt.mnDelta = static_cast<short>(HIWORD( wParam )); aWheelEvt.mnNotchDelta = aWheelEvt.mnDelta/WHEEL_DELTA; if( aWheelEvt.mnNotchDelta == 0 ) { @@ -3242,7 +3242,7 @@ static sal_uInt16 ImplSalGetKeyCode( WPARAM wParam ) else { SalData* pSalData = GetSalData(); - std::map< UINT, sal_uInt16 >::const_iterator it = pSalData->maVKMap.find( (UINT)wParam ); + std::map< UINT, sal_uInt16 >::const_iterator it = pSalData->maVKMap.find( static_cast<UINT>(wParam) ); if( it != pSalData->maVKMap.end() ) nKeyCode = it->second; else @@ -3273,7 +3273,7 @@ static sal_Unicode ImplGetCharCode( WinSalFrame* pFrame, WPARAM nCharCode ) // We are on Windows NT so we use Unicode FrameProcs and we // get Unicode charcodes directly from Windows - return (sal_Unicode)nCharCode; + return static_cast<sal_Unicode>(nCharCode); } LanguageType WinSalFrame::GetInputLanguage() @@ -3290,7 +3290,7 @@ LanguageType WinSalFrame::GetInputLanguage() bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) { bool bRet = FALSE; - sal_IntPtr nLangType = (sal_uInt16)aLangType; + sal_IntPtr nLangType = static_cast<sal_uInt16>(aLangType); // just use the passed language identifier, do not try to load additional keyboard support HKL hkl = reinterpret_cast<HKL>(nLangType); @@ -3439,10 +3439,10 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg, nLastVKChar = 0; pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt ); pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt ); - wParam = (sal_Unicode) Uni_UTF32ToSurrogate2( wParam ); + wParam = static_cast<sal_Unicode>(Uni_UTF32ToSurrogate2( wParam )); } - aKeyEvt.mnCharCode = (sal_Unicode) wParam; + aKeyEvt.mnCharCode = static_cast<sal_Unicode>(wParam); nLastChar = 0; nLastVKChar = 0; @@ -3660,7 +3660,7 @@ bool ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ) sal_uInt16 nRepeat = LOWORD( lParam )-1; sal_uInt16 nModCode = 0; - sal_uInt16 cKeyCode = (sal_uInt16)wParam; + sal_uInt16 cKeyCode = static_cast<sal_uInt16>(wParam); // determine modifiers if ( GetKeyState( VK_SHIFT ) & 0x8000 ) @@ -3975,8 +3975,8 @@ static void ImplHandleSizeMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ) { UpdateFrameGeometry( hWnd, pFrame ); - pFrame->mnWidth = (int)LOWORD(lParam); - pFrame->mnHeight = (int)HIWORD(lParam); + pFrame->mnWidth = static_cast<int>(LOWORD(lParam)); + pFrame->mnHeight = static_cast<int>(HIWORD(lParam)); // save state ImplSaveFrameState( pFrame ); // Call Hdl @@ -4394,7 +4394,7 @@ static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam ) { int nRet = MNC_IGNORE; HMENU hMenu = reinterpret_cast<HMENU>(lParam); - OUString aMnemonic( "&" + OUStringLiteral1((sal_Unicode) LOWORD(wParam)) ); + OUString aMnemonic( "&" + OUStringLiteral1(static_cast<sal_Unicode>(LOWORD(wParam))) ); aMnemonic = aMnemonic.toAsciiLowerCase(); // we only have ascii mnemonics // search the mnemonic in the current menu @@ -4574,7 +4574,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) GlobalUnlock( hDrawDIB ); HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) ); - DrawStateW( pDI->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hBmp), (WPARAM)0, + DrawStateW( pDI->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hBmp), WPARAM(0), x, y+(lineHeight-bmpSize.Height())/2, bmpSize.Width(), bmpSize.Height(), DST_BITMAP | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) ); @@ -4604,7 +4604,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) if(!DrawStateW( pDI->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(aStr.getStr()), - (WPARAM)0, aRect.left, aRect.top + (lineHeight - strSize.cy)/2, 0, 0, + WPARAM(0), aRect.left, aRect.top + (lineHeight - strSize.cy)/2, 0, 0, DST_PREFIXTEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) ) SAL_WARN("vcl", "DrawStateW failed: " << WindowsErrorString(GetLastError())); @@ -4621,7 +4621,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) // (potential) submenu arrow (tm.tmMaxCharWidth) if(!DrawStateW( pDI->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(aStr.getStr()), - (WPARAM)0, aRect.right-strSizeA.cx-tm.tmMaxCharWidth, aRect.top + (lineHeight - strSizeA.cy)/2, 0, 0, + WPARAM(0), aRect.right-strSizeA.cx-tm.tmMaxCharWidth, aRect.top + (lineHeight - strSizeA.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) ) SAL_WARN("vcl", "DrawStateW failed: " << WindowsErrorString(GetLastError())); } @@ -4838,7 +4838,7 @@ static bool ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam ) HWND hFocusWnd = ::GetFocus(); if ( hFocusWnd && ImplFindSalObject( hFocusWnd ) ) { - char cKeyCode = (char)(unsigned char)LOWORD( lParam ); + char cKeyCode = static_cast<char>(static_cast<unsigned char>(LOWORD( lParam ))); // LowerCase if ( (cKeyCode >= 65) && (cKeyCode <= 90) ) cKeyCode += 32; @@ -4985,7 +4985,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame, { auto pTextBuf = std::unique_ptr<WCHAR[]>(new WCHAR[nTextLen]); ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf.get(), nTextLen*sizeof( WCHAR ) ); - aEvt.maText = OUString( o3tl::toU(pTextBuf.get()), (sal_Int32)nTextLen ); + aEvt.maText = OUString( o3tl::toU(pTextBuf.get()), static_cast<sal_Int32>(nTextLen) ); } aEvt.mnCursorPos = aEvt.maText.getLength(); @@ -5011,7 +5011,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame, { auto pTextBuf = std::unique_ptr<WCHAR>(new WCHAR[nTextLen]); ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf.get(), nTextLen*sizeof( WCHAR ) ); - aEvt.maText = OUString( o3tl::toU(pTextBuf.get()), (sal_Int32)nTextLen ); + aEvt.maText = OUString( o3tl::toU(pTextBuf.get()), static_cast<sal_Int32>(nTextLen) ); } std::unique_ptr<BYTE> pAttrBuf; @@ -5200,7 +5200,7 @@ static bool ImplHandleAppCommand( HWND hWnd, LPARAM lParam, LRESULT & nRet ) static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam ) { - if ( wParam == (WPARAM)IMN_OPENCANDIDATE ) + if ( wParam == WPARAM(IMN_OPENCANDIDATE) ) { ImplSalYieldMutexAcquireWithWait(); @@ -5241,7 +5241,7 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam ) ImplSalYieldMutexRelease(); } - else if ( wParam == (WPARAM)IMN_CLOSECANDIDATE ) + else if ( wParam == WPARAM(IMN_CLOSECANDIDATE) ) { ImplSalYieldMutexAcquireWithWait(); WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -5426,8 +5426,8 @@ static int ImplSalWheelMousePos( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPa { POINT aPt; POINT aScreenPt; - aScreenPt.x = (short)LOWORD( lParam ); - aScreenPt.y = (short)HIWORD( lParam ); + aScreenPt.x = static_cast<short>(LOWORD( lParam )); + aScreenPt.y = static_cast<short>(HIWORD( lParam )); // find child window that is at this position HWND hChildWnd; HWND hWheelWnd = hWnd; @@ -5755,11 +5755,11 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP rDef = FALSE; break; case SAL_MSG_TOTOP: - ImplSalToTop( hWnd, (SalFrameToTop)wParam ); + ImplSalToTop( hWnd, static_cast<SalFrameToTop>(wParam) ); rDef = FALSE; break; case SAL_MSG_SHOW: - ImplSalShow( hWnd, (bool)wParam, (bool)lParam ); + ImplSalShow( hWnd, static_cast<bool>(wParam), static_cast<bool>(lParam) ); rDef = FALSE; break; case SAL_MSG_SETINPUTCONTEXT: @@ -5767,7 +5767,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP rDef = FALSE; break; case SAL_MSG_ENDEXTTEXTINPUT: - ImplSalFrameEndExtTextInput( hWnd, (EndExtTextInputFlags)wParam ); + ImplSalFrameEndExtTextInput( hWnd, static_cast<EndExtTextInputFlags>(wParam) ); rDef = FALSE; break; @@ -5816,17 +5816,17 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP } break; case WM_IME_REQUEST: - if ( (sal_uIntPtr)wParam == IMR_RECONVERTSTRING ) + if ( static_cast<sal_uIntPtr>(wParam) == IMR_RECONVERTSTRING ) { nRet = ImplHandleIMEReconvertString( hWnd, lParam ); rDef = FALSE; } - else if( (sal_uIntPtr)wParam == IMR_CONFIRMRECONVERTSTRING ) + else if( static_cast<sal_uIntPtr>(wParam) == IMR_CONFIRMRECONVERTSTRING ) { nRet = ImplHandleIMEConfirmReconvertString( hWnd, lParam ); rDef = FALSE; } - else if ( (sal_uIntPtr)wParam == IMR_QUERYCHARPOSITION ) + else if ( static_cast<sal_uIntPtr>(wParam) == IMR_QUERYCHARPOSITION ) { if ( ImplSalYieldMutexTryToAcquire() ) { diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx index 592813759e88..45be022ef23b 100644 --- a/vcl/win/window/salmenu.cxx +++ b/vcl/win/window/salmenu.cxx @@ -189,7 +189,7 @@ void WinSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) void WinSalMenu::RemoveItem( unsigned nPos ) { int num = ::GetMenuItemCount( mhMenu ); - if( num != -1 && nPos < (unsigned)num ) + if( num != -1 && nPos < static_cast<unsigned>(num) ) { WinSalMenuItem *pSalMenuItem = nullptr; diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx index 0996e9c5eb13..ad352217ed89 100644 --- a/vcl/win/window/salobj.cxx +++ b/vcl/win/window/salobj.cxx @@ -348,7 +348,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l if ( hWndChild ) { SetWindowPos( hWndChild, - nullptr, 0, 0, (int)LOWORD( lParam ), (int)HIWORD( lParam ), + nullptr, 0, 0, static_cast<int>(LOWORD( lParam )), static_cast<int>(HIWORD( lParam )), SWP_NOZORDER | SWP_NOACTIVATE ); } } @@ -430,10 +430,10 @@ LRESULT CALLBACK SalSysObjChildWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPA // transform coordinates POINT pt; - pt.x = (long) LOWORD( lParam ); - pt.y = (long) HIWORD( lParam ); + pt.x = static_cast<long>(LOWORD( lParam )); + pt.y = static_cast<long>(HIWORD( lParam )); MapWindowPoints( hWnd, hWndParent, &pt, 1 ); - lParam = MAKELPARAM( (WORD) pt.x, (WORD) pt.y ); + lParam = MAKELPARAM( static_cast<WORD>(pt.x), static_cast<WORD>(pt.y) ); nRet = SendMessageW( hWndParent, nMsg, wParam, lParam ); rDef = FALSE; @@ -640,22 +640,22 @@ void WinSalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight else { if ( nX < pBoundRect->left ) - pBoundRect->left = (int)nX; + pBoundRect->left = static_cast<int>(nX); if ( nY < pBoundRect->top ) - pBoundRect->top = (int)nY; + pBoundRect->top = static_cast<int>(nY); if ( nRight > pBoundRect->right ) - pBoundRect->right = (int)nRight; + pBoundRect->right = static_cast<int>(nRight); if ( nBottom > pBoundRect->bottom ) - pBoundRect->bottom = (int)nBottom; + pBoundRect->bottom = static_cast<int>(nBottom); } - pRect->left = (int)nX; - pRect->top = (int)nY; - pRect->right = (int)nRight; - pRect->bottom = (int)nBottom; + pRect->left = static_cast<int>(nX); + pRect->top = static_cast<int>(nY); + pRect->right = static_cast<int>(nRight); + pRect->bottom = static_cast<int>(nBottom); mpNextClipRect++; } @@ -692,7 +692,7 @@ void WinSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) nStyle |= SWP_SHOWWINDOW; } SetWindowPos( mhWnd, nullptr, - (int)nX, (int)nY, (int)nWidth, (int)nHeight, + static_cast<int>(nX), static_cast<int>(nY), static_cast<int>(nWidth), static_cast<int>(nHeight), SWP_NOZORDER | SWP_NOACTIVATE | nStyle ); } |