summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/app/i18n_cb.cxx8
-rw-r--r--vcl/unx/generic/app/i18n_keysym.cxx2
-rw-r--r--vcl/unx/generic/app/i18n_status.cxx4
-rw-r--r--vcl/unx/generic/app/saldisp.cxx46
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx16
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx12
-rw-r--r--vcl/unx/generic/dtrans/bmp.cxx94
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx20
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx24
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx6
-rw-r--r--vcl/unx/generic/gdi/salvd.cxx4
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx12
-rw-r--r--vcl/unx/generic/glyphs/glyphcache.cxx2
-rw-r--r--vcl/unx/generic/print/bitmap_gfx.cxx16
-rw-r--r--vcl/unx/generic/print/common_gfx.cxx32
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx6
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx6
-rw-r--r--vcl/unx/generic/print/printerjob.cxx14
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx26
-rw-r--r--vcl/unx/generic/window/salframe.cxx54
-rw-r--r--vcl/unx/generic/window/salobj.cxx14
-rw-r--r--vcl/unx/gtk/a11y/atkaction.cxx4
-rw-r--r--vcl/unx/gtk/a11y/atklistener.cxx8
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx10
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx2
-rw-r--r--vcl/unx/gtk/glomenu.cxx22
-rw-r--r--vcl/unx/gtk/gtkdata.cxx2
-rw-r--r--vcl/unx/gtk/gtkinst.cxx2
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx48
-rw-r--r--vcl/unx/gtk/gtksalmenu.cxx4
-rw-r--r--vcl/unx/gtk/gtksys.cxx2
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx8
-rw-r--r--vcl/unx/gtk3/gtk3gtkdata.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx32
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx6
-rw-r--r--vcl/unx/x11/x11sys.cxx4
36 files changed, 287 insertions, 287 deletions
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index b56922f82f40..b62f5306de04 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -83,13 +83,13 @@ Preedit_DeleteText(preedit_text_t *ptext, int from, int howmuch)
int to = from + howmuch;
- if (to == (int)ptext->nLength)
+ if (to == static_cast<int>(ptext->nLength))
{
// delete from the end of the text
ptext->nLength = from;
}
else
- if (to < (int)ptext->nLength)
+ if (to < static_cast<int>(ptext->nLength))
{
// cut out of the middle of the text
memmove( static_cast<void*>(ptext->pUnicodeBuffer + from),
@@ -121,7 +121,7 @@ enlarge_buffer ( preedit_text_t *ptext, int nnewlimit )
{
size_t nnewsize = ptext->nSize;
- while ( nnewsize <= (size_t)nnewlimit )
+ while ( nnewsize <= static_cast<size_t>(nnewlimit) )
nnewsize *= 2;
ptext->nSize = nnewsize;
@@ -228,7 +228,7 @@ void
Preedit_UpdateAttributes ( preedit_text_t* ptext, XIMFeedback const * feedback,
int from, int amount )
{
- if ( (from + amount) > (int)ptext->nLength )
+ if ( (from + amount) > static_cast<int>(ptext->nLength) )
{
// XXX this indicates an error, are we out of sync ?
fprintf (stderr, "Preedit_UpdateAttributes( %i + %i > %i )\n",
diff --git a/vcl/unx/generic/app/i18n_keysym.cxx b/vcl/unx/generic/app/i18n_keysym.cxx
index fa263f20577b..9fdbe9eae3b3 100644
--- a/vcl/unx/generic/app/i18n_keysym.cxx
+++ b/vcl/unx/generic/app/i18n_keysym.cxx
@@ -324,7 +324,7 @@ KeysymToUnicode (KeySym nKeySym)
// strip off group indicator and iso10646 plane
// FIXME can't handle chars from surrogate area.
if (! (nKeySym & 0x00ff0000) )
- return (sal_Unicode)(nKeySym & 0x0000ffff);
+ return static_cast<sal_Unicode>(nKeySym & 0x0000ffff);
}
// legacy keysyms, switch to appropriate codeset
else
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 81ce3a5450b2..301e7f85622e 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -195,7 +195,7 @@ Point XIMStatusWindow::updatePosition()
int x, y;
::Window aChild;
XTranslateCoordinates( static_cast<Display*>(pParentEnvData->pDisplay),
- (::Window)pParentEnvData->aShellWindow,
+ static_cast<::Window>(pParentEnvData->aShellWindow),
vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetRootWindow( vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDefaultXScreen() ),
0, 0,
&x, &y,
@@ -267,7 +267,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl, void*, void)
if( m_bDelayedShow )
{
XRaiseWindow( static_cast<Display*>(pData->pDisplay),
- (::Window)pData->aShellWindow );
+ static_cast<::Window>(pData->aShellWindow) );
}
}
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index a0330bb7c1d8..767cf81aa239 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -94,16 +94,16 @@ inline const char *GetAtomName( Display *d, Atom a )
{ return Null( XGetAtomName( d, a ) ); }
inline double Hypothenuse( long w, long h )
-{ return sqrt( (double)((w*w)+(h*h)) ); }
+{ return sqrt( static_cast<double>((w*w)+(h*h)) ); }
#endif
inline int ColorDiff( int r, int g, int b )
{ return (r*r)+(g*g)+(b*b); }
inline int ColorDiff( SalColor c1, int r, int g, int b )
-{ return ColorDiff( (int)SALCOLOR_RED (c1)-r,
- (int)SALCOLOR_GREEN(c1)-g,
- (int)SALCOLOR_BLUE (c1)-b ); }
+{ return ColorDiff( static_cast<int>(SALCOLOR_RED (c1))-r,
+ static_cast<int>(SALCOLOR_GREEN(c1))-g,
+ static_cast<int>(SALCOLOR_BLUE (c1))-b ); }
static int sal_Shift( Pixel nMask )
{
@@ -588,7 +588,7 @@ void SalDisplay::Init()
if( pValStr != nullptr )
{
const OString aValStr( pValStr );
- const long nDPI = (long) aValStr.toDouble();
+ const long nDPI = static_cast<long>(aValStr.toDouble());
// guard against insane resolution
if( sal_ValidDPI(nDPI) )
{
@@ -605,8 +605,8 @@ void SalDisplay::Init()
long xDPI = 96;
long yDPI = 96;
if (m_aScreens.size() == 1) {
- xDPI = (long)round(DisplayWidth(pDisp_, 0)*25.4/DisplayWidthMM(pDisp_, 0));
- yDPI = (long)round(DisplayHeight(pDisp_, 0)*25.4/DisplayHeightMM(pDisp_, 0));
+ xDPI = static_cast<long>(round(DisplayWidth(pDisp_, 0)*25.4/DisplayWidthMM(pDisp_, 0)));
+ yDPI = static_cast<long>(round(DisplayHeight(pDisp_, 0)*25.4/DisplayHeightMM(pDisp_, 0)));
// if either is invalid set it equal to the other
if (!sal_ValidDPI(xDPI) && sal_ValidDPI(yDPI))
xDPI = yDPI;
@@ -1026,22 +1026,22 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
sal_uInt16 nKey = 0;
if( XK_a <= keysym && XK_z >= keysym )
- nKey = (sal_uInt16)(KEY_A + (keysym - XK_a));
+ nKey = static_cast<sal_uInt16>(KEY_A + (keysym - XK_a));
else if( XK_A <= keysym && XK_Z >= keysym )
- nKey = (sal_uInt16)(KEY_A + (keysym - XK_A));
+ nKey = static_cast<sal_uInt16>(KEY_A + (keysym - XK_A));
else if( XK_0 <= keysym && XK_9 >= keysym )
- nKey = (sal_uInt16)(KEY_0 + (keysym - XK_0));
+ nKey = static_cast<sal_uInt16>(KEY_0 + (keysym - XK_0));
else if( IsModifierKey( keysym ) )
;
else if( IsKeypadKey( keysym ) )
{
if( (keysym >= XK_KP_0) && (keysym <= XK_KP_9) )
{
- nKey = (sal_uInt16)(KEY_0 + (keysym - XK_KP_0));
+ nKey = static_cast<sal_uInt16>(KEY_0 + (keysym - XK_KP_0));
*pcPrintable = '0' + nKey - KEY_0;
}
else if( IsPFKey( keysym ) )
- nKey = (sal_uInt16)(KEY_F1 + (keysym - XK_KP_F1));
+ nKey = static_cast<sal_uInt16>(KEY_F1 + (keysym - XK_KP_F1));
else switch( keysym )
{
case XK_KP_Space:
@@ -1120,7 +1120,7 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
if( bNumLockFromXS_ )
{
if( keysym >= XK_F1 && keysym <= XK_F26 )
- nKey = (sal_uInt16)(KEY_F1 + keysym - XK_F1);
+ nKey = static_cast<sal_uInt16>(KEY_F1 + keysym - XK_F1);
}
else switch( keysym )
{
@@ -1189,7 +1189,7 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
break;
default:
if( keysym >= XK_F1 && keysym <= XK_F26 )
- nKey = (sal_uInt16)(KEY_F1 + keysym - XK_F1);
+ nKey = static_cast<sal_uInt16>(KEY_F1 + keysym - XK_F1);
break;
}
}
@@ -1463,7 +1463,7 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent,
if ( (XK_space <= nKeySym) && (XK_asciitilde >= nKeySym) )
{
*pLen = 1;
- pPrintable[ 0 ] = (char)nKeySym;
+ pPrintable[ 0 ] = static_cast<char>(nKeySym);
}
break;
case XLookupBoth:
@@ -1869,7 +1869,7 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture )
if( !pEnv || !*pEnv )
{
int ret = XGrabPointer( GetDisplay(),
- (::Window)pEnvData->aWindow,
+ static_cast<::Window>(pEnvData->aWindow),
False,
PointerMotionMask| ButtonPressMask|ButtonReleaseMask,
GrabModeAsync,
@@ -2455,7 +2455,7 @@ SalVisual::~SalVisual()
SalColor SalVisual::GetTCColor( Pixel nPixel ) const
{
if( SALCOLOR == eRGBMode_ )
- return (SalColor)nPixel;
+ return static_cast<SalColor>(nPixel);
if( SALCOLORREVERSE == eRGBMode_ )
return MAKE_SALCOLOR( (nPixel & 0x0000FF),
@@ -2488,11 +2488,11 @@ SalColor SalVisual::GetTCColor( Pixel nPixel ) const
Pixel SalVisual::GetTCPixel( SalColor nSalColor ) const
{
if( SALCOLOR == eRGBMode_ )
- return (Pixel)nSalColor;
+ return static_cast<Pixel>(nSalColor);
- Pixel r = (Pixel)SALCOLOR_RED( nSalColor );
- Pixel g = (Pixel)SALCOLOR_GREEN( nSalColor );
- Pixel b = (Pixel)SALCOLOR_BLUE( nSalColor );
+ Pixel r = static_cast<Pixel>(SALCOLOR_RED( nSalColor ));
+ Pixel g = static_cast<Pixel>(SALCOLOR_GREEN( nSalColor ));
+ Pixel b = static_cast<Pixel>(SALCOLOR_BLUE( nSalColor ));
if( SALCOLORREVERSE == eRGBMode_ )
return (b << 16) | (g << 8) | r;
@@ -2612,7 +2612,7 @@ SalColormap::SalColormap( sal_uInt16 nDepth )
&aVI ) )
{
aVI.visual = new Visual;
- aVI.visualid = (VisualID)0; // beware of temporary destructor below
+ aVI.visualid = VisualID(0); // beware of temporary destructor below
aVI.screen = 0;
aVI.depth = nDepth;
aVI.c_class = TrueColor;
@@ -2667,7 +2667,7 @@ SalColormap::SalColormap( sal_uInt16 nDepth )
m_aVisual = SalVisual( &aVI );
// give ownership of constructed Visual() to m_aVisual
// see SalVisual destructor
- m_aVisual.visualid = (VisualID)-1;
+ m_aVisual.visualid = VisualID(-1);
m_aVisual.screen = -1;
}
else
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index 56e06f691c66..b21f35cdb8ab 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -455,7 +455,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
&nBytesLeft,
&pProperty
) == 0
- && nItems == 4*(unsigned)m_nDesktops
+ && nItems == 4*static_cast<unsigned>(m_nDesktops)
)
{
m_aWMWorkAreas = ::std::vector< tools::Rectangle > ( m_nDesktops );
@@ -996,7 +996,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const
int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength();
const SystemEnvData* pEnv = pFrame->GetSystemData();
XChangeProperty( m_pDisplay,
- (::Window)pEnv->aShellWindow,
+ static_cast<::Window>(pEnv->aShellWindow),
XA_WM_NAME,
nType,
nFormat,
@@ -1004,7 +1004,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const
pData,
nBytes );
XChangeProperty( m_pDisplay,
- (::Window)pEnv->aShellWindow,
+ static_cast<::Window>(pEnv->aShellWindow),
XA_WM_ICON_NAME,
nType,
nFormat,
@@ -1012,7 +1012,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const
pData,
nBytes );
XChangeProperty( m_pDisplay,
- (::Window)pEnv->aShellWindow,
+ static_cast<::Window>(pEnv->aShellWindow),
m_aWMAtoms[ WM_LOCALE_NAME ],
XA_STRING,
8,
@@ -1038,7 +1038,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con
const SystemEnvData* pEnv = pFrame->GetSystemData();
if( m_aWMAtoms[ NET_WM_NAME ] )
XChangeProperty( m_pDisplay,
- (::Window)pEnv->aShellWindow,
+ static_cast<::Window>(pEnv->aShellWindow),
m_aWMAtoms[ NET_WM_NAME ],
m_aWMAtoms[ UTF8_STRING ],
8,
@@ -1047,7 +1047,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con
aTitle.getLength() );
if( m_aWMAtoms[ NET_WM_ICON_NAME ] )
XChangeProperty( m_pDisplay,
- (::Window)pEnv->aShellWindow,
+ static_cast<::Window>(pEnv->aShellWindow),
m_aWMAtoms[ NET_WM_ICON_NAME ],
m_aWMAtoms[ UTF8_STRING ],
8,
@@ -2234,7 +2234,7 @@ void WMAdaptor::setPID( X11SalFrame const * i_pFrame ) const
{
if( m_aWMAtoms[NET_WM_PID] )
{
- long nPID = (long)getpid();
+ long nPID = static_cast<long>(getpid());
XChangeProperty( m_pDisplay,
i_pFrame->GetShellWindow(),
m_aWMAtoms[NET_WM_PID],
@@ -2261,7 +2261,7 @@ void WMAdaptor::answerPing( X11SalFrame const * i_pFrame, XClientMessageEvent co
{
if( m_aWMAtoms[NET_WM_PING] &&
i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] &&
- (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] )
+ static_cast<Atom>(i_pEvent->data.l[0]) == m_aWMAtoms[ NET_WM_PING ] )
{
XEvent aEvent;
aEvent.xclient = *i_pEvent;
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index b85a144ccacb..605670ff3b7a 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1428,12 +1428,12 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
// handle colormap request
if( target == XA_COLORMAP )
- nValue = (XID)pPixmap->getColormap();
+ nValue = static_cast<XID>(pPixmap->getColormap());
else if( target == XA_VISUALID )
- nValue = (XID)pPixmap->getVisualID();
+ nValue = static_cast<XID>(pPixmap->getVisualID());
else if( target == XA_PIXMAP || target == XA_BITMAP )
{
- nValue = (XID)pPixmap->getPixmap();
+ nValue = static_cast<XID>(pPixmap->getPixmap());
if( nValue == None )
{
// first conversion
@@ -1459,13 +1459,13 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
// get pixmap again since clearing the guard could have invalidated
// the pixmap in another thread
pPixmap = getPixmapHolder( selection );
- nValue = (XID)pPixmap->setBitmapData( reinterpret_cast<const sal_uInt8*>(aData.getConstArray()) );
+ nValue = static_cast<XID>(pPixmap->setBitmapData( reinterpret_cast<const sal_uInt8*>(aData.getConstArray()) ));
}
if( nValue == None )
return false;
}
if( target == XA_BITMAP )
- nValue = (XID)pPixmap->getBitmap();
+ nValue = static_cast<XID>(pPixmap->getBitmap());
}
XChangeProperty( m_pDisplay,
@@ -1609,7 +1609,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
}
else if( rRequest.target == m_nTIMESTAMPAtom )
{
- long nTimeStamp = (long)m_aSelections[rRequest.selection]->m_nOrigTimestamp;
+ long nTimeStamp = static_cast<long>(m_aSelections[rRequest.selection]->m_nOrigTimestamp);
XChangeProperty( m_pDisplay, rRequest.requestor, rRequest.property,
XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&nTimeStamp), 1 );
aNotify.xselection.property = rRequest.property;
diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx
index ccc610cf6416..c72e93100eb4 100644
--- a/vcl/unx/generic/dtrans/bmp.cxx
+++ b/vcl/unx/generic/dtrans/bmp.cxx
@@ -160,13 +160,13 @@ static sal_uInt8* X11_getPaletteBmpFromImage(
pBuffer[ 1 ] = 'M';
writeLE( nHeaderSize, pBuffer+10 );
- writeLE( (sal_uInt32)40, pBuffer+14 );
- writeLE( (sal_uInt32)pImage->width, pBuffer+18 );
- writeLE( (sal_uInt32)pImage->height, pBuffer+22 );
- writeLE( (sal_uInt16)1, pBuffer+26 );
+ writeLE( sal_uInt32(40), pBuffer+14 );
+ writeLE( static_cast<sal_uInt32>(pImage->width), pBuffer+18 );
+ writeLE( static_cast<sal_uInt32>(pImage->height), pBuffer+22 );
+ writeLE( sal_uInt16(1), pBuffer+26 );
writeLE( nBitCount, pBuffer+28 );
- writeLE( (sal_uInt32)(DisplayWidth(pDisplay,DefaultScreen(pDisplay))*1000/DisplayWidthMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+38);
- writeLE( (sal_uInt32)(DisplayHeight(pDisplay,DefaultScreen(pDisplay))*1000/DisplayHeightMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+42);
+ writeLE( static_cast<sal_uInt32>(DisplayWidth(pDisplay,DefaultScreen(pDisplay))*1000/DisplayWidthMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+38);
+ writeLE( static_cast<sal_uInt32>(DisplayHeight(pDisplay,DefaultScreen(pDisplay))*1000/DisplayHeightMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+42);
writeLE( nColors, pBuffer+46 );
writeLE( nColors, pBuffer+50 );
@@ -181,9 +181,9 @@ static sal_uInt8* X11_getPaletteBmpFromImage(
XQueryColors( pDisplay, aColormap, aColors, nColors );
for( sal_uInt32 i = 0; i < nColors; i++ )
{
- pBuffer[ 54 + i*4 ] = (sal_uInt8)(aColors[i].blue >> 8);
- pBuffer[ 55 + i*4 ] = (sal_uInt8)(aColors[i].green >> 8);
- pBuffer[ 56 + i*4 ] = (sal_uInt8)(aColors[i].red >> 8);
+ pBuffer[ 54 + i*4 ] = static_cast<sal_uInt8>(aColors[i].blue >> 8);
+ pBuffer[ 55 + i*4 ] = static_cast<sal_uInt8>(aColors[i].green >> 8);
+ pBuffer[ 56 + i*4 ] = static_cast<sal_uInt8>(aColors[i].red >> 8);
}
// done
@@ -273,17 +273,17 @@ static sal_uInt8* X11_getTCBmpFromImage(
{
unsigned long nPixel = XGetPixel( pImage, x, y );
- sal_uInt8 nValue = (sal_uInt8)doRightShift( nPixel&aVInfo.blue_mask, nBlueShift);
+ sal_uInt8 nValue = static_cast<sal_uInt8>(doRightShift( nPixel&aVInfo.blue_mask, nBlueShift));
if( nBlueShift2 )
nValue |= (nValue >> nBlueShift2 );
*pScanline++ = nValue;
- nValue = (sal_uInt8)doRightShift( nPixel&aVInfo.green_mask, nGreenShift);
+ nValue = static_cast<sal_uInt8>(doRightShift( nPixel&aVInfo.green_mask, nGreenShift));
if( nGreenShift2 )
nValue |= (nValue >> nGreenShift2 );
*pScanline++ = nValue;
- nValue = (sal_uInt8)doRightShift( nPixel&aVInfo.red_mask, nRedShift);
+ nValue = static_cast<sal_uInt8>(doRightShift( nPixel&aVInfo.red_mask, nRedShift));
if( nRedShift2 )
nValue |= (nValue >> nRedShift2 );
*pScanline++ = nValue;
@@ -295,13 +295,13 @@ static sal_uInt8* X11_getTCBmpFromImage(
pBuffer[ 1 ] = 'M';
writeLE( nHeaderSize, pBuffer+10 );
- writeLE( (sal_uInt32)40, pBuffer+14 );
- writeLE( (sal_uInt32)pImage->width, pBuffer+18 );
- writeLE( (sal_uInt32)pImage->height, pBuffer+22 );
- writeLE( (sal_uInt16)1, pBuffer+26 );
- writeLE( (sal_uInt16)24, pBuffer+28 );
- writeLE( (sal_uInt32)(DisplayWidth(pDisplay,DefaultScreen(pDisplay))*1000/DisplayWidthMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+38);
- writeLE( (sal_uInt32)(DisplayHeight(pDisplay,DefaultScreen(pDisplay))*1000/DisplayHeightMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+42);
+ writeLE( sal_uInt32(40), pBuffer+14 );
+ writeLE( static_cast<sal_uInt32>(pImage->width), pBuffer+18 );
+ writeLE( static_cast<sal_uInt32>(pImage->height), pBuffer+22 );
+ writeLE( sal_uInt16(1), pBuffer+26 );
+ writeLE( sal_uInt16(24), pBuffer+28 );
+ writeLE( static_cast<sal_uInt32>(DisplayWidth(pDisplay,DefaultScreen(pDisplay))*1000/DisplayWidthMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+38);
+ writeLE( static_cast<sal_uInt32>(DisplayHeight(pDisplay,DefaultScreen(pDisplay))*1000/DisplayHeightMM(pDisplay,DefaultScreen(pDisplay))), pBuffer+42);
// done
@@ -407,9 +407,9 @@ PixmapHolder::PixmapHolder( Display* pDisplay )
getShift( m_aInfo.green_mask, m_nGreenShift, nGreenSig, m_nGreenShift2 );
getShift( m_aInfo.blue_mask, m_nBlueShift, nBlueSig, m_nBlueShift2 );
- m_nBlueShift2Mask = m_nBlueShift2 ? ~((unsigned long)((1<<m_nBlueShift2)-1)) : ~0L;
- m_nGreenShift2Mask = m_nGreenShift2 ? ~((unsigned long)((1<<m_nGreenShift2)-1)) : ~0L;
- m_nRedShift2Mask = m_nRedShift2 ? ~((unsigned long)((1<<m_nRedShift2)-1)) : ~0L;
+ m_nBlueShift2Mask = m_nBlueShift2 ? ~static_cast<unsigned long>((1<<m_nBlueShift2)-1) : ~0L;
+ m_nGreenShift2Mask = m_nGreenShift2 ? ~static_cast<unsigned long>((1<<m_nGreenShift2)-1) : ~0L;
+ m_nRedShift2Mask = m_nRedShift2 ? ~static_cast<unsigned long>((1<<m_nRedShift2)-1) : ~0L;
}
}
@@ -424,15 +424,15 @@ PixmapHolder::~PixmapHolder()
unsigned long PixmapHolder::getTCPixel( sal_uInt8 r, sal_uInt8 g, sal_uInt8 b ) const
{
unsigned long nPixel = 0;
- unsigned long nValue = (unsigned long)b;
+ unsigned long nValue = static_cast<unsigned long>(b);
nValue &= m_nBlueShift2Mask;
nPixel |= doLeftShift( nValue, m_nBlueShift );
- nValue = (unsigned long)g;
+ nValue = static_cast<unsigned long>(g);
nValue &= m_nGreenShift2Mask;
nPixel |= doLeftShift( nValue, m_nGreenShift );
- nValue = (unsigned long)r;
+ nValue = static_cast<unsigned long>(r);
nValue &= m_nRedShift2Mask;
nPixel |= doLeftShift( nValue, m_nRedShift );
@@ -457,17 +457,17 @@ void PixmapHolder::setBitmapDataPalette( const sal_uInt8* pData, XImage* pImage
//so, using a byte-swapping pattern which coverity doesn't
//detect as such
//http://security.coverity.com/blog/2014/Apr/on-detecting-heartbleed-with-static-analysis.html
- aPalette[i].red = ((unsigned short)pData[42 + i*4]);
+ aPalette[i].red = static_cast<unsigned short>(pData[42 + i*4]);
aPalette[i].red <<= 8;
- aPalette[i].red |= ((unsigned short)pData[42 + i*4]);
+ aPalette[i].red |= static_cast<unsigned short>(pData[42 + i*4]);
- aPalette[i].green = ((unsigned short)pData[41 + i*4]);
+ aPalette[i].green = static_cast<unsigned short>(pData[41 + i*4]);
aPalette[i].green <<= 8;
- aPalette[i].green |= ((unsigned short)pData[41 + i*4]);
+ aPalette[i].green |= static_cast<unsigned short>(pData[41 + i*4]);
- aPalette[i].blue = ((unsigned short)pData[40 + i*4]);
+ aPalette[i].blue = static_cast<unsigned short>(pData[40 + i*4]);
aPalette[i].blue <<= 8;
- aPalette[i].blue |= ((unsigned short)pData[40 + i*4]);
+ aPalette[i].blue |= static_cast<unsigned short>(pData[40 + i*4]);
XAllocColor( m_pDisplay, m_aColormap, aPalette+i );
}
else
@@ -507,11 +507,11 @@ void PixmapHolder::setBitmapDataPalette( const sal_uInt8* pData, XImage* pImage
case 1: nCol = (pScanline[ x/8 ] & (0x80 >> (x&7))) != 0 ? 0 : 1; break;
case 4:
if( x & 1 )
- nCol = (int)(pScanline[ x/2 ] >> 4);
+ nCol = static_cast<int>(pScanline[ x/2 ] >> 4);
else
- nCol = (int)(pScanline[ x/2 ] & 0x0f);
+ nCol = static_cast<int>(pScanline[ x/2 ] & 0x0f);
break;
- case 8: nCol = (int)pScanline[x];
+ case 8: nCol = static_cast<int>(pScanline[x]);
}
XPutPixel( pImage, x, y, aPalette[nCol].pixel );
}
@@ -547,14 +547,14 @@ void PixmapHolder::setBitmapDataTCDither( const sal_uInt8* pData, XImage* pImage
int nColors = 1 << m_aInfo.depth;
int i;
for( i = 0; i < nColors; i++ )
- aRealPalette[i].pixel = (unsigned long)i;
+ aRealPalette[i].pixel = static_cast<unsigned long>(i);
XQueryColors( m_pDisplay, m_aColormap, aRealPalette, nColors );
for( i = 0; i < nColors; i++ )
{
sal_uInt8 nIndex =
- 36*(sal_uInt8)(aRealPalette[i].red/10923) +
- 6*(sal_uInt8)(aRealPalette[i].green/10923) +
- (sal_uInt8)(aRealPalette[i].blue/10923);
+ 36*static_cast<sal_uInt8>(aRealPalette[i].red/10923) +
+ 6*static_cast<sal_uInt8>(aRealPalette[i].green/10923) +
+ static_cast<sal_uInt8>(aRealPalette[i].blue/10923);
if( aPalette[nIndex].pixel == 0 )
aPalette[nIndex] = aRealPalette[i];
}
@@ -572,10 +572,10 @@ void PixmapHolder::setBitmapDataTCDither( const sal_uInt8* pData, XImage* pImage
nScanlineSize += 4;
}
- for( int y = 0; y < (int)nHeight; y++ )
+ for( int y = 0; y < static_cast<int>(nHeight); y++ )
{
- const sal_uInt8* pScanline = pBMData + (nHeight-1-(sal_uInt32)y)*nScanlineSize;
- for( int x = 0; x < (int)nWidth; x++ )
+ const sal_uInt8* pScanline = pBMData + (nHeight-1-static_cast<sal_uInt32>(y))*nScanlineSize;
+ for( int x = 0; x < static_cast<int>(nWidth); x++ )
{
sal_uInt8 b = pScanline[3*x];
sal_uInt8 g = pScanline[3*x+1];
@@ -604,10 +604,10 @@ void PixmapHolder::setBitmapDataTC( const sal_uInt8* pData, XImage* pImage )
nScanlineSize += 4;
}
- for( int y = 0; y < (int)nHeight; y++ )
+ for( int y = 0; y < static_cast<int>(nHeight); y++ )
{
- const sal_uInt8* pScanline = pBMData + (nHeight-1-(sal_uInt32)y)*nScanlineSize;
- for( int x = 0; x < (int)nWidth; x++ )
+ const sal_uInt8* pScanline = pBMData + (nHeight-1-static_cast<sal_uInt32>(y))*nScanlineSize;
+ for( int x = 0; x < static_cast<int>(nWidth); x++ )
{
unsigned long nPixel = getTCPixel( pScanline[3*x+2], pScanline[3*x+1], pScanline[3*x] );
XPutPixel( pImage, x, y, nPixel );
@@ -627,7 +627,7 @@ bool PixmapHolder::needsConversion( const sal_uInt8* pData )
if( m_aInfo.c_class != TrueColor )
return true;
}
- else if( nDepth != (sal_uInt32)m_aInfo.depth )
+ else if( nDepth != static_cast<sal_uInt32>(m_aInfo.depth) )
{
if( m_aInfo.c_class != TrueColor )
return true;
@@ -668,8 +668,8 @@ Pixmap PixmapHolder::setBitmapData( const sal_uInt8* pData )
if( m_aPixmap != None )
{
XImage aImage;
- aImage.width = (int)nWidth;
- aImage.height = (int)nHeight;
+ aImage.width = static_cast<int>(nWidth);
+ aImage.height = static_cast<int>(nHeight);
aImage.xoffset = 0;
aImage.format = ZPixmap;
aImage.data = nullptr;
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index d1743dd47c74..0f14242a5150 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -84,8 +84,8 @@ using namespace com::sun::star::lang;
inline sal_uInt16 getUInt16BE( const sal_uInt8*& pBuffer )
{
- sal_uInt16 nRet = (sal_uInt16)pBuffer[1] |
- (((sal_uInt16)pBuffer[0]) << 8);
+ sal_uInt16 nRet = static_cast<sal_uInt16>(pBuffer[1]) |
+ (static_cast<sal_uInt16>(pBuffer[0]) << 8);
pBuffer+=2;
return nRet;
}
@@ -363,7 +363,7 @@ OUString PrintFontManager::convertSfntName( void* pRecord )
OUStringBuffer aName( pNameRecord->slen/2 );
const sal_uInt8* pNameBuffer = pNameRecord->sptr;
for(int n = 0; n < pNameRecord->slen/2; n++ )
- aName.append( (sal_Unicode)getUInt16BE( pNameBuffer ) );
+ aName.append( static_cast<sal_Unicode>(getUInt16BE( pNameBuffer )) );
aValue = aName.makeStringAndClear();
}
else if( pNameRecord->platformID == 3 )
@@ -380,7 +380,7 @@ OUString PrintFontManager::convertSfntName( void* pRecord )
const sal_uInt8* pNameBuffer = pNameRecord->sptr;
for(int n = 0; n < pNameRecord->slen/2; n++ )
{
- sal_Unicode aCode = (sal_Unicode)getUInt16BE( pNameBuffer );
+ sal_Unicode aCode = static_cast<sal_Unicode>(getUInt16BE( pNameBuffer ));
sal_Char aChar = aCode >> 8;
if( aChar )
aName.append( aChar );
@@ -531,7 +531,7 @@ void PrintFontManager::analyzeSfntFamilyName( void const * pTTFont, ::std::vecto
}
else if (pNameRecords[i].platformID == 1)
{
- AppleLanguageId aAppleId = static_cast<AppleLanguageId>((sal_uInt16)pNameRecords[i].languageID);
+ AppleLanguageId aAppleId = static_cast<AppleLanguageId>(static_cast<sal_uInt16>(pNameRecords[i].languageID));
LanguageTag aApple(makeLanguageTagFromAppleLanguageId(aAppleId));
if (aApple == aSystem)
nMatch = 8000;
@@ -1009,10 +1009,10 @@ bool PrintFontManager::createFontSubset(
else
{
SAL_WARN_IF( (pGlyphIds[i] & 0x007f0000), "vcl", "overlong glyph id" );
- SAL_WARN_IF( (int)pNewEncoding[i] >= nGlyphs, "vcl", "encoding wrong" );
+ SAL_WARN_IF( static_cast<int>(pNewEncoding[i]) >= nGlyphs, "vcl", "encoding wrong" );
SAL_WARN_IF( pEnc[pNewEncoding[i]] != 0 || pGID[pNewEncoding[i]] != 0, "vcl", "duplicate encoded glyph" );
pEnc[ pNewEncoding[i] ] = pNewEncoding[i];
- pGID[ pNewEncoding[i] ] = (sal_uInt16)pGlyphIds[ i ];
+ pGID[ pNewEncoding[i] ] = static_cast<sal_uInt16>(pGlyphIds[ i ]);
pOldIndex[ pNewEncoding[i] ] = i;
nChar++;
}
@@ -1164,13 +1164,13 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
break;
cOld = c;
#if 1 // TODO: remove when sal_Unicode covers all of unicode
- if (c > (sal_Unicode)~0)
+ if (c > sal_Unicode(~0))
break;
#endif
// get the matching glyph index
const sal_GlyphId aGlyphId = xFontCharMap->GetGlyphIndex(c);
// update the requested map
- rUnicodeEnc[(sal_Unicode)c] = aGlyphId;
+ rUnicodeEnc[static_cast<sal_Unicode>(c)] = aGlyphId;
}
}
}
@@ -1186,7 +1186,7 @@ SAL_DLLPUBLIC_EXPORT const char * unit_online_get_fonts(void)
PrintFontManager &rMgr = PrintFontManager::get();
rMgr.getFontList(aFontIDs);
OStringBuffer aBuf;
- aBuf.append( (sal_Int32)aFontIDs.size() );
+ aBuf.append( static_cast<sal_Int32>(aFontIDs.size()) );
aBuf.append( " PS fonts.\n" );
for( auto nId : aFontIDs )
{
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index b8e3fb4cc9d4..870b53b5232b 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -77,8 +77,8 @@ public:
{
for (sal_uLong i = 0; i < nPoints; ++i)
{
- Points_[i].x = (short)p[i].mnX;
- Points_[i].y = (short)p[i].mnY;
+ Points_[i].x = static_cast<short>(p[i].mnX);
+ Points_[i].y = static_cast<short>(p[i].mnY);
}
Points_[nPoints] = Points_[0]; // close polyline
}
@@ -1023,10 +1023,10 @@ bool X11SalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
{
XRectangle aRect;
- aRect.x = (short)aRectIter->Left();
- aRect.y = (short)aRectIter->Top();
- aRect.width = (unsigned short)nW;
- aRect.height = (unsigned short)nH;
+ aRect.x = static_cast<short>(aRectIter->Left());
+ aRect.y = static_cast<short>(aRectIter->Top());
+ aRect.width = static_cast<unsigned short>(nW);
+ aRect.height = static_cast<unsigned short>(nH);
XUnionRectWithRegion(&aRect, mrParent.mpClipRegion, mrParent.mpClipRegion);
}
}
@@ -1132,13 +1132,13 @@ void X11SalGraphicsImpl::SetROPLineColor( SalROPColor nROPColor )
switch( nROPColor )
{
case SalROPColor::N0 : // 0
- mnPenPixel = (Pixel)0;
+ mnPenPixel = Pixel(0);
break;
case SalROPColor::N1 : // 1
- mnPenPixel = (Pixel)(1 << mrParent.GetVisual().GetDepth()) - 1;
+ mnPenPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1;
break;
case SalROPColor::Invert : // 2
- mnPenPixel = (Pixel)(1 << mrParent.GetVisual().GetDepth()) - 1;
+ mnPenPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1;
break;
}
mnPenColor = mrParent.GetColormap().GetColor( mnPenPixel );
@@ -1150,13 +1150,13 @@ void X11SalGraphicsImpl::SetROPFillColor( SalROPColor nROPColor )
switch( nROPColor )
{
case SalROPColor::N0 : // 0
- mnBrushPixel = (Pixel)0;
+ mnBrushPixel = Pixel(0);
break;
case SalROPColor::N1 : // 1
- mnBrushPixel = (Pixel)(1 << mrParent.GetVisual().GetDepth()) - 1;
+ mnBrushPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1;
break;
case SalROPColor::Invert : // 2
- mnBrushPixel = (Pixel)(1 << mrParent.GetVisual().GetDepth()) - 1;
+ mnBrushPixel = static_cast<Pixel>(1 << mrParent.GetVisual().GetDepth()) - 1;
break;
}
mbDitherBrush = false;
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index d599a39aaf1d..69ca5b041d11 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -376,7 +376,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
else if( aSrcBuf.mnBitCount <= 8 )
{
const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
- const sal_uInt16 nCols = std::min((sal_uLong)rColMap.GetUsed(),
+ const sal_uInt16 nCols = std::min(static_cast<sal_uLong>(rColMap.GetUsed()),
sal_uLong(1) << nDrawableDepth);
rPal.SetEntryCount( nCols );
@@ -538,8 +538,8 @@ XImage* X11SalBitmap::ImplCreateXImage(
else if( pImage->depth <= 8 )
{
const SalColormap& rColMap = pSalDisp->GetColormap( nScreen );
- const sal_uInt16 nCols = std::min( (sal_uLong)rColMap.GetUsed()
- , (sal_uLong)(1 << pImage->depth)
+ const sal_uInt16 nCols = std::min( static_cast<sal_uLong>(rColMap.GetUsed())
+ , static_cast<sal_uLong>(1 << pImage->depth)
);
xPal.reset(new BitmapPalette( nCols ));
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index e506cd8a0d23..09367e1e8a25 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -128,8 +128,8 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, long &nD
break;
nScreen++;
}
- nDX_ = (long)w;
- nDY_ = (long)h;
+ nDX_ = static_cast<long>(w);
+ nDY_ = static_cast<long>(h);
nDX = nDX_;
nDY = nDY_;
m_nXScreen = SalX11Screen( nScreen );
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 863867ef7a20..cde05411a659 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -398,7 +398,7 @@ FreetypeFont::FreetypeFont( const FontSelectPattern& rFSD, FreetypeFontInfo* pFI
mnWidth = rFSD.mnWidth;
if( !mnWidth )
mnWidth = rFSD.mnHeight;
- mfStretch = (double)mnWidth / rFSD.mnHeight;
+ mfStretch = static_cast<double>(mnWidth) / rFSD.mnHeight;
// sanity check (e.g. #i66394#, #i66244#, #66537#)
if( (mnWidth < 0) || (mfStretch > +64.0) || (mfStretch < -64.0) )
return;
@@ -586,12 +586,12 @@ void FreetypeFont::ApplyGlyphTransform(bool bVertical, FT_Glyph pGlyphFT ) const
{
// left
bStretched = (mfStretch != 1.0);
- aVector.x = (FT_Pos)(+rMetrics.descender * mfStretch);
+ aVector.x = static_cast<FT_Pos>(+rMetrics.descender * mfStretch);
aVector.y = -rMetrics.ascender;
- aMatrix.xx = (FT_Pos)(-mnSin / mfStretch);
- aMatrix.yy = (FT_Pos)(-mnSin * mfStretch);
- aMatrix.xy = (FT_Pos)(-mnCos * mfStretch);
- aMatrix.yx = (FT_Pos)(+mnCos / mfStretch);
+ aMatrix.xx = static_cast<FT_Pos>(-mnSin / mfStretch);
+ aMatrix.yy = static_cast<FT_Pos>(-mnSin * mfStretch);
+ aMatrix.xy = static_cast<FT_Pos>(-mnCos * mfStretch);
+ aMatrix.yx = static_cast<FT_Pos>(+mnCos / mfStretch);
}
if( pGlyphFT->format != FT_GLYPH_FORMAT_BITMAP )
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index 46b785c85328..aaff8d36535f 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -92,7 +92,7 @@ size_t GlyphCache::IFSD_Hash::operator()( const FontSelectPattern& rFontSelData
nHash += size_t(rFontSelData.mbVertical);
nHash += rFontSelData.GetItalic();
nHash += rFontSelData.GetWeight();
- nHash += (sal_uInt16)rFontSelData.meLanguage;
+ nHash += static_cast<sal_uInt16>(rFontSelData.meLanguage);
return nHash;
}
diff --git a/vcl/unx/generic/print/bitmap_gfx.cxx b/vcl/unx/generic/print/bitmap_gfx.cxx
index 7fff8756b3c1..b906345bafc0 100644
--- a/vcl/unx/generic/print/bitmap_gfx.cxx
+++ b/vcl/unx/generic/print/bitmap_gfx.cxx
@@ -313,7 +313,7 @@ LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
mpTable[i].mpBrother = nullptr;
mpTable[i].mpFirstChild = nullptr;
mpTable[i].mnCode = i;
- mpTable[i].mnValue = (sal_uInt8)mpTable[i].mnCode;
+ mpTable[i].mnValue = static_cast<sal_uInt8>(mpTable[i].mnCode);
}
mpPrefix = nullptr;
@@ -336,12 +336,12 @@ LZWEncoder::WriteBits (sal_uInt16 nCode, sal_uInt16 nCodeLen)
mnOffset -= nCodeLen;
while (mnOffset < 24)
{
- WriteAscii ((sal_uInt8)(mdwShift >> 24));
+ WriteAscii (static_cast<sal_uInt8>(mdwShift >> 24));
mdwShift <<= 8;
mnOffset += 8;
}
if (nCode == 257 && mnOffset != 32)
- WriteAscii ((sal_uInt8)(mdwShift >> 24));
+ WriteAscii (static_cast<sal_uInt8>(mdwShift >> 24));
}
void
@@ -384,7 +384,7 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
}
else
{
- if(mnTableSize == (sal_uInt16)((1 << mnCodeSize) - 1))
+ if(mnTableSize == static_cast<sal_uInt16>((1 << mnCodeSize) - 1))
mnCodeSize++;
p = mpTable.data() + (mnTableSize++);
@@ -409,15 +409,15 @@ void
PrinterGfx::DrawBitmap (const tools::Rectangle& rDest, const tools::Rectangle& rSrc,
const PrinterBmp& rBitmap)
{
- double fScaleX = (double)rDest.GetWidth();
- double fScaleY = (double)rDest.GetHeight();
+ double fScaleX = static_cast<double>(rDest.GetWidth());
+ double fScaleY = static_cast<double>(rDest.GetHeight());
if(rSrc.GetWidth() > 0)
{
- fScaleX = (double)rDest.GetWidth() / (double)rSrc.GetWidth();
+ fScaleX = static_cast<double>(rDest.GetWidth()) / static_cast<double>(rSrc.GetWidth());
}
if(rSrc.GetHeight() > 0)
{
- fScaleY = (double)rDest.GetHeight() / (double)rSrc.GetHeight();
+ fScaleY = static_cast<double>(rDest.GetHeight()) / static_cast<double>(rSrc.GetHeight());
}
PSGSave ();
PSTranslate (rDest.BottomLeft());
diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx
index 887c4370d356..b0bad19cc41b 100644
--- a/vcl/unx/generic/print/common_gfx.cxx
+++ b/vcl/unx/generic/print/common_gfx.cxx
@@ -75,8 +75,8 @@ PrinterGfx::Init (const JobData& rData)
mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice != -1 ) : ( rData.m_pParser == nullptr || rData.m_pParser->isColorDevice() );
int nRes = rData.m_aContext.getRenderResolution();
mnDpi = nRes;
- mfScaleX = 72.0 / (double)mnDpi;
- mfScaleY = 72.0 / (double)mnDpi;
+ mfScaleX = 72.0 / static_cast<double>(mnDpi);
+ mfScaleY = 72.0 / static_cast<double>(mnDpi);
const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rData.m_aPrinterName ) );
mbUploadPS42Fonts = rInfo.m_pParser && rInfo.m_pParser->isType42Capable();
}
@@ -226,7 +226,7 @@ PrinterGfx::JoinVerticalClipRectangles( std::list< tools::Rectangle >::iterator&
nNewDX = aPoint.X() - aLastPoint.X();
nNewDY = aPoint.Y() - aLastPoint.Y();
if( nNewDX != 0 &&
- (double)nNewDY/(double)nNewDX == (double)nDY/(double)nDX )
+ static_cast<double>(nNewDY)/static_cast<double>(nNewDX) == double(nDY)/double(nDX) )
continue;
}
PSBinLineTo (aPoint, rOldPoint, rColumn);
@@ -245,7 +245,7 @@ PrinterGfx::JoinVerticalClipRectangles( std::list< tools::Rectangle >::iterator&
nNewDX = aPoint.X() - aLastPoint.X();
nNewDY = aPoint.Y() - aLastPoint.Y();
if( nNewDX != 0 &&
- (double)nNewDY/(double)nNewDX == (double)nDY/(double)nDX )
+ static_cast<double>(nNewDY)/static_cast<double>(nNewDX) == double(nDY)/double(nDX) )
continue;
}
PSBinLineTo (aPoint, rOldPoint, rColumn);
@@ -696,20 +696,20 @@ PrinterGfx::PSSetColor ()
if( mbColor )
{
nChar = psp::getValueOfDouble (pBuffer,
- (double)rColor.GetRed() / 255.0, 5);
+ static_cast<double>(rColor.GetRed()) / 255.0, 5);
nChar += psp::appendStr (" ", pBuffer + nChar);
nChar += psp::getValueOfDouble (pBuffer + nChar,
- (double)rColor.GetGreen() / 255.0, 5);
+ static_cast<double>(rColor.GetGreen()) / 255.0, 5);
nChar += psp::appendStr (" ", pBuffer + nChar);
nChar += psp::getValueOfDouble (pBuffer + nChar,
- (double)rColor.GetBlue() / 255.0, 5);
+ static_cast<double>(rColor.GetBlue()) / 255.0, 5);
nChar += psp::appendStr (" setrgbcolor\n", pBuffer + nChar );
}
else
{
Color aColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() );
sal_uInt8 nCol = aColor.GetLuminance();
- nChar = psp::getValueOfDouble( pBuffer, (double)nCol / 255.0, 5 );
+ nChar = psp::getValueOfDouble( pBuffer, static_cast<double>(nCol) / 255.0, 5 );
nChar += psp::appendStr( " setgray\n", pBuffer + nChar );
}
@@ -784,7 +784,7 @@ PrinterGfx::PSSetFont ()
nChar += psp::appendStr ( " [", pSetFont + nChar);
nChar += psp::getValueOf (nTextWidth, pSetFont + nChar);
nChar += psp::appendStr (" 0 ", pSetFont + nChar);
- nChar += psp::getValueOfDouble (pSetFont + nChar, 0.27*(double)nTextWidth, 3 );
+ nChar += psp::getValueOfDouble (pSetFont + nChar, 0.27*static_cast<double>(nTextWidth), 3 );
nChar += psp::appendStr ( " ", pSetFont + nChar);
nChar += psp::getValueOf (-nTextHeight, pSetFont + nChar);
@@ -929,7 +929,7 @@ PrinterGfx::PSBinPath (const Point& rCurrent, Point& rOld,
// build the command, it is a char with bit represention 000cxxyy
// c represents the char, xx and yy repr. the field width of the dx and dy shift,
// dx and dy represent the number of bytes to read after the opcode
- sal_Char cCmd = (eType == lineto ? (sal_Char)0x00 : (sal_Char)0x10);
+ sal_Char cCmd = (eType == lineto ? sal_Char(0x00) : sal_Char(0x10));
switch (nYPrec)
{
case 2: break;
@@ -1002,7 +1002,7 @@ PrinterGfx::PSHexString (const unsigned char* pString, sal_Int16 nLen)
WritePS (mpPageBody, pHexString, nChar);
nChar = 0;
}
- nChar += psp::getHexValueOf ((sal_Int32)pString[i], pHexString + nChar);
+ nChar += psp::getHexValueOf (static_cast<sal_Int32>(pString[i]), pHexString + nChar);
}
nChar += psp::appendStr (">\n", pHexString + nChar);
@@ -1030,7 +1030,7 @@ PrinterGfx::PSShowGlyph (const unsigned char nGlyphId)
nLW = maVirtualStatus.mnTextHeight;
else
nLW = nLW < maVirtualStatus.mnTextHeight ? nLW : maVirtualStatus.mnTextHeight;
- psp::getValueOfDouble( pBuffer, (double)nLW / 30.0 );
+ psp::getValueOfDouble( pBuffer, static_cast<double>(nLW) / 30.0 );
}
// dispatch to the drawing method
@@ -1107,10 +1107,10 @@ PrinterGfx::DrawEPS( const tools::Rectangle& rBoundingBox, void* pPtr, sal_uInt3
if( fLeft != fRight && fTop != fBottom )
{
- double fScaleX = (double)rBoundingBox.GetWidth()/(fRight-fLeft);
- double fScaleY = -(double)rBoundingBox.GetHeight()/(fTop-fBottom);
- Point aTranslatePoint( (int)(rBoundingBox.Left()-fLeft*fScaleX),
- (int)(rBoundingBox.Bottom()+1-fBottom*fScaleY) );
+ double fScaleX = static_cast<double>(rBoundingBox.GetWidth())/(fRight-fLeft);
+ double fScaleY = -static_cast<double>(rBoundingBox.GetHeight())/(fTop-fBottom);
+ Point aTranslatePoint( static_cast<int>(rBoundingBox.Left()-fLeft*fScaleX),
+ static_cast<int>(rBoundingBox.Bottom()+1-fBottom*fScaleY) );
// prepare EPS
WritePS( mpPageBody,
"/b4_Inc_state save def\n"
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 63013b1188b4..77abd94f6cbf 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -147,9 +147,9 @@ namespace
}
}
-inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778)+0.5); }
+inline int PtTo10Mu( int nPoints ) { return static_cast<int>((static_cast<double>(nPoints)*35.27777778)+0.5); }
-inline int TenMuToPt( int nUnits ) { return (int)((((double)nUnits)/35.27777778)+0.5); }
+inline int TenMuToPt( int nUnits ) { return static_cast<int>((static_cast<double>(nUnits)/35.27777778)+0.5); }
static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
{
@@ -764,7 +764,7 @@ OUString PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_
if( aData.m_pParser )
{
const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( OUString("InputSlot") ): nullptr;
- if( ! pKey || nPaperBin >= (sal_uInt16)pKey->countValues() )
+ if( ! pKey || nPaperBin >= static_cast<sal_uInt16>(pKey->countValues()) )
aRet = aData.m_pParser->getDefaultInputSlot();
else
{
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 7d52960f12b0..d53d68756aa9 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -631,9 +631,9 @@ void GenPspGraphics::SetFont( const FontSelectPattern *pEntry, int nFallbackLeve
if( eItalic != ITALIC_NORMAL && eItalic != ITALIC_OBLIQUE )
bArtItalic = true;
}
- int nWeight = (int)pEntry->GetWeight();
- int nRealWeight = (int)m_pPrinterGfx->GetFontMgr().getFontWeight( nID );
- if( nRealWeight <= (int)WEIGHT_MEDIUM && nWeight > (int)WEIGHT_MEDIUM )
+ int nWeight = static_cast<int>(pEntry->GetWeight());
+ int nRealWeight = static_cast<int>(m_pPrinterGfx->GetFontMgr().getFontWeight( nID ));
+ if( nRealWeight <= int(WEIGHT_MEDIUM) && nWeight > int(WEIGHT_MEDIUM) )
{
bArtBold = true;
}
diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx
index d1eac841c92c..76ed433834d3 100644
--- a/vcl/unx/generic/print/printerjob.cxx
+++ b/vcl/unx/generic/print/printerjob.cxx
@@ -418,15 +418,15 @@ PrinterJob::EndJob()
OStringBuffer aTrailer(512);
aTrailer.append( "%%Trailer\n" );
aTrailer.append( "%%BoundingBox: 0 0 " );
- aTrailer.append( (sal_Int32)mnMaxWidthPt );
+ aTrailer.append( static_cast<sal_Int32>(mnMaxWidthPt) );
aTrailer.append( " " );
- aTrailer.append( (sal_Int32)mnMaxHeightPt );
+ aTrailer.append( static_cast<sal_Int32>(mnMaxHeightPt) );
if( mnLandscapes > mnPortraits )
aTrailer.append("\n%%Orientation: Landscape");
else
aTrailer.append("\n%%Orientation: Portrait");
aTrailer.append( "\n%%Pages: " );
- aTrailer.append( (sal_Int32)maPageVector.size() );
+ aTrailer.append( static_cast<sal_Int32>(maPageVector.size()) );
aTrailer.append( "\n%%EOF\n" );
WritePS (mpJobTrailer, aTrailer.getStr());
@@ -561,8 +561,8 @@ PrinterJob::InitPaperSize (const JobData& rJobSetup)
mnTMarginPt = nUpper;
mnBMarginPt = nLower;
- mfXScale = 72.0 / (double)mnResolution;
- mfYScale = -1.0 * 72.0 / (double)mnResolution;
+ mfXScale = 72.0 / static_cast<double>(mnResolution);
+ mfYScale = -1.0 * 72.0 / static_cast<double>(mnResolution);
}
void
@@ -570,7 +570,7 @@ PrinterJob::StartPage (const JobData& rJobSetup)
{
InitPaperSize (rJobSetup);
- OUString aPageNo = OUString::number ((sal_Int32)maPageVector.size()+1); // sequential page number must start with 1
+ OUString aPageNo = OUString::number (static_cast<sal_Int32>(maPageVector.size())+1); // sequential page number must start with 1
OUString aExt = aPageNo + ".ps";
osl::File* pPageHeader = CreateSpoolFile ( "psp_pghead", aExt);
@@ -689,7 +689,7 @@ static bool writeFeature( osl::File* pFile, const PPDKey* pKey, const PPDValue*
aFeature.append( "\n} stopped cleartomark\n" );
sal_uInt64 nWritten = 0;
return !(pFile->write( aFeature.getStr(), aFeature.getLength(), nWritten )
- || nWritten != (sal_uInt64)aFeature.getLength());
+ || nWritten != static_cast<sal_uInt64>(aFeature.getLength()));
}
bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool bDocumentSetup )
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index fc62e0590988..8611141b424b 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -72,9 +72,9 @@ namespace psp
{
size_t operator()(const css::lang::Locale& rLocale) const
{ return
- (size_t)rLocale.Language.hashCode()
- ^ (size_t)rLocale.Country.hashCode()
- ^ (size_t)rLocale.Variant.hashCode()
+ static_cast<size_t>(rLocale.Language.hashCode())
+ ^ static_cast<size_t>(rLocale.Country.hashCode())
+ ^ static_cast<size_t>(rLocale.Variant.hashCode())
;
}
};
@@ -896,7 +896,7 @@ void PPDParser::insertKey( const OUString& rKey, PPDKey* pKey )
const PPDKey* PPDParser::getKey( int n ) const
{
- return ((unsigned int)n < m_aOrderedKeys.size() && n >= 0) ? m_aOrderedKeys[n] : nullptr;
+ return (static_cast<unsigned int>(n) < m_aOrderedKeys.size() && n >= 0) ? m_aOrderedKeys[n] : nullptr;
}
const PPDKey* PPDParser::getKey( const OUString& rKey ) const
@@ -1442,10 +1442,10 @@ bool PPDParser::getMargins(
aArea = m_pPaperDimensions->getValue( nPDim )->m_aValue;
PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) );
PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) );
- rLeft = (int)(ImLLx + 0.5);
- rLower = (int)(ImLLy + 0.5);
- rUpper = (int)(PDHeight - ImURy + 0.5);
- rRight = (int)(PDWidth - ImURx + 0.5);
+ rLeft = static_cast<int>(ImLLx + 0.5);
+ rLower = static_cast<int>(ImLLy + 0.5);
+ rUpper = static_cast<int>(PDHeight - ImURy + 0.5);
+ rRight = static_cast<int>(PDWidth - ImURx + 0.5);
return true;
}
@@ -1468,8 +1468,8 @@ bool PPDParser::getPaperDimension(
OUString aArea = m_pPaperDimensions->getValue( nPDim )->m_aValue;
PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) );
PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) );
- rHeight = (int)(PDHeight + 0.5);
- rWidth = (int)(PDWidth + 0.5);
+ rHeight = static_cast<int>(PDHeight + 0.5);
+ rWidth = static_cast<int>(PDWidth + 0.5);
return true;
}
@@ -1487,8 +1487,8 @@ OUString PPDParser::matchPaper( int nWidth, int nHeight ) const
OUString aArea = m_pPaperDimensions->getValue( i )->m_aValue;
double PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) );
double PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) );
- PDWidth /= (double)nWidth;
- PDHeight /= (double)nHeight;
+ PDWidth /= static_cast<double>(nWidth);
+ PDHeight /= static_cast<double>(nHeight);
if( PDWidth >= 0.9 && PDWidth <= 1.1 &&
PDHeight >= 0.9 && PDHeight <= 1.1 )
{
@@ -1596,7 +1596,7 @@ PPDKey::~PPDKey()
const PPDValue* PPDKey::getValue( int n ) const
{
- return ((unsigned int)n < m_aOrderedValues.size() && n >= 0) ? m_aOrderedValues[n] : nullptr;
+ return (static_cast<unsigned int>(n) < m_aOrderedValues.size() && n >= 0) ? m_aOrderedValues[n] : nullptr;
}
const PPDValue* PPDKey::getValue( const OUString& rOption ) const
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 8d489cbe46c9..5833463f354a 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -548,8 +548,8 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen
const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() );
x = rGeom.nX;
y = rGeom.nY;
- if( x+(int)w+40 <= (int)aScreenSize.Width() &&
- y+(int)h+40 <= (int)aScreenSize.Height()
+ if( x+static_cast<int>(w)+40 <= static_cast<int>(aScreenSize.Width()) &&
+ y+static_cast<int>(h)+40 <= static_cast<int>(aScreenSize.Height())
)
{
y += 40;
@@ -1301,8 +1301,8 @@ void X11SalFrame::Show( bool bVisible, bool bNoActivate )
if( maGeometry.nWidth > 0
&& maGeometry.nHeight > 0
- && ( nWidth_ != (int)maGeometry.nWidth
- || nHeight_ != (int)maGeometry.nHeight ) )
+ && ( nWidth_ != static_cast<int>(maGeometry.nWidth)
+ || nHeight_ != static_cast<int>(maGeometry.nHeight) ) )
{
nWidth_ = maGeometry.nWidth;
nHeight_ = maGeometry.nHeight;
@@ -1569,15 +1569,15 @@ void X11SalFrame::Center( )
else
{
// center the window relative to the top level frame
- nX = (nScreenWidth - (int)maGeometry.nWidth ) / 2 + nScreenX;
- nY = (nScreenHeight - (int)maGeometry.nHeight) / 2 + nScreenY;
+ nX = (nScreenWidth - static_cast<int>(maGeometry.nWidth) ) / 2 + nScreenX;
+ nY = (nScreenHeight - static_cast<int>(maGeometry.nHeight)) / 2 + nScreenY;
}
}
else
{
// center the window relative to screen
- nX = (nRealScreenWidth - (int)maGeometry.nWidth ) / 2 + nScreenX;
- nY = (nRealScreenHeight - (int)maGeometry.nHeight) / 2 + nScreenY;
+ nX = (nRealScreenWidth - static_cast<int>(maGeometry.nWidth) ) / 2 + nScreenX;
+ nY = (nRealScreenHeight - static_cast<int>(maGeometry.nHeight)) / 2 + nScreenY;
}
nX = nX < 0 ? 0 : nX;
nY = nY < 0 ? 0 : nY;
@@ -1773,14 +1773,14 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
}
// adjust position so that frame fits onto screen
- if( aPosSize.Right()+(long)aGeom.nRightDecoration > aScreenSize.Width()-1 )
- aPosSize.Move( aScreenSize.Width() - aPosSize.Right() - (long)aGeom.nRightDecoration, 0 );
- if( aPosSize.Bottom()+(long)aGeom.nBottomDecoration > aScreenSize.Height()-1 )
- aPosSize.Move( 0, aScreenSize.Height() - aPosSize.Bottom() - (long)aGeom.nBottomDecoration );
- if( aPosSize.Left() < (long)aGeom.nLeftDecoration )
- aPosSize.Move( (long)aGeom.nLeftDecoration - aPosSize.Left(), 0 );
- if( aPosSize.Top() < (long)aGeom.nTopDecoration )
- aPosSize.Move( 0, (long)aGeom.nTopDecoration - aPosSize.Top() );
+ if( aPosSize.Right()+static_cast<long>(aGeom.nRightDecoration) > aScreenSize.Width()-1 )
+ aPosSize.Move( aScreenSize.Width() - aPosSize.Right() - static_cast<long>(aGeom.nRightDecoration), 0 );
+ if( aPosSize.Bottom()+static_cast<long>(aGeom.nBottomDecoration) > aScreenSize.Height()-1 )
+ aPosSize.Move( 0, aScreenSize.Height() - aPosSize.Bottom() - static_cast<long>(aGeom.nBottomDecoration) );
+ if( aPosSize.Left() < static_cast<long>(aGeom.nLeftDecoration) )
+ aPosSize.Move( static_cast<long>(aGeom.nLeftDecoration) - aPosSize.Left(), 0 );
+ if( aPosSize.Top() < static_cast<long>(aGeom.nTopDecoration) )
+ aPosSize.Move( 0, static_cast<long>(aGeom.nTopDecoration) - aPosSize.Top() );
}
SetPosSize( 0, 0, aPosSize.GetWidth(), aPosSize.GetHeight(), SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
@@ -1963,7 +1963,7 @@ void X11SalFrame::SetPosSize( const tools::Rectangle &rPosSize )
bool bSized = false;
if( values.x != maGeometry.nX || values.y != maGeometry.nY )
bMoved = true;
- if( values.width != (int)maGeometry.nWidth || values.height != (int)maGeometry.nHeight )
+ if( values.width != static_cast<int>(maGeometry.nWidth) || values.height != static_cast<int>(maGeometry.nHeight) )
bSized = true;
// do net set WMNormalHints for ..
@@ -2213,9 +2213,9 @@ void X11SalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen )
}
else
{
- if( nScreen < 0 || nScreen >= (int)GetDisplay()->GetXScreenCount() )
+ if( nScreen < 0 || nScreen >= static_cast<int>(GetDisplay()->GetXScreenCount()) )
nScreen = m_nXScreen.getXScreen();
- if( nScreen != (int)m_nXScreen.getXScreen() )
+ if( nScreen != static_cast<int>(m_nXScreen.getXScreen()) )
{
bool bVisible = bMapped_;
if( mbFullScreen )
@@ -2689,8 +2689,8 @@ bool X11SalFrame::HandleMouseEvent( XEvent *pEvent )
if( nVisibleFloats > 0 && mpParent )
{
Cursor aCursor = mpParent->GetCursor();
- if( pEvent->xmotion.x >= 0 && pEvent->xmotion.x < (int)maGeometry.nWidth &&
- pEvent->xmotion.y >= 0 && pEvent->xmotion.y < (int)maGeometry.nHeight )
+ if( pEvent->xmotion.x >= 0 && pEvent->xmotion.x < static_cast<int>(maGeometry.nWidth) &&
+ pEvent->xmotion.y >= 0 && pEvent->xmotion.y < static_cast<int>(maGeometry.nHeight) )
aCursor = None;
XChangeActivePointerGrab( GetXDisplay(),
@@ -2718,9 +2718,9 @@ bool X11SalFrame::HandleMouseEvent( XEvent *pEvent )
if( pFrame->IsFloatGrabWindow() &&
pFrame->bMapped_ &&
pEvent->xbutton.x_root >= pFrame->maGeometry.nX &&
- pEvent->xbutton.x_root < pFrame->maGeometry.nX + (int)pFrame->maGeometry.nWidth &&
+ pEvent->xbutton.x_root < pFrame->maGeometry.nX + static_cast<int>(pFrame->maGeometry.nWidth) &&
pEvent->xbutton.y_root >= pFrame->maGeometry.nY &&
- pEvent->xbutton.y_root < pFrame->maGeometry.nY + (int)pFrame->maGeometry.nHeight )
+ pEvent->xbutton.y_root < pFrame->maGeometry.nY + static_cast<int>(pFrame->maGeometry.nHeight) )
{
bInside = true;
break;
@@ -3582,7 +3582,7 @@ bool X11SalFrame::HandleSizeEvent( XConfigureEvent *pEvent )
nHeight_ = pEvent->height;
bool bMoved = ( pEvent->x != maGeometry.nX || pEvent->y != maGeometry.nY );
- bool bSized = ( pEvent->width != (int)maGeometry.nWidth || pEvent->height != (int)maGeometry.nHeight );
+ bool bSized = ( pEvent->width != static_cast<int>(maGeometry.nWidth) || pEvent->height != static_cast<int>(maGeometry.nHeight) );
maGeometry.nX = pEvent->x;
maGeometry.nY = pEvent->y;
@@ -3849,18 +3849,18 @@ bool X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent )
}
else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) )
{
- if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) )
+ if( static_cast<Atom>(pEvent->data.l[0]) == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) )
rWMAdaptor.answerPing( this, pEvent );
else if( ! ( nStyle_ & SalFrameStyleFlags::PLUG )
&& ! (( nStyle_ & SalFrameStyleFlags::FLOAT ) && (nStyle_ & SalFrameStyleFlags::OWNERDRAWDECORATION))
)
{
- if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
+ if( static_cast<Atom>(pEvent->data.l[0]) == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
{
Close();
return true;
}
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
+ else if( static_cast<Atom>(pEvent->data.l[0]) == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
{
// do nothing, we set the input focus in ToTop() if necessary
#if OSL_DEBUG_LEVEL > 1
diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx
index 425bec45ec26..203c1d3bb794 100644
--- a/vcl/unx/generic/window/salobj.cxx
+++ b/vcl/unx/generic/window/salobj.cxx
@@ -62,7 +62,7 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p
SalDisplay* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData());
const SystemEnvData* pEnv = pParent->GetSystemData();
Display* pDisp = pSalDisp->GetDisplay();
- ::Window aObjectParent = (::Window)pEnv->aWindow;
+ ::Window aObjectParent = static_cast<::Window>(pEnv->aWindow);
// find out on which screen that window is
XWindowAttributes aParentAttr;
@@ -200,10 +200,10 @@ SalClipRegion::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
{
XRectangle& aRect = ClipRectangleList[numClipRectangles];
- aRect.x = (short) nX;
- aRect.y = (short) nY;
- aRect.width = (unsigned short) nWidth;
- aRect.height= (unsigned short) nHeight;
+ aRect.x = static_cast<short>(nX);
+ aRect.y = static_cast<short>(nY);
+ aRect.width = static_cast<unsigned short>(nWidth);
+ aRect.height= static_cast<unsigned short>(nHeight);
numClipRectangles++;
}
@@ -236,7 +236,7 @@ X11SalObject::~X11SalObject()
GetGenericUnixSalData()->ErrorTrapPush();
const SystemEnvData* pEnv = mpParent->GetSystemData();
- ::Window aObjectParent = (::Window)pEnv->aWindow;
+ ::Window aObjectParent = static_cast<::Window>(pEnv->aWindow);
XSetWindowBackgroundPixmap(static_cast<Display*>(maSystemChildData.pDisplay), aObjectParent, None);
if ( maSecondary )
XDestroyWindow( static_cast<Display*>(maSystemChildData.pDisplay), maSecondary );
@@ -468,7 +468,7 @@ void X11SalObject::SetLeaveEnterBackgrounds(const css::uno::Sequence<css::uno::A
SalDisplay* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData());
const SystemEnvData* pEnv = mpParent->GetSystemData();
Display* pDisp = pSalDisp->GetDisplay();
- ::Window aObjectParent = (::Window)pEnv->aWindow;
+ ::Window aObjectParent = static_cast<::Window>(pEnv->aWindow);
bool bFreePixmap = false;
Pixmap aPixmap = None;
diff --git a/vcl/unx/gtk/a11y/atkaction.cxx b/vcl/unx/gtk/a11y/atkaction.cxx
index ad8e3a789038..620e34d928aa 100644
--- a/vcl/unx/gtk/a11y/atkaction.cxx
+++ b/vcl/unx/gtk/a11y/atkaction.cxx
@@ -177,7 +177,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >&
rBuffer.append("<Alt>");
if( ( rKeyStrokes[i].KeyCode >= awt::Key::A ) && ( rKeyStrokes[i].KeyCode <= awt::Key::Z ) )
- rBuffer.append( (sal_Char) ( 'a' + ( rKeyStrokes[i].KeyCode - awt::Key::A ) ) );
+ rBuffer.append( static_cast<sal_Char>( 'a' + ( rKeyStrokes[i].KeyCode - awt::Key::A ) ) );
else
{
sal_Char c = '\0';
@@ -229,7 +229,7 @@ action_wrapper_get_keybinding (AtkAction *action,
{
OStringBuffer aRet;
- sal_Int32 nmax = std::min( xBinding->getAccessibleKeyBindingCount(), (sal_Int32) 3 );
+ sal_Int32 nmax = std::min( xBinding->getAccessibleKeyBindingCount(), sal_Int32(3) );
for( sal_Int32 n = 0; n < nmax; n++ )
{
appendKeyStrokes( aRet, xBinding->getAccessibleKeyBinding( n ) );
diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index 117b02b7e145..82f18a58a217 100644
--- a/vcl/unx/gtk/a11y/atklistener.cxx
+++ b/vcl/unx/gtk/a11y/atklistener.cxx
@@ -576,16 +576,16 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven
g_object_set_data( G_OBJECT(atk_obj), "ooo::text_changed::delete", &aDeletedText);
g_signal_emit_by_name( atk_obj, "text_changed::delete",
- (gint) aDeletedText.SegmentStart,
- (gint)( aDeletedText.SegmentEnd - aDeletedText.SegmentStart ) );
+ static_cast<gint>(aDeletedText.SegmentStart),
+ static_cast<gint>( aDeletedText.SegmentEnd - aDeletedText.SegmentStart ) );
g_object_steal_data( G_OBJECT(atk_obj), "ooo::text_changed::delete" );
}
if( aEvent.NewValue >>= aInsertedText )
g_signal_emit_by_name( atk_obj, "text_changed::insert",
- (gint) aInsertedText.SegmentStart,
- (gint)( aInsertedText.SegmentEnd - aInsertedText.SegmentStart ) );
+ static_cast<gint>(aInsertedText.SegmentStart),
+ static_cast<gint>( aInsertedText.SegmentEnd - aInsertedText.SegmentStart ) );
break;
}
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 840106a6d5db..a8c7c8e3cdae 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -174,7 +174,7 @@ static inline
double toPoint(sal_Int16 n)
{
// 100th mm -> pt
- return (double) (n * 72) / 2540;
+ return static_cast<double>(n * 72) / 2540;
}
/*****************************************************************************/
@@ -290,7 +290,7 @@ String2Color( uno::Any& rAny, const gchar * value )
if( 3 != sscanf( value, "%d,%d,%d", &red, &green, &blue ) )
return false;
- sal_Int32 nColor = (sal_Int32) blue | ( (sal_Int32) green << 8 ) | ( ( sal_Int32 ) red << 16 );
+ sal_Int32 nColor = static_cast<sal_Int32>(blue) | ( static_cast<sal_Int32>(green) << 8 ) | ( static_cast<sal_Int32>(red) << 16 );
rAny <<= nColor;
return true;
}
@@ -575,7 +575,7 @@ UnitString2CMM( uno::Any& rAny, const gchar * value )
fValue = fValue * 100;
- rAny <<= (sal_Int32) fValue;
+ rAny <<= static_cast<sal_Int32>(fValue);
return true;
}
@@ -615,7 +615,7 @@ String2Bool( uno::Any& rAny, const gchar * value )
static gchar*
Scale2String( const uno::Any& rAny )
{
- return g_strdup_printf( "%g", (double) (rAny.get< sal_Int16 > ()) / 100 );
+ return g_strdup_printf( "%g", static_cast<double>(rAny.get< sal_Int16 > ()) / 100 );
}
static bool
@@ -626,7 +626,7 @@ String2Scale( uno::Any& rAny, const gchar * value )
if( 1 != sscanf( value, "%lg", &dval ) )
return false;
- rAny <<= (sal_Int16) (dval * 100);
+ rAny <<= static_cast<sal_Int16>(dval * 100);
return true;
}
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index 5b7e89bd78af..7ad94e9d443a 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -485,7 +485,7 @@ static void create_wrapper_for_child(
static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent)
{
vcl::Window* pWindow = pEvent->GetWindow();
- sal_Int32 index = (sal_Int32)reinterpret_cast<sal_IntPtr>(pEvent->GetData());
+ sal_Int32 index = static_cast<sal_Int32>(reinterpret_cast<sal_IntPtr>(pEvent->GetData()));
if( pWindow && pWindow->IsReallyVisible() )
{
diff --git a/vcl/unx/gtk/glomenu.cxx b/vcl/unx/gtk/glomenu.cxx
index 2547c36c1649..06dadee7c59d 100644
--- a/vcl/unx/gtk/glomenu.cxx
+++ b/vcl/unx/gtk/glomenu.cxx
@@ -106,7 +106,7 @@ gint
g_lo_menu_get_n_items_from_section (GLOMenu *menu,
gint section)
{
- g_return_val_if_fail (0 <= section && section < (gint) menu->items->len, 0);
+ g_return_val_if_fail (0 <= section && section < static_cast<gint>(menu->items->len), 0);
GLOMenu *model = g_lo_menu_get_section (menu, section);
@@ -152,7 +152,7 @@ g_lo_menu_insert_in_section (GLOMenu *menu,
const gchar *label)
{
g_return_if_fail (G_IS_LO_MENU (menu));
- g_return_if_fail (0 <= section && section < (gint) menu->items->len);
+ g_return_if_fail (0 <= section && section < static_cast<gint>(menu->items->len));
GLOMenu *model = g_lo_menu_get_section (menu, section);
@@ -179,7 +179,7 @@ g_lo_menu_set_attribute_value (GLOMenu *menu,
g_return_if_fail (attribute != nullptr);
g_return_if_fail (valid_attribute_name (attribute));
- if (position >= (gint) menu->items->len)
+ if (position >= static_cast<gint>(menu->items->len))
return;
struct item menu_item = g_array_index (menu->items, struct item, position);
@@ -478,7 +478,7 @@ g_lo_menu_set_link (GLOMenu *menu,
g_return_if_fail (link != nullptr);
g_return_if_fail (valid_attribute_name (link));
- if (position < 0 || position >= (gint) menu->items->len)
+ if (position < 0 || position >= static_cast<gint>(menu->items->len))
position = menu->items->len - 1;
struct item menu_item = g_array_index (menu->items, struct item, position);
@@ -497,7 +497,7 @@ g_lo_menu_insert_section (GLOMenu *menu,
{
g_return_if_fail (G_IS_LO_MENU (menu));
- if (position < 0 || position > (gint) menu->items->len)
+ if (position < 0 || position > static_cast<gint>(menu->items->len))
position = menu->items->len;
struct item menu_item;
@@ -540,13 +540,13 @@ g_lo_menu_new_submenu_in_item_in_section (GLOMenu *menu,
gint position)
{
g_return_if_fail (G_IS_LO_MENU (menu));
- g_return_if_fail (0 <= section && section < (gint) menu->items->len);
+ g_return_if_fail (0 <= section && section < static_cast<gint>(menu->items->len));
GLOMenu* model = g_lo_menu_get_section (menu, section);
g_return_if_fail (model != nullptr);
- if (0 <= position && position < (gint) model->items->len) {
+ if (0 <= position && position < static_cast<gint>(model->items->len)) {
GMenuModel* submenu = G_MENU_MODEL (g_lo_menu_new());
g_lo_menu_set_link (model, position, G_MENU_LINK_SUBMENU, submenu);
@@ -565,7 +565,7 @@ g_lo_menu_get_submenu_from_item_in_section (GLOMenu *menu,
gint position)
{
g_return_val_if_fail (G_IS_LO_MENU (menu), nullptr);
- g_return_val_if_fail (0 <= section && section < (gint) menu->items->len, nullptr);
+ g_return_val_if_fail (0 <= section && section < static_cast<gint>(menu->items->len), nullptr);
GLOMenu *model = g_lo_menu_get_section (menu, section);
@@ -573,7 +573,7 @@ g_lo_menu_get_submenu_from_item_in_section (GLOMenu *menu,
GLOMenu *submenu = nullptr;
- if (0 <= position && position < (gint) model->items->len)
+ if (0 <= position && position < static_cast<gint>(model->items->len))
submenu = G_LO_MENU (G_MENU_MODEL_CLASS (g_lo_menu_parent_class)
->get_item_link (G_MENU_MODEL (model), position, G_MENU_LINK_SUBMENU));
//submenu = g_menu_model_get_item_link (G_MENU_MODEL (model), position, G_MENU_LINK_SUBMENU);
@@ -624,7 +624,7 @@ g_lo_menu_remove (GLOMenu *menu,
gint position)
{
g_return_if_fail (G_IS_LO_MENU (menu));
- g_return_if_fail (0 <= position && position < (gint) menu->items->len);
+ g_return_if_fail (0 <= position && position < static_cast<gint>(menu->items->len));
g_lo_menu_clear_item (&g_array_index (menu->items, struct item, position));
g_array_remove_index (menu->items, position);
@@ -637,7 +637,7 @@ g_lo_menu_remove_from_section (GLOMenu *menu,
gint position)
{
g_return_if_fail (G_IS_LO_MENU (menu));
- g_return_if_fail (0 <= section && section < (gint) menu->items->len);
+ g_return_if_fail (0 <= section && section < static_cast<gint>(menu->items->len));
GLOMenu *model = g_lo_menu_get_section (menu, section);
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index c6f5925da80f..7c9a3d1e0fbc 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -683,7 +683,7 @@ extern "C" {
nDeltaSec -= 1;
}
// if the clock changes backwards we need to cope ...
- if( (unsigned long) nDeltaSec > 1 + ( pTSource->pInstance->m_nTimeoutMS / 1000 ) )
+ if( static_cast<unsigned long>(nDeltaSec) > 1 + ( pTSource->pInstance->m_nTimeoutMS / 1000 ) )
{
sal_gtk_timeout_defer( pTSource );
return TRUE;
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index 4b840923a971..959e387633ec 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -67,7 +67,7 @@ extern "C"
if( gtk_major_version < 2 || // very unlikely sanity check
( gtk_major_version == 2 && gtk_minor_version < 4 ) )
{
- g_warning("require a newer gtk than %d.%d for gdk_threads_set_lock_functions", (int) gtk_major_version, gtk_minor_version);
+ g_warning("require a newer gtk than %d.%d for gdk_threads_set_lock_functions", static_cast<int>(gtk_major_version), gtk_minor_version);
return nullptr;
}
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index a55f582ab921..96618d1c0af1 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -1322,7 +1322,7 @@ void GtkSalFrame::Init( SystemParentData* pSysData )
{
XReparentWindow( getDisplay()->GetDisplay(),
widget_get_xid(m_pWindow),
- (::Window)pSysData->aWindow,
+ static_cast<::Window>(pSysData->aWindow),
0, 0 );
}
}
@@ -1432,8 +1432,8 @@ void GtkSalFrame::Center()
if( m_pParent )
{
- nX = ((long)m_pParent->maGeometry.nWidth - (long)maGeometry.nWidth)/2;
- nY = ((long)m_pParent->maGeometry.nHeight - (long)maGeometry.nHeight)/2;
+ nX = (static_cast<long>(m_pParent->maGeometry.nWidth) - static_cast<long>(maGeometry.nWidth))/2;
+ nY = (static_cast<long>(m_pParent->maGeometry.nHeight) - static_cast<long>(maGeometry.nHeight))/2;
}
else
{
@@ -1450,8 +1450,8 @@ void GtkSalFrame::Center()
GdkRectangle aMonitor;
gdk_screen_get_monitor_geometry( pScreen, nMonitor, &aMonitor );
- nX = aMonitor.x + (aMonitor.width - (long)maGeometry.nWidth)/2;
- nY = aMonitor.y + (aMonitor.height - (long)maGeometry.nHeight)/2;
+ nX = aMonitor.x + (aMonitor.width - static_cast<long>(maGeometry.nWidth))/2;
+ nY = aMonitor.y + (aMonitor.height - static_cast<long>(maGeometry.nHeight))/2;
}
SetPosSize( nX, nY, 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y );
}
@@ -1694,7 +1694,7 @@ void GtkSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u
{
m_bDefaultSize = false;
- if( (unsigned long)nWidth != maGeometry.nWidth || (unsigned long)nHeight != maGeometry.nHeight )
+ if( static_cast<unsigned long>(nWidth) != maGeometry.nWidth || static_cast<unsigned long>(nHeight) != maGeometry.nHeight )
bSized = true;
maGeometry.nWidth = nWidth;
maGeometry.nHeight = nHeight;
@@ -1894,7 +1894,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect
GdkScreen *pScreen = nullptr;
GdkRectangle aNewMonitor;
- bool bSpanAllScreens = nNewScreen == (unsigned int)-1;
+ bool bSpanAllScreens = nNewScreen == static_cast<unsigned int>(-1);
m_bSpanMonitorsWhenFullscreen = bSpanAllScreens && getDisplay()->getSystem()->GetDisplayScreenCount() > 1;
if (m_bSpanMonitorsWhenFullscreen) //span all screens
@@ -2477,7 +2477,7 @@ void GtkSalFrame::createNewWindow( ::Window aNewParent, bool bXEmbed, SalX11Scre
if( bWasVisible )
Show( false );
- if( (int)nXScreen.getXScreen() >= getDisplay()->GetXScreenCount() )
+ if( static_cast<int>(nXScreen.getXScreen()) >= getDisplay()->GetXScreenCount() )
nXScreen = m_nXScreen;
SystemParentData aParentData;
@@ -2708,8 +2708,8 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
default: return false;
}
aEvent.mnTime = pEvent->time;
- aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX;
- aEvent.mnY = (long)pEvent->y_root - pThis->maGeometry.nY;
+ aEvent.mnX = static_cast<long>(pEvent->x_root) - pThis->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(pEvent->y_root) - pThis->maGeometry.nY;
aEvent.mnCode = GetMouseModCode( pEvent->state );
bool bClosePopups = false;
@@ -2758,8 +2758,8 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
if( ! aDel.isDeleted() )
{
- int frame_x = (int)(pEvent->x_root - pEvent->x);
- int frame_y = (int)(pEvent->y_root - pEvent->y);
+ int frame_x = static_cast<int>(pEvent->x_root - pEvent->x);
+ int frame_y = static_cast<int>(pEvent->y_root - pEvent->y);
if( frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY )
{
pThis->maGeometry.nX = frame_x;
@@ -2789,8 +2789,8 @@ gboolean GtkSalFrame::signalScroll(GtkWidget*, GdkEvent* pInEvent, gpointer fram
bool bNeg = (rEvent.direction == GDK_SCROLL_DOWN || rEvent.direction == GDK_SCROLL_RIGHT );
SalWheelMouseEvent aEvent;
aEvent.mnTime = rEvent.time;
- aEvent.mnX = (sal_uLong)rEvent.x;
- aEvent.mnY = (sal_uLong)rEvent.y;
+ aEvent.mnX = static_cast<sal_uLong>(rEvent.x);
+ aEvent.mnY = static_cast<sal_uLong>(rEvent.y);
aEvent.mnDelta = bNeg ? -120 : 120;
aEvent.mnNotchDelta = bNeg ? -1 : 1;
aEvent.mnScrollLines = nLines;
@@ -2811,8 +2811,8 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
SalMouseEvent aEvent;
aEvent.mnTime = pEvent->time;
- aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX;
- aEvent.mnY = (long)pEvent->y_root - pThis->maGeometry.nY;
+ aEvent.mnX = static_cast<long>(pEvent->x_root) - pThis->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(pEvent->y_root) - pThis->maGeometry.nY;
aEvent.mnCode = GetMouseModCode( pEvent->state );
aEvent.mnButton = 0;
@@ -2825,8 +2825,8 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
if( ! aDel.isDeleted() )
{
- int frame_x = (int)(pEvent->x_root - pEvent->x);
- int frame_y = (int)(pEvent->y_root - pEvent->y);
+ int frame_x = static_cast<int>(pEvent->x_root - pEvent->x);
+ int frame_y = static_cast<int>(pEvent->y_root - pEvent->y);
if( frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY )
{
pThis->maGeometry.nX = frame_x;
@@ -2851,8 +2851,8 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpoi
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
SalMouseEvent aEvent;
aEvent.mnTime = pEvent->time;
- aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX;
- aEvent.mnY = (long)pEvent->y_root - pThis->maGeometry.nY;
+ aEvent.mnX = static_cast<long>(pEvent->x_root) - pThis->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(pEvent->y_root) - pThis->maGeometry.nY;
aEvent.mnCode = GetMouseModCode( pEvent->state );
aEvent.mnButton = 0;
@@ -2915,7 +2915,7 @@ gboolean GtkSalFrame::signalConfigure( GtkWidget*, GdkEventConfigure* pEvent, gp
*/
if( pThis->m_bFullscreen || (pThis->m_nStyle & (SalFrameStyleFlags::SIZEABLE | SalFrameStyleFlags::PLUG)) == SalFrameStyleFlags::SIZEABLE )
{
- if( pEvent->width != (int)pThis->maGeometry.nWidth || pEvent->height != (int)pThis->maGeometry.nHeight )
+ if( pEvent->width != static_cast<int>(pThis->maGeometry.nWidth) || pEvent->height != static_cast<int>(pThis->maGeometry.nHeight) )
{
bSized = true;
pThis->maGeometry.nWidth = pEvent->width;
@@ -3026,8 +3026,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget *pWidget, GdkEvent*, gpointer frame )
if (osl::FileBase::getSystemPathFromFileURL(sProgramURL, sProgram) == osl::File::E_None)
{
OString sFinalProgram(OUStringToOString(sProgram, osl_getThreadTextEncoding())
- + " " + OString::number((int)GDK_WINDOW_XID(gdkwin))
- + " " + OString::number((int)pThis->m_bSpanMonitorsWhenFullscreen));
+ + " " + OString::number(static_cast<int>(GDK_WINDOW_XID(gdkwin)))
+ + " " + OString::number(static_cast<int>(pThis->m_bSpanMonitorsWhenFullscreen)));
OString sDisplay(getDisplayString());
if (!sDisplay.isEmpty())
{
@@ -3641,7 +3641,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
pThis->m_aInputEvent.mnCursorPos = nCursorPos;
pThis->m_aInputEvent.mnCursorFlags = 0;
- pThis->m_aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, (int)pThis->m_aInputEvent.maText.getLength() ), ExtTextInputAttr::NONE );
+ pThis->m_aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, static_cast<int>(pThis->m_aInputEvent.maText.getLength()) ), ExtTextInputAttr::NONE );
PangoAttrIterator *iter = pango_attr_list_get_iterator(pAttrs);
do
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 4aaaacf14ec5..8fd2ea29636a 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -62,7 +62,7 @@ void RemoveSpareItemsFromNativeMenu( GLOMenu* pMenu, GList** pOldCommandList, un
{
sal_Int32 nSectionItems = g_lo_menu_get_n_items_from_section( pMenu, nSection );
- while ( nSectionItems > (sal_Int32) nValidItems )
+ while ( nSectionItems > static_cast<sal_Int32>(nValidItems) )
{
gchar* aCommand = g_lo_menu_get_command_from_item_in_section( pMenu, nSection, --nSectionItems );
@@ -247,7 +247,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
sal_Int32 validItems = 0;
sal_Int32 nItem;
- for ( nItem = 0; nItem < ( sal_Int32 ) GetItemCount(); nItem++ ) {
+ for ( nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++ ) {
if ( !IsItemVisible( nItem ) )
continue;
diff --git a/vcl/unx/gtk/gtksys.cxx b/vcl/unx/gtk/gtksys.cxx
index 928755f4dbe4..98411f2f039f 100644
--- a/vcl/unx/gtk/gtksys.cxx
+++ b/vcl/unx/gtk/gtksys.cxx
@@ -277,7 +277,7 @@ int GtkSalSystem::ShowNativeDialog (const OUString& rTitle, const OUString& rMes
GtkDialog *pDialog = GTK_DIALOG (
g_object_new (GTK_TYPE_MESSAGE_DIALOG,
"title", aTitle.getStr(),
- "message-type", (int)GTK_MESSAGE_WARNING,
+ "message-type", int(GTK_MESSAGE_WARNING),
"text", aMessage.getStr(),
nullptr));
int nButton = 0;
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 61aff29038ef..71bfcdff5d2e 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -2579,10 +2579,10 @@ bool GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable,
aEditBoxRect.SetPos( Point( x + buttonRect.GetWidth() , y ) );
#define ARROW_EXTENT 0.7
- arrowRect.SetSize( Size( (gint)(MIN_ARROW_SIZE * ARROW_EXTENT),
- (gint)(MIN_ARROW_SIZE * ARROW_EXTENT) ) );
- arrowRect.SetPos( Point( buttonRect.Left() + (gint)((buttonRect.GetWidth() - arrowRect.GetWidth()) / 2),
- buttonRect.Top() + (gint)((buttonRect.GetHeight() - arrowRect.GetHeight()) / 2) ) );
+ arrowRect.SetSize( Size( gint(MIN_ARROW_SIZE * ARROW_EXTENT),
+ gint(MIN_ARROW_SIZE * ARROW_EXTENT) ) );
+ arrowRect.SetPos( Point( buttonRect.Left() + static_cast<gint>((buttonRect.GetWidth() - arrowRect.GetWidth()) / 2),
+ buttonRect.Top() + static_cast<gint>((buttonRect.GetHeight() - arrowRect.GetHeight()) / 2) ) );
for( std::vector< tools::Rectangle >::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
{
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index 1c6e8e2c5e11..fd5b47f0b626 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -643,7 +643,7 @@ extern "C" {
nDeltaSec -= 1;
}
// if the clock changes backwards we need to cope ...
- if( (unsigned long) nDeltaSec > 1 + ( pTSource->pInstance->m_nTimeoutMS / 1000 ) )
+ if( static_cast<unsigned long>(nDeltaSec) > 1 + ( pTSource->pInstance->m_nTimeoutMS / 1000 ) )
{
sal_gtk_timeout_defer( pTSource );
return TRUE;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 43f4094ac5b3..d465fa01ef1b 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1800,7 +1800,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, tools::Rect
GdkScreen *pScreen = nullptr;
GdkRectangle aNewMonitor;
- bool bSpanAllScreens = nNewScreen == (unsigned int)-1;
+ bool bSpanAllScreens = nNewScreen == static_cast<unsigned int>(-1);
m_bSpanMonitorsWhenFullscreen = bSpanAllScreens && getDisplay()->getSystem()->GetDisplayScreenCount() > 1;
gint nMonitor = -1;
if (m_bSpanMonitorsWhenFullscreen) //span all screens
@@ -2595,8 +2595,8 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
if (!aDel.isDeleted())
{
- int frame_x = (int)(pEvent->x_root - pEvent->x);
- int frame_y = (int)(pEvent->y_root - pEvent->y);
+ int frame_x = static_cast<int>(pEvent->x_root - pEvent->x);
+ int frame_y = static_cast<int>(pEvent->y_root - pEvent->y);
if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY)
{
pThis->m_bGeometryIsProvisional = false;
@@ -2611,8 +2611,8 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
if (!aDel.isDeleted())
{
aEvent.mnTime = pEvent->time;
- aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX;
- aEvent.mnY = (long)pEvent->y_root - pThis->maGeometry.nY;
+ aEvent.mnX = static_cast<long>(pEvent->x_root) - pThis->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(pEvent->y_root) - pThis->maGeometry.nY;
aEvent.mnCode = GetMouseModCode( pEvent->state );
if( AllSettings::GetLayoutRTL() )
@@ -2648,11 +2648,11 @@ IMPL_LINK_NOARG(GtkSalFrame, AsyncScroll, Timer *, void)
GdkEvent* pEvent = m_aPendingScrollEvents.back();
aEvent.mnTime = pEvent->scroll.time;
- aEvent.mnX = (sal_uLong)pEvent->scroll.x;
+ aEvent.mnX = static_cast<sal_uLong>(pEvent->scroll.x);
// --- RTL --- (mirror mouse pos)
if (AllSettings::GetLayoutRTL())
aEvent.mnX = maGeometry.nWidth - 1 - aEvent.mnX;
- aEvent.mnY = (sal_uLong)pEvent->scroll.y;
+ aEvent.mnY = static_cast<sal_uLong>(pEvent->scroll.y);
aEvent.mnCode = GetMouseModCode( pEvent->scroll.state );
double delta_x(0.0), delta_y(0.0);
@@ -2716,11 +2716,11 @@ gboolean GtkSalFrame::signalScroll(GtkWidget*, GdkEvent* pInEvent, gpointer fram
SalWheelMouseEvent aEvent;
aEvent.mnTime = rEvent.time;
- aEvent.mnX = (sal_uLong)rEvent.x;
+ aEvent.mnX = static_cast<sal_uLong>(rEvent.x);
// --- RTL --- (mirror mouse pos)
if (AllSettings::GetLayoutRTL())
aEvent.mnX = pThis->maGeometry.nWidth - 1 - aEvent.mnX;
- aEvent.mnY = (sal_uLong)rEvent.y;
+ aEvent.mnY = static_cast<sal_uLong>(rEvent.y);
aEvent.mnCode = GetMouseModCode(rEvent.state);
switch (rEvent.direction)
@@ -2817,8 +2817,8 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
vcl::DeletionListener aDel( pThis );
- int frame_x = (int)(pEvent->x_root - pEvent->x);
- int frame_y = (int)(pEvent->y_root - pEvent->y);
+ int frame_x = static_cast<int>(pEvent->x_root - pEvent->x);
+ int frame_y = static_cast<int>(pEvent->y_root - pEvent->y);
if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY)
{
pThis->m_bGeometryIsProvisional = false;
@@ -2833,8 +2833,8 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
{
SalMouseEvent aEvent;
aEvent.mnTime = pEvent->time;
- aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX;
- aEvent.mnY = (long)pEvent->y_root - pThis->maGeometry.nY;
+ aEvent.mnX = static_cast<long>(pEvent->x_root) - pThis->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(pEvent->y_root) - pThis->maGeometry.nY;
aEvent.mnCode = GetMouseModCode( pEvent->state );
aEvent.mnButton = 0;
@@ -2862,8 +2862,8 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpoi
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
SalMouseEvent aEvent;
aEvent.mnTime = pEvent->time;
- aEvent.mnX = (long)pEvent->x_root - pThis->maGeometry.nX;
- aEvent.mnY = (long)pEvent->y_root - pThis->maGeometry.nY;
+ aEvent.mnX = static_cast<long>(pEvent->x_root) - pThis->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(pEvent->y_root) - pThis->maGeometry.nY;
aEvent.mnCode = GetMouseModCode( pEvent->state );
aEvent.mnButton = 0;
@@ -3930,7 +3930,7 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
pThis->m_aInputEvent.mnCursorPos = nCursorPos;
pThis->m_aInputEvent.mnCursorFlags = 0;
- pThis->m_aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, (int)pThis->m_aInputEvent.maText.getLength() ), ExtTextInputAttr::NONE );
+ pThis->m_aInputFlags = std::vector<ExtTextInputAttr>( std::max( 1, static_cast<int>(pThis->m_aInputEvent.maText.getLength()) ), ExtTextInputAttr::NONE );
PangoAttrIterator *iter = pango_attr_list_get_iterator(pAttrs);
do
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index d605eaf241cd..a1dd2e557cbe 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -1232,8 +1232,8 @@ void GtkSalGraphics::PaintCombobox( GtkStateFlags flags, cairo_t *cr,
}
arrowRect.SetSize(Size(arrow_width, arrow_height));
- arrowRect.SetPos( Point( buttonRect.Left() + (gint)((buttonRect.GetWidth() - arrowRect.GetWidth()) / 2),
- buttonRect.Top() + (gint)((buttonRect.GetHeight() - arrowRect.GetHeight()) / 2) ) );
+ arrowRect.SetPos( Point( buttonRect.Left() + static_cast<gint>((buttonRect.GetWidth() - arrowRect.GetWidth()) / 2),
+ buttonRect.Top() + static_cast<gint>((buttonRect.GetHeight() - arrowRect.GetHeight()) / 2) ) );
tools::Rectangle aRect(Point(0, 0), Size(areaRect.GetWidth(), areaRect.GetHeight()));
@@ -2769,7 +2769,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar
************************************************************************/
static inline ::Color getColor( const GdkRGBA& rCol )
{
- return ::Color( (int)(rCol.red * 0xFFFF) >> 8, (int)(rCol.green * 0xFFFF) >> 8, (int)(rCol.blue * 0xFFFF) >> 8 );
+ return ::Color( static_cast<int>(rCol.red * 0xFFFF) >> 8, static_cast<int>(rCol.green * 0xFFFF) >> 8, static_cast<int>(rCol.blue * 0xFFFF) >> 8 );
}
static vcl::Font getFont(GtkStyleContext* pStyle, const css::lang::Locale& rLocale)
diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx
index fd1b08c43b0d..50471e8fc06f 100644
--- a/vcl/unx/x11/x11sys.cxx
+++ b/vcl/unx/x11/x11sys.cxx
@@ -102,9 +102,9 @@ int X11SalSystem::ShowNativeDialog( const OUString& rTitle, const OUString& rMes
aWarn->AddButton( button, nButton+1, (nButton == 0) ? ButtonDialogFlags::Default : ButtonDialogFlags::NONE );
nButton++;
}
- aWarn->SetFocusButton( (sal_uInt16)1 );
+ aWarn->SetFocusButton( sal_uInt16(1) );
- nRet = ((int)aWarn->Execute()) - 1;
+ nRet = static_cast<int>(aWarn->Execute()) - 1;
// normalize behaviour, actually this should never happen
if( nRet < -1 || nRet >= int(rButtons.size()) )