[Libreoffice-commits] core.git: avmedia/source basic/source bridges/source canvas/source comphelper/source connectivity/source desktop/win32 drawinglayer/source dtrans/source embeddedobj/source embedserv/source extensions/source fpicker/source hwpfilter/source jvmfwk/plugins sal/osl sal/qa sal/rtl sdext/source setup_native/source sfx2/source shell/source stoc/source svl/source sw/source tools/source vcl/inc vcl/opengl vcl/source vcl/win winaccessibility/source xmlsecurity/source
Stephan Bergmann
sbergman at redhat.com
Tue Jan 23 06:55:34 UTC 2018
avmedia/source/win/window.cxx | 8
basic/source/runtime/methods.cxx | 2
basic/source/sbx/sbxdec.cxx | 12
bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx | 2
bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx | 2
canvas/source/directx/dx_bitmapcanvashelper.cxx | 2
canvas/source/directx/dx_canvashelper.cxx | 2
canvas/source/directx/dx_textlayout_drawhelper.cxx | 12
canvas/source/directx/dx_vcltools.cxx | 6
comphelper/source/misc/mimeconfighelper.cxx | 2
connectivity/source/drivers/ado/ACallableStatement.cxx | 4
connectivity/source/drivers/ado/AColumn.cxx | 2
connectivity/source/drivers/ado/AConnection.cxx | 4
connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx | 2
connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx | 8
connectivity/source/drivers/ado/AResultSet.cxx | 16 -
connectivity/source/drivers/ado/AStatement.cxx | 2
connectivity/source/drivers/ado/Aolevariant.cxx | 14
desktop/win32/source/guiloader/genericloader.cxx | 2
desktop/win32/source/officeloader/officeloader.cxx | 4
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 6
dtrans/source/win32/dnd/source.cxx | 2
dtrans/source/win32/dtobj/FmtFilter.cxx | 2
embeddedobj/source/msole/olecomponent.cxx | 46 +-
embeddedobj/source/msole/xdialogcreator.cxx | 10
embedserv/source/embed/docholder.cxx | 8
embedserv/source/embed/ed_idataobj.cxx | 16 -
embedserv/source/embed/ed_ipersiststr.cxx | 8
embedserv/source/embed/tracker.cxx | 20 -
extensions/source/activex/SOActiveX.cxx | 6
extensions/source/ole/oleobjw.cxx | 16 -
extensions/source/ole/unoconversionutilities.hxx | 10
extensions/source/ole/unoobjw.cxx | 6
extensions/source/scanner/scanwin.cxx | 4
fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx | 2
fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx | 8
fpicker/source/win32/folderpicker/MtaFop.cxx | 2
hwpfilter/source/hwpreader.cxx | 2
jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 4
sal/osl/w32/backtrace.cxx | 8
sal/osl/w32/dllentry.cxx | 2
sal/osl/w32/file.cxx | 6
sal/osl/w32/file_dirvol.cxx | 10
sal/osl/w32/file_error.cxx | 2
sal/osl/w32/file_url.cxx | 4
sal/osl/w32/nlsupport.cxx | 6
sal/osl/w32/pipe.cxx | 4
sal/osl/w32/process.cxx | 12
sal/osl/w32/profile.cxx | 2
sal/osl/w32/security.cxx | 20 -
sal/osl/w32/socket.cxx | 22 -
sal/osl/w32/thread.cxx | 16 -
sal/osl/w32/time.cxx | 16 -
sal/qa/osl/security/osl_Security.cxx | 22 -
sal/rtl/alloc_arena.cxx | 6
sal/rtl/alloc_cache.cxx | 2
sdext/source/pdfimport/pdfparse/pdfparse.cxx | 4
setup_native/source/win32/customactions/sellang/sellang.cxx | 2
sfx2/source/appl/shutdowniconw32.cxx | 4
shell/source/win32/SysShExec.cxx | 2
shell/source/win32/shlxthandler/infotips/infotips.cxx | 2
shell/source/win32/shlxthandler/ooofilt/propspec.cxx | 2
shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx | 6
shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx | 2
shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx | 6
shell/source/win32/shlxthandler/util/iso8601_converter.cxx | 12
shell/source/win32/zipfile/zipfile.cxx | 6
stoc/source/typeconv/convert.cxx | 4
svl/source/crypto/cryptosign.cxx | 6
svl/source/svdde/ddecli.cxx | 12
svl/source/svdde/ddesvr.cxx | 10
sw/source/core/txtnode/fntcache.cxx | 2
tools/source/datetime/ttime.cxx | 2
tools/source/stream/strmwnt.cxx | 4
vcl/inc/win/wincomp.hxx | 2
vcl/opengl/win/gdiimpl.cxx | 6
vcl/source/window/toolbox.cxx | 2
vcl/win/app/saldata.cxx | 2
vcl/win/app/salinst.cxx | 14
vcl/win/app/saltimer.cxx | 2
vcl/win/gdi/gdiimpl.cxx | 134 ++++----
vcl/win/gdi/salbmp.cxx | 8
vcl/win/gdi/salfont.cxx | 12
vcl/win/gdi/salgdi.cxx | 24 -
vcl/win/gdi/salprn.cxx | 10
vcl/win/gdi/salvd.cxx | 4
vcl/win/window/salframe.cxx | 154 +++++-----
vcl/win/window/salmenu.cxx | 2
vcl/win/window/salobj.cxx | 26 -
winaccessibility/source/UAccCOM/AccComponentBase.cxx | 4
winaccessibility/source/UAccCOM/AccEditableText.cxx | 18 -
winaccessibility/source/UAccCOM/EnumVariant.cxx | 2
winaccessibility/source/service/AccObject.cxx | 2
winaccessibility/source/service/AccObjectWinManager.cxx | 2
winaccessibility/source/service/AccTopWindowListener.cxx | 2
winaccessibility/source/service/msaaservice_impl.cxx | 2
xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx | 4
xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx | 2
xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx | 2
99 files changed, 488 insertions(+), 488 deletions(-)
New commits:
commit 9af8f190ed1bf3f76897ad0c078db16451d6fb69
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Jan 22 13:11:34 2018 +0100
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 at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 16deeee09a1e..a24682ae03bc 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -235,12 +235,12 @@ void Window::ImplLayoutVideoWindow()
{
if( aPrefSize.Width > 0 && aPrefSize.Height > 0 && nVideoW > 0 && nVideoH > 0 )
{
- double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height;
+ double fPrefWH = static_cast<double>(aPrefSize.Width) / aPrefSize.Height;
- if( fPrefWH < ( (double) nVideoW / nVideoH ) )
- nVideoW = (int)( nVideoH * fPrefWH );
+ if( fPrefWH < ( static_cast<double>(nVideoW) / nVideoH ) )
+ nVideoW = static_cast<int>( nVideoH * fPrefWH );
else
- nVideoH = (int)( nVideoW / fPrefWH );
+ nVideoH = static_cast<int>( nVideoW / fPrefWH );
nX = ( nW - nVideoW ) >> 1;
nY = ( nH - nVideoH ) >> 1;
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 58c8b35c9cb1..5f53992360ff 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2938,7 +2938,7 @@ void SbRtl_GetAttr(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
{
nRealFlags = 0;
}
- nFlags = (sal_Int16) nRealFlags;
+ nFlags = static_cast<sal_Int16>(nRealFlags);
}
else
{
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 183abf2de137..4c9be3546afd 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -138,13 +138,13 @@ bool SbxDecimal::isZero()
SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight )
{
HRESULT hResult = VarDecCmp( const_cast<LPDECIMAL>(&rLeft.maDec), const_cast<LPDECIMAL>(&rRight.maDec) );
- SbxDecimal::CmpResult eRes = (SbxDecimal::CmpResult)hResult;
+ SbxDecimal::CmpResult eRes = static_cast<SbxDecimal::CmpResult>(hResult);
return eRes;
}
void SbxDecimal::setChar( sal_Unicode val )
{
- VarDecFromUI2( (sal_uInt16)val, &maDec );
+ VarDecFromUI2( static_cast<sal_uInt16>(val), &maDec );
}
void SbxDecimal::setByte( sal_uInt8 val )
@@ -154,12 +154,12 @@ void SbxDecimal::setByte( sal_uInt8 val )
void SbxDecimal::setShort( sal_Int16 val )
{
- VarDecFromI2( (short)val, &maDec );
+ VarDecFromI2( static_cast<short>(val), &maDec );
}
void SbxDecimal::setLong( sal_Int32 val )
{
- VarDecFromI4( (long)val, &maDec );
+ VarDecFromI4( static_cast<long>(val), &maDec );
}
void SbxDecimal::setUShort( sal_uInt16 val )
@@ -186,12 +186,12 @@ bool SbxDecimal::setDouble( double val )
void SbxDecimal::setInt( int val )
{
- setLong( (sal_Int32)val );
+ setLong( static_cast<sal_Int32>(val) );
}
void SbxDecimal::setUInt( unsigned int val )
{
- setULong( (sal_uInt32)val );
+ setULong( static_cast<sal_uInt32>(val) );
}
bool SbxDecimal::setString( OUString* pOUString )
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
index 36efe8e17289..7c754a6c37b6 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
@@ -380,7 +380,7 @@ unsigned char * codeSnippet(
sal_Int32 nFunctionIndex,
sal_Int32 nVtableOffset )
{
- sal_uInt64 nOffsetAndIndex = ( ( (sal_uInt64) nVtableOffset ) << 32 ) | ( (sal_uInt64) nFunctionIndex );
+ sal_uInt64 nOffsetAndIndex = ( static_cast<sal_uInt64>(nVtableOffset) << 32 ) | static_cast<sal_uInt64>(nFunctionIndex);
unsigned char *p = code;
// Spill parameters
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
index 640455b8bab9..02d78d740e80 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
@@ -645,7 +645,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
// Fill pCode with D-Tor code
GenerateDestructorTrampoline(pCode, pTD);
- _pDtor = (sal_Int32)(reinterpret_cast<sal_uInt64>(pCode) - _codeBase);
+ _pDtor = static_cast<sal_Int32>(reinterpret_cast<sal_uInt64>(pCode) - _codeBase);
pCodeOffset += codeSnippetSize;
// Info count accompanied by type info ptrs: type, base type, base base type, ...
diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx
index 7e69484935c9..2d4954700e55 100644
--- a/canvas/source/directx/dx_bitmapcanvashelper.cxx
+++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx
@@ -86,7 +86,7 @@ namespace dxcanvas
GraphicsSharedPtr pGraphics( mpTarget->getGraphics() );
Gdiplus::Color aClearColor = hasAlpha() ?
- Gdiplus::Color( 0,255,255,255 ) : Gdiplus::Color((Gdiplus::ARGB)Gdiplus::Color::White);
+ Gdiplus::Color( 0,255,255,255 ) : Gdiplus::Color(Gdiplus::ARGB(Gdiplus::Color::White));
ENSURE_OR_THROW(
Gdiplus::Ok == pGraphics->SetCompositingMode(
diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx
index 86222437d090..7fe441f081bf 100644
--- a/canvas/source/directx/dx_canvashelper.cxx
+++ b/canvas/source/directx/dx_canvashelper.cxx
@@ -146,7 +146,7 @@ namespace dxcanvas
if( needOutput() )
{
GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() );
- Gdiplus::Color aClearColor = Gdiplus::Color((Gdiplus::ARGB)Gdiplus::Color::White);
+ Gdiplus::Color aClearColor = Gdiplus::Color(Gdiplus::ARGB(Gdiplus::Color::White));
ENSURE_OR_THROW(
Gdiplus::Ok == pGraphics->SetCompositingMode(
diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index 4edd59cab623..56469e17ee72 100644
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -179,12 +179,12 @@ namespace dxcanvas
// set world transform
XFORM aXForm;
- aXForm.eM11 = (FLOAT)aWorldTransform.get(0, 0);
- aXForm.eM12 = (FLOAT)aWorldTransform.get(1, 0);
- aXForm.eM21 = (FLOAT)aWorldTransform.get(0, 1);
- aXForm.eM22 = (FLOAT)aWorldTransform.get(1, 1);
- aXForm.eDx = (FLOAT)aWorldTransform.get(0, 2);
- aXForm.eDy = (FLOAT)aWorldTransform.get(1, 2);
+ aXForm.eM11 = static_cast<FLOAT>(aWorldTransform.get(0, 0));
+ aXForm.eM12 = static_cast<FLOAT>(aWorldTransform.get(1, 0));
+ aXForm.eM21 = static_cast<FLOAT>(aWorldTransform.get(0, 1));
+ aXForm.eM22 = static_cast<FLOAT>(aWorldTransform.get(1, 1));
+ aXForm.eDx = static_cast<FLOAT>(aWorldTransform.get(0, 2));
+ aXForm.eDy = static_cast<FLOAT>(aWorldTransform.get(1, 2));
// TODO(F3): This is NOT supported on 95/98/ME!
SetGraphicsMode(hdc, GM_ADVANCED);
diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx
index 1efc1e30b174..b8e511a09260 100644
--- a/canvas/source/directx/dx_vcltools.cxx
+++ b/canvas/source/directx/dx_vcltools.cxx
@@ -223,7 +223,7 @@ namespace dxcanvas
// out notion of alpha is
// different from the rest
// of the world's
- *pCurrOutput++ = 255 - (BYTE)*pAScan++;
+ *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++);
}
}
break;
@@ -243,7 +243,7 @@ namespace dxcanvas
// out notion of alpha is
// different from the rest
// of the world's
- *pCurrOutput++ = 255 - (BYTE)*pAScan++;
+ *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++);
}
}
break;
@@ -275,7 +275,7 @@ namespace dxcanvas
// out notion of alpha is
// different from the rest
// of the world's
- *pCurrOutput++ = 255 - (BYTE)*pAScan++;
+ *pCurrOutput++ = 255 - static_cast<BYTE>(*pAScan++);
}
}
break;
diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx
index 7db54fef85a7..91e4c5513eb8 100644
--- a/comphelper/source/misc/mimeconfighelper.cxx
+++ b/comphelper/source/misc/mimeconfighelper.cxx
@@ -670,7 +670,7 @@ SfxFilterFlags MimeConfigurationHelper::GetFilterFlags( const OUString& aFilterN
if ( aFilterAny >>= aData )
{
SequenceAsHashMap aFilterHM( aData );
- nFlags = static_cast<SfxFilterFlags>(aFilterHM.getUnpackedValueOrDefault( "Flags", (sal_Int32)0 ));
+ nFlags = static_cast<SfxFilterFlags>(aFilterHM.getUnpackedValueOrDefault( "Flags", sal_Int32(0) ));
}
}
} catch( uno::Exception& )
diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx
index 27e6acea428e..d572a8f99d9e 100644
--- a/connectivity/source/drivers/ado/ACallableStatement.cxx
+++ b/connectivity/source/drivers/ado/ACallableStatement.cxx
@@ -106,7 +106,7 @@ sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
{
GET_PARAM()
- return (sal_Int64)m_aValue.getCurrency().int64;
+ return static_cast<sal_Int64>(m_aValue.getCurrency().int64);
}
@@ -164,7 +164,7 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet
{
pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
pParam->put_Direction(adParamOutput);
- pParam->put_NumericScale((sal_Int8)scale);
+ pParam->put_NumericScale(static_cast<sal_Int8>(scale));
}
}
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 12b671ef115d..962b57aa0a4c 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -146,7 +146,7 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
sal_Int32 nVal=0;
rValue >>= nVal;
if ( !m_IsCurrency )
- m_aColumn.put_NumericScale((sal_Int8)nVal);
+ m_aColumn.put_NumericScale(static_cast<sal_Int8>(nVal));
}
break;
case PROPERTY_ID_ISNULLABLE:
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 7b98f77b147f..ad02964b85e3 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -435,10 +435,10 @@ void OConnection::buildTypeInfo()
sal_Int32 nPos = 1;
OExtendedTypeInfo* aInfo = new OExtendedTypeInfo;
aInfo->aSimpleType.aTypeName = ADOS::getField(pRecordset,nPos++).get_Value().getString();
- aInfo->eType = (DataTypeEnum)ADOS::getField(pRecordset,nPos++).get_Value().getInt32();
+ aInfo->eType = static_cast<DataTypeEnum>(ADOS::getField(pRecordset,nPos++).get_Value().getInt32());
if ( aInfo->eType == adWChar && aInfo->aSimpleType.aTypeName == s_sVarChar )
aInfo->eType = adVarWChar;
- aInfo->aSimpleType.nType = (sal_Int16)ADOS::MapADOType2Jdbc(aInfo->eType);
+ aInfo->aSimpleType.nType = static_cast<sal_Int16>(ADOS::MapADOType2Jdbc(aInfo->eType));
aInfo->aSimpleType.nPrecision = ADOS::getField(pRecordset,nPos++).get_Value().getInt32();
nPos++; // aLiteralPrefix
nPos++; // aLiteralSuffix
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
index cadf6fe2c793..8f546fceca92 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx
@@ -378,7 +378,7 @@ RightsEnum OAdoGroup::Map2Right(sal_Int32 _eNum)
if(_eNum & Privilege::DROP)
nRight |= adRightDrop;
- return (RightsEnum)nRight;
+ return static_cast<RightsEnum>(nRight);
}
void WpADOIndex::Create()
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
index 19f4d9b45749..d787532336a1 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
@@ -211,9 +211,9 @@ sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex )
if(m_aValue.isNull())
return 0;
if ( !m_aValueRange.empty() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (sal_Int8)(*m_aValueRangeIter).second[m_aValue.getInt32()];
+ return static_cast<sal_Int8>((*m_aValueRangeIter).second[m_aValue.getInt32()]);
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue.getString()];
+ return static_cast<sal_Int8>((*m_aStrValueRangeIter).second[m_aValue.getString()]);
return m_aValue.getInt8();
}
@@ -342,9 +342,9 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
return 0;
if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (sal_Int16)(*m_aValueRangeIter).second[m_aValue.getInt32()];
+ return static_cast<sal_Int16>((*m_aValueRangeIter).second[m_aValue.getInt32()]);
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue.getString()];
+ return static_cast<sal_Int16>((*m_aStrValueRangeIter).second[m_aValue.getString()]);
return m_aValue.getInt16();
}
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index 2d6c1ece45e8..8c1b6993dabe 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -820,13 +820,13 @@ Any SAL_CALL OResultSet::getBookmark( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if(m_nRowPos < (sal_Int32)m_aBookmarks.size()) // this bookmark was already fetched
+ if(m_nRowPos < static_cast<sal_Int32>(m_aBookmarks.size())) // this bookmark was already fetched
return makeAny(sal_Int32(m_nRowPos-1));
OLEVariant aVar;
m_pRecordSet->get_Bookmark(&aVar);
m_aBookmarks.push_back(aVar);
- return makeAny((sal_Int32)(m_aBookmarks.size()-1));
+ return makeAny(static_cast<sal_Int32>(m_aBookmarks.size()-1));
}
@@ -838,8 +838,8 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark )
sal_Int32 nPos = 0;
bookmark >>= nPos;
- OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
- if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
+ OSL_ENSURE(nPos >= 0 && nPos < static_cast<sal_Int32>(m_aBookmarks.size()),"Invalid Index for vector");
+ if(nPos < 0 || nPos >= static_cast<sal_Int32>(m_aBookmarks.size()))
::dbtools::throwFunctionSequenceException(*this);
return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos]));
@@ -854,8 +854,8 @@ sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_I
sal_Int32 nPos = 0;
bookmark >>= nPos;
nPos += rows;
- OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
- if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
+ OSL_ENSURE(nPos >= 0 && nPos < static_cast<sal_Int32>(m_aBookmarks.size()),"Invalid Index for vector");
+ if(nPos < 0 || nPos >= static_cast<sal_Int32>(m_aBookmarks.size()))
::dbtools::throwFunctionSequenceException(*this);
return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos]));
}
@@ -872,11 +872,11 @@ sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& bookmark1, const Any
if(nPos1 == nPos2) // they should be equal
return css::sdbcx::CompareBookmark::EQUAL;
- OSL_ENSURE((nPos1 >= 0 && nPos1 < (sal_Int32)m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < (sal_Int32)m_aBookmarks.size()),"Invalid Index for vector");
+ OSL_ENSURE((nPos1 >= 0 && nPos1 < static_cast<sal_Int32>(m_aBookmarks.size())) || (nPos1 >= 0 && nPos2 < static_cast<sal_Int32>(m_aBookmarks.size())),"Invalid Index for vector");
CompareEnum eNum;
m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum);
- return ((sal_Int32)eNum) - 1;
+ return static_cast<sal_Int32>(eNum) - 1;
}
sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( )
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
index 8ffaad54f340..5bdf386468c4 100644
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ b/connectivity/source/drivers/ado/AStatement.cxx
@@ -211,7 +211,7 @@ sal_Int32 OStatement_Base::getPrecision ( sal_Int32 sqlType)
sal_Int32 prec = -1;
OTypeInfo aInfo;
- aInfo.nType = (sal_Int16)sqlType;
+ aInfo.nType = static_cast<sal_Int16>(sqlType);
if (!m_aTypeInfo.empty())
{
std::vector<OTypeInfo>::const_iterator aIter = std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo);
diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx
index bc8c9236a623..cd06b31fc7ed 100644
--- a/connectivity/source/drivers/ado/Aolevariant.cxx
+++ b/connectivity/source/drivers/ado/Aolevariant.cxx
@@ -116,7 +116,7 @@ OLEVariant::OLEVariant(bool x) { VariantInit(this); vt = VT_BOOL
OLEVariant::OLEVariant(sal_Int8 n) { VariantInit(this); vt = VT_I1; bVal = n;}
OLEVariant::OLEVariant(sal_Int16 n) { VariantInit(this); vt = VT_I2; intVal = n;}
OLEVariant::OLEVariant(sal_Int32 n) { VariantInit(this); vt = VT_I4; lVal = n;}
-OLEVariant::OLEVariant(sal_Int64 x) { VariantInit(this); vt = VT_I4; lVal = (LONG)x;}
+OLEVariant::OLEVariant(sal_Int64 x) { VariantInit(this); vt = VT_I4; lVal = static_cast<LONG>(x);}
OLEVariant::OLEVariant(const OUString& us)
{
@@ -312,7 +312,7 @@ void OLEVariant::setArray(SAFEARRAY* pSafeArray, VARTYPE vtType)
{
HRESULT eRet = VariantClear(this);
OSL_ENSURE(eRet == S_OK,"Error while clearing an ado variant!");
- vt = (VARTYPE)(VT_ARRAY|vtType);
+ vt = static_cast<VARTYPE>(VT_ARRAY|vtType);
parray = pSafeArray;
}
@@ -354,7 +354,7 @@ VARIANT_BOOL OLEVariant::VariantBool(bool bEinBoolean)
void OLEVariant::CHS()
{
- cyVal.Lo ^= (sal_uInt32)-1;
+ cyVal.Lo ^= sal_uInt32(-1);
cyVal.Hi ^= -1;
cyVal.Lo++;
if( !cyVal.Lo )
@@ -365,12 +365,12 @@ void OLEVariant::set(double n)
{
if( n >= 0 )
{
- cyVal.Hi = (sal_Int32)(n / 4294967296.0);
- cyVal.Lo = (sal_uInt32)(n - ((double)cyVal.Hi * 4294967296.0));
+ cyVal.Hi = static_cast<sal_Int32>(n / 4294967296.0);
+ cyVal.Lo = static_cast<sal_uInt32>(n - (static_cast<double>(cyVal.Hi) * 4294967296.0));
}
else {
- cyVal.Hi = (sal_Int32)(-n / 4294967296.0);
- cyVal.Lo = (sal_uInt32)(-n - ((double)cyVal.Hi * 4294967296.0));
+ cyVal.Hi = static_cast<sal_Int32>(-n / 4294967296.0);
+ cyVal.Lo = static_cast<sal_uInt32>(-n - (static_cast<double>(cyVal.Hi) * 4294967296.0));
CHS();
}
}
diff --git a/desktop/win32/source/guiloader/genericloader.cxx b/desktop/win32/source/guiloader/genericloader.cxx
index 8beb240c0316..193e74bd11b0 100644
--- a/desktop/win32/source/guiloader/genericloader.cxx
+++ b/desktop/win32/source/guiloader/genericloader.cxx
@@ -33,7 +33,7 @@ static int GenericMain()
GetStartupInfoW( &aStartupInfo );
- DWORD dwExitCode = (DWORD)-1;
+ DWORD dwExitCode = DWORD(-1);
PROCESS_INFORMATION aProcessInfo;
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index 45b94a8e128d..10393741b235 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -52,7 +52,7 @@ int WINAPI wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int )
if ((aStartupInfo.dwFlags & STARTF_USESTDHANDLES) == 0)
AttachConsole(ATTACH_PARENT_PROCESS);
- DWORD dwExitCode = (DWORD)-1;
+ DWORD dwExitCode = DWORD(-1);
BOOL fSuccess = FALSE;
LPWSTR lpCommandLine = nullptr;
@@ -129,7 +129,7 @@ int WINAPI wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int )
LocalFree(argv2);
}
- if ( _ltow( (long)GetCurrentProcessId(),szParentProcessId, 10 ) && bHeadlessMode )
+ if ( _ltow( static_cast<long>(GetCurrentProcessId()),szParentProcessId, 10 ) && bHeadlessMode )
SetEnvironmentVariableW( L"ATTACHED_PARENT_PROCESSID", szParentProcessId );
PROCESS_INFORMATION aProcessInfo;
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index bfc9140e8d7c..66090ad2e34e 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -417,8 +417,8 @@ namespace drawinglayer
if(aUnscaledFontMetric.GetAverageFontWidth() > 0)
{
- const double fScaleFactor((double)nWidth / (double)nHeight);
- const sal_uInt32 nScaledWidth(basegfx::fround((double)aUnscaledFontMetric.GetAverageFontWidth() * fScaleFactor));
+ const double fScaleFactor(static_cast<double>(nWidth) / static_cast<double>(nHeight));
+ const sal_uInt32 nScaledWidth(basegfx::fround(static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth()) * fScaleFactor));
aRetval.SetAverageFontWidth(nScaledWidth);
}
}
@@ -470,7 +470,7 @@ namespace drawinglayer
if(aUnscaledFontMetric.GetAverageFontWidth() > 0)
{
- const double fScaleFactor((double)rFont.GetFontSize().getWidth() / (double)aUnscaledFontMetric.GetAverageFontWidth());
+ const double fScaleFactor(static_cast<double>(rFont.GetFontSize().getWidth()) / static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth()));
o_rSize.setX(fScaleFactor * o_rSize.getY());
}
}
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx
index 06c8e4977def..5b1bc1d3d1b3 100644
--- a/dtrans/source/win32/dnd/source.cxx
+++ b/dtrans/source/win32/dnd/source.cxx
@@ -211,7 +211,7 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryInterface( REFIID riid, void **ppvOb
ULONG STDMETHODCALLTYPE DragSource::AddRef()
{
acquire();
- return (ULONG) m_refCount;
+ return static_cast<ULONG>(m_refCount);
}
ULONG STDMETHODCALLTYPE DragSource::Release()
diff --git a/dtrans/source/win32/dtobj/FmtFilter.cxx b/dtrans/source/win32/dtobj/FmtFilter.cxx
index 2931521511fb..1dcc089c7b9d 100644
--- a/dtrans/source/win32/dtobj/FmtFilter.cxx
+++ b/dtrans/source/win32/dtobj/FmtFilter.cxx
@@ -423,7 +423,7 @@ Sequence< sal_Int8 > WinBITMAPToOOBMP( HBITMAP aHBMP )
pBmp->biPlanes = 1;
pBmp->biBitCount = 32;
pBmp->biCompression = BI_RGB;
- pBmp->biSizeImage = (DWORD)nDataBytes;
+ pBmp->biSizeImage = static_cast<DWORD>(nDataBytes);
pBmp->biXPelsPerMeter = 1000;
pBmp->biYPelsPerMeter = 1000;
pBmp->biClrUsed = 0;
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index 290318a4d109..df3b0131b07b 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -299,11 +299,11 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium,
// TODO/LATER: the unit size must be calculated correctly
*reinterpret_cast<long*>( pBuf.get() ) = 0x9ac6cdd7L;
- *reinterpret_cast<short*>( pBuf.get()+6 ) = ( SHORT ) 0;
- *reinterpret_cast<short*>( pBuf.get()+8 ) = ( SHORT ) 0;
- *reinterpret_cast<short*>( pBuf.get()+10 ) = ( SHORT ) pMF->xExt;
- *reinterpret_cast<short*>( pBuf.get()+12 ) = ( SHORT ) pMF->yExt;
- *reinterpret_cast<short*>( pBuf.get()+14 ) = ( USHORT ) 2540;
+ *reinterpret_cast<short*>( pBuf.get()+6 ) = SHORT(0);
+ *reinterpret_cast<short*>( pBuf.get()+8 ) = SHORT(0);
+ *reinterpret_cast<short*>( pBuf.get()+10 ) = static_cast<SHORT>(pMF->xExt);
+ *reinterpret_cast<short*>( pBuf.get()+12 ) = static_cast<SHORT>(pMF->yExt);
+ *reinterpret_cast<short*>( pBuf.get()+14 ) = USHORT(2540);
if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize - 22, pBuf.get() + 22 ) )
@@ -380,11 +380,11 @@ bool GetClassIDFromSequence_Impl( uno::Sequence< sal_Int8 > const & aSeq, CLSID&
{
if ( aSeq.getLength() == 16 )
{
- aResult.Data1 = ( ( ( ( ( ( sal_uInt8 )aSeq[0] << 8 ) + ( sal_uInt8 )aSeq[1] ) << 8 ) + ( sal_uInt8 )aSeq[2] ) << 8 ) + ( sal_uInt8 )aSeq[3];
- aResult.Data2 = ( ( sal_uInt8 )aSeq[4] << 8 ) + ( sal_uInt8 )aSeq[5];
- aResult.Data3 = ( ( sal_uInt8 )aSeq[6] << 8 ) + ( sal_uInt8 )aSeq[7];
+ aResult.Data1 = ( ( ( ( ( static_cast<sal_uInt8>(aSeq[0]) << 8 ) + static_cast<sal_uInt8>(aSeq[1]) ) << 8 ) + static_cast<sal_uInt8>(aSeq[2]) ) << 8 ) + static_cast<sal_uInt8>(aSeq[3]);
+ aResult.Data2 = ( static_cast<sal_uInt8>(aSeq[4]) << 8 ) + static_cast<sal_uInt8>(aSeq[5]);
+ aResult.Data3 = ( static_cast<sal_uInt8>(aSeq[6]) << 8 ) + static_cast<sal_uInt8>(aSeq[7]);
for( int nInd = 0; nInd < 8; nInd++ )
- aResult.Data4[nInd] = ( sal_uInt8 )aSeq[nInd+8];
+ aResult.Data4[nInd] = static_cast<sal_uInt8>(aSeq[nInd+8]);
return true;
}
@@ -994,14 +994,14 @@ awt::Size OleComponent::CalculateWithFactor( const awt::Size& aSize,
{
awt::Size aResult;
- sal_Int64 nWidth = (sal_Int64)aSize.Width * (sal_Int64)aMultiplier.Width / (sal_Int64)aDivisor.Width;
- sal_Int64 nHeight = (sal_Int64)aSize.Height * (sal_Int64)aMultiplier.Height / (sal_Int64)aDivisor.Height;
+ sal_Int64 nWidth = static_cast<sal_Int64>(aSize.Width) * static_cast<sal_Int64>(aMultiplier.Width) / static_cast<sal_Int64>(aDivisor.Width);
+ sal_Int64 nHeight = static_cast<sal_Int64>(aSize.Height) * static_cast<sal_Int64>(aMultiplier.Height) / static_cast<sal_Int64>(aDivisor.Height);
OSL_ENSURE( nWidth < SAL_MAX_INT32 && nWidth > SAL_MIN_INT32
&& nHeight < SAL_MAX_INT32 && nHeight > SAL_MIN_INT32,
"Unacceptable result size!" );
- aResult.Width = (sal_Int32)nWidth;
- aResult.Height = (sal_Int32)nHeight;
+ aResult.Width = static_cast<sal_Int32>(nWidth);
+ aResult.Height = static_cast<sal_Int32>(nHeight);
return aResult;
}
@@ -1086,7 +1086,7 @@ void OleComponent::SetExtent( const awt::Size& aVisAreaSize, sal_Int64 nAspect )
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
+ DWORD nMSAspect = static_cast<DWORD>(nAspect); // first 32 bits are for MS aspects
SIZEL aSize = { aVisAreaSize.Width, aVisAreaSize.Height };
HRESULT hr = m_pNativeImpl->m_pOleObject->SetExtent( nMSAspect, &aSize );
@@ -1108,7 +1108,7 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
+ DWORD nMSAspect = static_cast<DWORD>(nAspect); // first 32 bits are for MS aspects
awt::Size aSize;
bool bGotSize = false;
@@ -1160,12 +1160,12 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
break;
}
- sal_Int64 nX = ( (sal_Int64)abs( pMF->xExt ) ) * nMult / nDiv;
- sal_Int64 nY = ( (sal_Int64)abs( pMF->yExt ) ) * nMult / nDiv;
+ sal_Int64 nX = static_cast<sal_Int64>(abs( pMF->xExt )) * nMult / nDiv;
+ sal_Int64 nY = static_cast<sal_Int64>(abs( pMF->yExt )) * nMult / nDiv;
if ( nX < SAL_MAX_INT32 && nY < SAL_MAX_INT32 )
{
- aSize.Width = ( sal_Int32 )nX;
- aSize.Height = ( sal_Int32 )nY;
+ aSize.Width = static_cast<sal_Int32>(nX);
+ aSize.Height = static_cast<sal_Int32>(nY);
bGotSize = true;
}
else
@@ -1190,7 +1190,7 @@ awt::Size OleComponent::GetCachedExtent( sal_Int64 nAspect )
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
+ DWORD nMSAspect = static_cast<DWORD>(nAspect); // first 32 bits are for MS aspects
SIZEL aSize;
HRESULT hr = m_pNativeImpl->m_pViewObject2->GetExtent( nMSAspect, -1, nullptr, &aSize );
@@ -1216,7 +1216,7 @@ awt::Size OleComponent::GetRecommendedExtent( sal_Int64 nAspect )
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
+ DWORD nMSAspect = static_cast<DWORD>(nAspect); // first 32 bits are for MS aspects
SIZEL aSize;
HRESULT hr = m_pNativeImpl->m_pOleObject->GetExtent( nMSAspect, &aSize );
if ( FAILED( hr ) )
@@ -1232,8 +1232,8 @@ sal_Int64 OleComponent::GetMiscStatus( sal_Int64 nAspect )
throw embed::WrongStateException(); // TODO: the object is in wrong state
DWORD nResult;
- m_pNativeImpl->m_pOleObject->GetMiscStatus( ( DWORD )nAspect, &nResult );
- return ( sal_Int64 )nResult; // first 32 bits are for MS flags
+ m_pNativeImpl->m_pOleObject->GetMiscStatus( static_cast<DWORD>(nAspect), &nResult );
+ return static_cast<sal_Int64>(nResult); // first 32 bits are for MS flags
}
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index d8338cbacfd4..44141b5101f8 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -237,11 +237,11 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia
uno::Sequence< sal_Int8 > aMetafile( nBufSize + 22 );
sal_Int8* pBuf = aMetafile.getArray();
*reinterpret_cast<long*>( pBuf ) = 0x9ac6cdd7L;
- *reinterpret_cast<short*>( pBuf+6 ) = ( SHORT ) 0;
- *reinterpret_cast<short*>( pBuf+8 ) = ( SHORT ) 0;
- *reinterpret_cast<short*>( pBuf+10 ) = ( SHORT ) pMF->xExt;
- *reinterpret_cast<short*>( pBuf+12 ) = ( SHORT ) pMF->yExt;
- *reinterpret_cast<short*>( pBuf+14 ) = ( USHORT ) 2540;
+ *reinterpret_cast<short*>( pBuf+6 ) = SHORT(0);
+ *reinterpret_cast<short*>( pBuf+8 ) = SHORT(0);
+ *reinterpret_cast<short*>( pBuf+10 ) = static_cast<SHORT>(pMF->xExt);
+ *reinterpret_cast<short*>( pBuf+12 ) = static_cast<SHORT>(pMF->yExt);
+ *reinterpret_cast<short*>( pBuf+14 ) = USHORT(2540);
if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize, pBuf+22 ) )
{
diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index 731c453c9cf0..fb333d862a61 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -141,7 +141,7 @@ void DocumentHolder::LoadDocInFrame( bool bPluginMode )
aSeq[nLen-1] = beans::PropertyValue(
"PluginMode",
-1,
- uno::Any((sal_Int16) 3),
+ uno::Any(sal_Int16(3)),
beans::PropertyState_DIRECT_VALUE);
}
@@ -538,18 +538,18 @@ BOOL DocumentHolder::InPlaceMenuCreate()
int help = count-1;
// start with 1, because we don't include "File"
- WORD pos = (WORD)mgw.width[0];
+ WORD pos = static_cast<WORD>(mgw.width[0]);
CopyToOLEMenu(m_nMenuHandle,1,hMenu,pos);
mgw.width[1] = 1;
// insert object menu here
- pos = ((WORD)(mgw.width[0] + mgw.width[1] + mgw.width[2]));
+ pos = static_cast<WORD>(mgw.width[0] + mgw.width[1] + mgw.width[2]);
for(WORD i = 2; i < help-1; ++i,++pos)
CopyToOLEMenu(m_nMenuHandle,i,hMenu,pos);
mgw.width[3] = help - 3;
// insert help menu
- pos = (WORD)(mgw.width[0] + mgw.width[1] + mgw.width[2] +
+ pos = static_cast<WORD>(mgw.width[0] + mgw.width[1] + mgw.width[2] +
mgw.width[3] + mgw.width[4]);
CopyToOLEMenu(m_nMenuHandle,WORD(help),hMenu,pos);
mgw.width[5] = 1;
diff --git a/embedserv/source/embed/ed_idataobj.cxx b/embedserv/source/embed/ed_idataobj.cxx
index c05e9d2def12..11b1709c71c1 100644
--- a/embedserv/source/embed/ed_idataobj.cxx
+++ b/embedserv/source/embed/ed_idataobj.cxx
@@ -118,8 +118,8 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
}
else
{
- CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatW( L"Embed Source" );
- CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ CLIPFORMAT cf_embSource = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embed Source" ));
+ CLIPFORMAT cf_embObj = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
if ( pFormatetc->cfFormat == cf_embSource || pFormatetc->cfFormat == cf_embObj )
{
if ( !( pFormatetc->tymed & TYMED_ISTORAGE ) )
@@ -157,8 +157,8 @@ STDMETHODIMP EmbedDocument_Impl::GetDataHere( FORMATETC * pFormatetc, STGMEDIUM
|| pFormatetc->dwAspect == DVASPECT_DOCPRINT )
return DV_E_DVASPECT;
- CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatW( L"Embed Source" );
- CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ CLIPFORMAT cf_embSource = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embed Source" ));
+ CLIPFORMAT cf_embObj = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
if ( pFormatetc->cfFormat == cf_embSource || pFormatetc->cfFormat == cf_embObj )
{
@@ -204,8 +204,8 @@ STDMETHODIMP EmbedDocument_Impl::QueryGetData( FORMATETC * pFormatetc )
}
else
{
- CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatW( L"Embed Source" );
- CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ CLIPFORMAT cf_embSource = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embed Source" ));
+ CLIPFORMAT cf_embObj = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
if ( pFormatetc->cfFormat == cf_embSource || pFormatetc->cfFormat == cf_embObj )
{
if ( !( pFormatetc->tymed & TYMED_ISTORAGE ) )
@@ -241,8 +241,8 @@ STDMETHODIMP EmbedDocument_Impl::GetCanonicalFormatEtc( FORMATETC * pFormatetcIn
}
else
{
- CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatW( L"Embed Source" );
- CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ CLIPFORMAT cf_embSource = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embed Source" ));
+ CLIPFORMAT cf_embObj = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
if ( pFormatetcIn->cfFormat == cf_embSource || pFormatetcIn->cfFormat == cf_embObj )
{
pFormatetcOut->tymed = TYMED_ISTORAGE;
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index e60a6b102fed..b863cd8270ef 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -79,7 +79,7 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
hr = pStream->Stat( &aStat, STATFLAG_NONAME );
if ( FAILED( hr ) ) return xResult;
- sal_uInt32 nSize = (sal_uInt32)aStat.cbSize.QuadPart;
+ sal_uInt32 nSize = static_cast<sal_uInt32>(aStat.cbSize.QuadPart);
sal_uInt32 nCopied = 0;
uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize );
try
@@ -423,7 +423,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
if ( hr == S_OK )
{
wchar_t const * aCurType = getStorageTypeFromGUID_Impl( &m_guid ); // ???
- CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ CLIPFORMAT cf = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
hr = WriteFmtUserTypeStg( pStg,
cf, // ???
const_cast<wchar_t *>(aCurType) );
@@ -743,7 +743,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
if ( FAILED( hr ) || !m_pMasterStorage ) return E_FAIL;
o3tl::u16string_view aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ???
- CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ CLIPFORMAT cf = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
hr = WriteFmtUserTypeStg( m_pMasterStorage,
cf, // ???
const_cast<LPOLESTR>( o3tl::toW(aCurType.data())) );
@@ -794,7 +794,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
if ( hr == S_OK )
{
aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ???
- cf = (CLIPFORMAT)RegisterClipboardFormatW( L"Embedded Object" );
+ cf = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
hr = WriteFmtUserTypeStg( m_pMasterStorage,
cf, // ???
const_cast<LPOLESTR>( o3tl::toW(aCurType.data())) );
diff --git a/embedserv/source/embed/tracker.cxx b/embedserv/source/embed/tracker.cxx
index ac7a05857ad1..ba8582c97fad 100644
--- a/embedserv/source/embed/tracker.cxx
+++ b/embedserv/source/embed/tracker.cxx
@@ -89,7 +89,7 @@ HBRUSH HalftoneBrush()
{
WORD grayPattern[8];
for (int i = 0; i < 8; i++)
- grayPattern[i] = (WORD)(0x5555 << (i & 1));
+ grayPattern[i] = static_cast<WORD>(0x5555 << (i & 1));
HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern);
if (grayBitmap != nullptr)
{
@@ -292,7 +292,7 @@ int Tracker::HitTest(POINT point) const
if (PtInRect(&rectTrue,point))
{
if ((m_nStyle & (resizeInside|resizeOutside)) != 0)
- hitResult = (TrackerHit)HitTestHandles(point);
+ hitResult = static_cast<TrackerHit>(HitTestHandles(point));
else
hitResult = hitMiddle;
}
@@ -325,7 +325,7 @@ BOOL Tracker::SetCursor(HWND pWnd, UINT nHitTest) const
{
// only for trackers with hatchedBorder (ie. in-place resizing)
if (m_nStyle & hatchedBorder)
- nHandle = (TrackerHit)9;
+ nHandle = TrackerHit(9);
}
::SetCursor(afxCursors[nHandle]);
@@ -408,9 +408,9 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
rectOld = m_rect;
// handle resize cases (and part of move)
if (px != nullptr)
- *px = (int)(short)LOWORD(msg.lParam) - xDiff;
+ *px = static_cast<int>(static_cast<short>(LOWORD(msg.lParam))) - xDiff;
if (py != nullptr)
- *py = (int)(short)HIWORD(msg.lParam) - yDiff;
+ *py = static_cast<int>(static_cast<short>(HIWORD(msg.lParam))) - yDiff;
// handle move case
if (nHandle == hitMiddle)
@@ -639,7 +639,7 @@ void Tracker::Draw(HDC hDC) const
{
if (mask & (1<<i))
{
- GetHandleRect((TrackerHit)i, &rect);
+ GetHandleRect(static_cast<TrackerHit>(i), &rect);
// FillSolidRect(hDC,rect, RGB(0, 0, 0));
FillRect(hDC,&rect,hbrush);
}
@@ -741,11 +741,11 @@ int Tracker::NormalizeHit(int nHandle) const
const AFX_HANDLEINFO* pHandleInfo = &afxHandleInfo[nHandle];
if (m_rect.right - m_rect.left < 0)
{
- nHandle = (TrackerHit)pHandleInfo->nInvertX;
+ nHandle = static_cast<TrackerHit>(pHandleInfo->nInvertX);
pHandleInfo = &afxHandleInfo[nHandle];
}
if (m_rect.bottom - m_rect.top < 0)
- nHandle = (TrackerHit)pHandleInfo->nInvertY;
+ nHandle = static_cast<TrackerHit>(pHandleInfo->nInvertY);
return nHandle;
}
@@ -765,9 +765,9 @@ int Tracker::HitTestHandles(POINT point) const
{
if (mask & (1<<i))
{
- GetHandleRect((TrackerHit)i, &rect);
+ GetHandleRect(static_cast<TrackerHit>(i), &rect);
if (PtInRect(&rect,point))
- return (TrackerHit)i;
+ return static_cast<TrackerHit>(i);
}
}
diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx
index c2e1fbb74ca4..cda7fff13df4 100644
--- a/extensions/source/activex/SOActiveX.cxx
+++ b/extensions/source/activex/SOActiveX.cxx
@@ -566,7 +566,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height )
if( !SUCCEEDED( hr ) ) return hr;
// initialize window
- CComVariant aTransparent( (long)0xFFFFFFFF );
+ CComVariant aTransparent( long(0xFFFFFFFF) );
hr = ExecuteFunc( mpDispWin, L"setBackground", &aTransparent, 1, &dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
@@ -671,7 +671,7 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR const * sUrl,
CComVariant aArgs[3];
aArgs[2] = CComVariant( pdispURL );
aArgs[1] = CComVariant( L"" );
- aArgs[0] = CComVariant( (int)0 );
+ aArgs[0] = CComVariant( int(0) );
hr = GetIDispByFunc( mpDispFrame,
L"queryDispatch",
aArgs,
@@ -680,7 +680,7 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR const * sUrl,
if( !SUCCEEDED( hr ) ) return hr;
SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, count );
- for( long ix = 0; ix < (long)count; ix ++ )
+ for( long ix = 0; ix < static_cast<long>(count); ix ++ )
{
CComPtr<IDispatch> pdispPropVal;
hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal );
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index c856992fbc96..91819f0239a6 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -939,7 +939,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
"[automation bridge]IUnknownWrapper_Impl::"
"invokeWithDispIdUnoTlb\n"
"Could not create out parameter at index: " +
- OUString::number((sal_Int32) i));
+ OUString::number(static_cast<sal_Int32>(i)));
}
CComPtr<IUnknown> pUnk(pParamObject->GetUnknown());
@@ -1020,7 +1020,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
{
if( pMethod->pParams[i].bOut )
{
- OutParamIndex[outIndex]= (sal_Int16) i;
+ OutParamIndex[outIndex]= static_cast<sal_Int16>(i);
Any outAny;
if( !bJScriptObject)
{
@@ -1325,7 +1325,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
{
throw InvocationTargetException(
"[automation bridge] ITypeInfo::GetIDsOfNames returned error "
- + OUString::number((sal_Int32) hr, 16), Reference<XInterface>(), Any());
+ + OUString::number(static_cast<sal_Int32>(hr), 16), Reference<XInterface>(), Any());
}
}
@@ -1693,7 +1693,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
OUStringBuffer buf(256);
buf.append("[automation bridge] There are too many arguments for this method");
throw IllegalArgumentException( buf.makeStringAndClear(),
- Reference<XInterface>(), (sal_Int16) dispparams.cArgs);
+ Reference<XInterface>(), static_cast<sal_Int16>(dispparams.cArgs));
}
//Set up the array of DISPIDs (DISPPARAMS::rgdispidNamedArgs)
@@ -1775,7 +1775,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
{
throw InvocationTargetException(
"[automation bridge] ITypeInfo::GetIDsOfNames returned error "
- + OUString::number((sal_Int32) hr, 16), Reference<XInterface>(), Any());
+ + OUString::number(static_cast<sal_Int32>(hr), 16), Reference<XInterface>(), Any());
}
}
@@ -1786,7 +1786,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
arRefArgs = ptrRefArgs.get();
try
{
- for (i = 0; i < (sal_Int32) dispparams.cArgs; i++)
+ for (i = 0; i < static_cast<sal_Int32>(dispparams.cArgs); i++)
{
revIndex= dispparams.cArgs - i -1;
arRefArgs[revIndex].byref=nullptr;
@@ -1814,7 +1814,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
buf.append(OUString::number(i));
buf.append(" (index starting at 0).");
throw IllegalArgumentException( buf.makeStringAndClear(),
- Reference<XInterface>(), (sal_Int16) i);
+ Reference<XInterface>(), static_cast<sal_Int16>(i));
}
// Property Put arguments
@@ -2008,7 +2008,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
}
catch (IllegalArgumentException & e)
{
- e.ArgumentPosition = (sal_Int16)paramIndex;
+ e.ArgumentPosition = static_cast<sal_Int16>(paramIndex);
throw;
}
catch (CannotConvertException & e)
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index 95b0e69cab79..008396ae4f96 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -554,15 +554,15 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny,
throw CannotConvertException(
"[automation bridge]UnoConversionUtilities<T>::variantToAny \n"
"Cannot convert the value of vartype :\"" +
- OUString::number((sal_Int32) var.vt) +
+ OUString::number(static_cast<sal_Int32>(var.vt)) +
"\" to the expected UNO type of type class: " +
- OUString::number((sal_Int32) ptype.getTypeClass()),
+ OUString::number(static_cast<sal_Int32>(ptype.getTypeClass())),
nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
if (bFail)
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>:variantToAny\n"
- "The provided VARIANT of type\" " + OUString::number((sal_Int32) var.vt) +
+ "The provided VARIANT of type\" " + OUString::number(static_cast<sal_Int32>(var.vt)) +
"\" is unappropriate for conversion!", Reference<XInterface>(), -1);
}
catch (const CannotConvertException &)
@@ -630,14 +630,14 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny,
"Cannot convert the value of type :\"" +
rAny.getValueTypeName() +
"\" to the expected Automation type of VARTYPE: " +
- OUString::number((sal_Int32)type),
+ OUString::number(static_cast<sal_Int32>(type)),
nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
throw BridgeRuntimeError(
"[automation bridge]UnoConversionUtilities<T>::anyToVariant \n"
"Conversion of any with " +
rAny.getValueType().getTypeName() +
- " to VARIANT with type: " + OUString::number((sal_Int32) type) +
+ " to VARIANT with type: " + OUString::number(static_cast<sal_Int32>(type)) +
" failed! Error code: " + OUString::number(hr));
}
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index f3355d2acf21..4ae722cf2111 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -253,11 +253,11 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/,
if (d.flags != 0)
{
m_MemberInfos.push_back(d);
- iter = m_nameToDispIdMap.emplace(exactName, (DISPID)m_MemberInfos.size()).first;
+ iter = m_nameToDispIdMap.emplace(exactName, static_cast<DISPID>(m_MemberInfos.size())).first;
if (exactName != name)
{
- iter = m_nameToDispIdMap.emplace(name, (DISPID)m_MemberInfos.size()).first;
+ iter = m_nameToDispIdMap.emplace(name, static_cast<DISPID>(m_MemberInfos.size())).first;
}
}
}
@@ -798,7 +798,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember,
if( bHandled)
return ret;
- if ((dispidMember > 0) && ((size_t)dispidMember <= m_MemberInfos.size()) && m_xInvocation.is())
+ if ((dispidMember > 0) && (static_cast<size_t>(dispidMember) <= m_MemberInfos.size()) && m_xInvocation.is())
{
MemberInfo d = m_MemberInfos[dispidMember - 1];
DWORD flags = wFlags & d.flags;
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
index 02ce3425d01a..052eeebf9271 100644
--- a/extensions/source/scanner/scanwin.cxx
+++ b/extensions/source/scanner/scanwin.cxx
@@ -58,8 +58,8 @@ using namespace ::com::sun::star;
#define PFUNC (*pDSM)
#define PTWAINMSG MSG*
-#define FIXTODOUBLE( nFix ) ((double)nFix.Whole+(double)nFix.Frac/65536.)
-#define FIXTOLONG( nFix ) ((long)floor(FIXTODOUBLE(nFix)+0.5))
+#define FIXTODOUBLE( nFix ) (static_cast<double>(nFix.Whole)+static_cast<double>(nFix.Frac)/65536.)
+#define FIXTOLONG( nFix ) (static_cast<long>(floor(FIXTODOUBLE(nFix)+0.5)))
#define TWAIN_FUNCNAME "DSM_Entry"
#if defined(TWH_64BIT)
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
index ea7b2cd1ba86..c9071db403f6 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx
@@ -249,7 +249,7 @@ public:
virtual void doRequest(const RequestRef& rRequest) override
{
const ::sal_Int32 nEventID = rRequest->getRequest();
- const ::sal_Int16 nControlID = rRequest->getArgumentOrDefault(PROP_CONTROL_ID, (::sal_Int16)0);
+ const ::sal_Int16 nControlID = rRequest->getArgumentOrDefault(PROP_CONTROL_ID, ::sal_Int16(0));
const css::uno::Reference< css::ui::dialogs::XFilePickerListener > xListener = rRequest->getArgumentOrDefault(PROP_PICKER_LISTENER, css::uno::Reference< css::ui::dialogs::XFilePickerListener >());
if ( ! xListener.is())
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index 04a7b0530818..759228ffeae3 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -426,8 +426,8 @@ void VistaFilePickerImpl::impl_sta_CreateOpenDialog(const RequestRef& rRequest)
iDialog->SetOptions ( nFlags );
- ::sal_Int32 nFeatures = rRequest->getArgumentOrDefault(PROP_FEATURES, (::sal_Int32)0);
- ::sal_Int32 nTemplate = rRequest->getArgumentOrDefault(PROP_TEMPLATE_DESCR, (::sal_Int32)0);
+ ::sal_Int32 nFeatures = rRequest->getArgumentOrDefault(PROP_FEATURES, ::sal_Int32(0));
+ ::sal_Int32 nTemplate = rRequest->getArgumentOrDefault(PROP_TEMPLATE_DESCR, ::sal_Int32(0));
impl_sta_enableFeatures(nFeatures, nTemplate);
VistaFilePickerEventHandler* pHandlerImpl = static_cast<VistaFilePickerEventHandler*>(iHandler.get());
@@ -463,8 +463,8 @@ void VistaFilePickerImpl::impl_sta_CreateSaveDialog(const RequestRef& rRequest)
iDialog->SetOptions ( nFlags );
- ::sal_Int32 nFeatures = rRequest->getArgumentOrDefault(PROP_FEATURES, (::sal_Int32)0);
- ::sal_Int32 nTemplate = rRequest->getArgumentOrDefault(PROP_TEMPLATE_DESCR, (::sal_Int32)0);
+ ::sal_Int32 nFeatures = rRequest->getArgumentOrDefault(PROP_FEATURES, ::sal_Int32(0));
+ ::sal_Int32 nTemplate = rRequest->getArgumentOrDefault(PROP_TEMPLATE_DESCR, ::sal_Int32(0));
css::uno::Reference<css::awt::XWindow> xWindow = rRequest->getArgumentOrDefault(PROP_PARENT_WINDOW, css::uno::Reference<css::awt::XWindow>());
if(xWindow.is())
{
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index f0cf32b8d0c9..6f8af44c358a 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -480,7 +480,7 @@ void CMtaFolderPicker::onInitialized( )
SendMessageW(
m_hwnd,
BFFM_SETSELECTION,
- (WPARAM)false,
+ WPARAM(false),
reinterpret_cast<LPARAM>(lpiidDisplayDir) );
releaseItemIdList( lpiidDisplayDir );
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index f4b809f48a33..d20c1b8ea783 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -547,7 +547,7 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
}
#ifdef _WIN32
int j;
- for(j = 0 ; j < (int)strlen( dirname ) ; j++)
+ for(j = 0 ; j < static_cast<int>(strlen( dirname )) ; j++)
{
if( dirname[j] == '\\' ) buf[j] = '/';
else buf[j] = dirname[j];
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index ab51add16edb..671ce5634f82 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -531,7 +531,7 @@ static void do_msvcr_magic(OUString const &jvm_dll)
if (fread(dos_hdr, st.st_size, 1, f) != 1 ||
memcmp(dos_hdr, "MZ", 2) != 0 ||
dos_hdr->e_lfanew < 0 ||
- dos_hdr->e_lfanew > (LONG) (st.st_size - sizeof(IMAGE_NT_HEADERS)))
+ dos_hdr->e_lfanew > static_cast<LONG>(st.st_size - sizeof(IMAGE_NT_HEADERS)))
{
SAL_WARN("jfw", "analyzing <" << Module << "> failed");
free(dos_hdr);
@@ -570,7 +570,7 @@ static void do_msvcr_magic(OUString const &jvm_dll)
while (imports <= reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR *>(reinterpret_cast<char *>(dos_hdr) + st.st_size - sizeof (IMAGE_IMPORT_DESCRIPTOR)) &&
imports->Name != 0 &&
- imports->Name + VAtoPhys < (DWORD) st.st_size)
+ imports->Name + VAtoPhys < static_cast<DWORD>(st.st_size))
{
static OUStringLiteral msvcrts[] =
{
diff --git a/sal/osl/w32/backtrace.cxx b/sal/osl/w32/backtrace.cxx
index e5a6e5873e68..160d4e7d0207 100644
--- a/sal/osl/w32/backtrace.cxx
+++ b/sal/osl/w32/backtrace.cxx
@@ -61,11 +61,11 @@ OUString osl::detail::backtraceAsString(sal_uInt32 maxDepth)
for( sal_uInt32 i = 0; i < nFrames; i++ )
{
SymFromAddr( hProcess, reinterpret_cast<DWORD64>(aStack[ i ]), nullptr, pSymbol );
- aBuf.append( (sal_Int32)(nFrames - i - 1) );
+ aBuf.append( static_cast<sal_Int32>(nFrames - i - 1) );
aBuf.append( ": " );
aBuf.appendAscii( pSymbol->Name );
aBuf.append( " - 0x" );
- aBuf.append( (sal_Int64)pSymbol->Address, 16 );
+ aBuf.append( static_cast<sal_Int64>(pSymbol->Address), 16 );
aBuf.append( "\n" );
}
@@ -107,11 +107,11 @@ OUString sal::backtrace_to_string(BacktraceState* backtraceState)
for( int i = 0; i < nFrames; i++ )
{
SymFromAddr( hProcess, reinterpret_cast<DWORD64>(backtraceState->buffer[ i ]), nullptr, pSymbol );
- aBuf.append( (sal_Int32)(nFrames - i - 1) );
+ aBuf.append( static_cast<sal_Int32>(nFrames - i - 1) );
aBuf.append( ": " );
aBuf.appendAscii( pSymbol->Name );
aBuf.append( " - 0x" );
- aBuf.append( (sal_Int64)pSymbol->Address, 16 );
+ aBuf.append( static_cast<sal_Int64>(pSymbol->Address), 16 );
aBuf.append( "\n" );
}
diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx
index 77d16e9fb5d4..ffdaeb80dac9 100644
--- a/sal/osl/w32/dllentry.cxx
+++ b/sal/osl/w32/dllentry.cxx
@@ -216,7 +216,7 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
{
DWORD dwThreadId = 0;
- DWORD_PTR dwParentProcessId = (DWORD_PTR)_wtol( szBuffer );
+ DWORD_PTR dwParentProcessId = static_cast<DWORD_PTR>(_wtol( szBuffer ));
if ( dwParentProcessId && GetParentProcessId() == dwParentProcessId )
{
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index 1a08315742ba..aed1b315bb9e 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -253,7 +253,7 @@ oslFileError FileHandle_Impl::setPos(sal_uInt64 uPos)
sal_uInt64 FileHandle_Impl::getSize() const
{
- LONGLONG bufend = std::max((LONGLONG)0, m_bufptr) + m_buflen;
+ LONGLONG bufend = std::max(LONGLONG(0), m_bufptr) + m_buflen;
return std::max(m_size, sal::static_int_cast< sal_uInt64 >(bufend));
}
@@ -407,7 +407,7 @@ oslFileError FileHandle_Impl::readFileAt(
return osl_File_E_None;
}
- SIZE_T const bytes = std::min(m_buflen - bufpos, (SIZE_T) nBytesRequested);
+ SIZE_T const bytes = std::min(m_buflen - bufpos, static_cast<SIZE_T>(nBytesRequested));
memcpy(&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes);
nBytesRequested -= bytes;
*pBytesRead += bytes;
@@ -482,7 +482,7 @@ oslFileError FileHandle_Impl::writeFileAt(
m_buflen = sal::static_int_cast< SIZE_T >(uDone);
}
- SIZE_T const bytes = std::min(m_bufsiz - bufpos, (SIZE_T) nBytesToWrite);
+ SIZE_T const bytes = std::min(m_bufsiz - bufpos, static_cast<SIZE_T>(nBytesToWrite));
memcpy(&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes);
nBytesToWrite -= bytes;
*pBytesWritten += bytes;
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index d59932e315fc..1ae8d33c0b78 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -57,7 +57,7 @@ BOOL TimeValueToFileTime(const TimeValue *cpTimeVal, FILETIME *pFTime)
{
__int64 timeValue;
- __int64 localTime = cpTimeVal->Seconds*(__int64)10000000+cpTimeVal->Nanosec/100;
+ __int64 localTime = cpTimeVal->Seconds*__int64(10000000)+cpTimeVal->Nanosec/100;
osl::detail::setFiletime(FTime, localTime);
fSuccess = 0 <= (timeValue= osl::detail::getFiletime(BaseFileTime) + osl::detail::getFiletime(FTime));
if (fSuccess)
@@ -89,8 +89,8 @@ BOOL FileTimeToTimeValue(const FILETIME *cpFTime, TimeValue *pTimeVal)
if ( fSuccess )
{
- pTimeVal->Seconds = (unsigned long) (Value / 10000000L);
- pTimeVal->Nanosec = (unsigned long)((Value % 10000000L) * 100);
+ pTimeVal->Seconds = static_cast<unsigned long>(Value / 10000000L);
+ pTimeVal->Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100);
}
}
return fSuccess;
@@ -1630,7 +1630,7 @@ oslFileError SAL_CALL osl_getFileStatus(
pStatus->uAttributes = pItemImpl->FindData.dwFileAttributes;
pStatus->uValidFields |= osl_FileStatus_Mask_Attributes;
- pStatus->uFileSize = (sal_uInt64)pItemImpl->FindData.nFileSizeLow + ((sal_uInt64)pItemImpl->FindData.nFileSizeHigh << 32);
+ pStatus->uFileSize = static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeLow) + (static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeHigh) << 32);
pStatus->uValidFields |= osl_FileStatus_Mask_FileSize;
if ( uFieldMask & osl_FileStatus_Mask_LinkTargetURL )
@@ -1685,7 +1685,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
dwFileAttributes = GetFileAttributesW( o3tl::toW(rtl_uString_getStr(ustrSysPath)) );
- if ( (DWORD)-1 != dwFileAttributes )
+ if ( DWORD(-1) != dwFileAttributes )
{
dwFileAttributes &= ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN);
diff --git a/sal/osl/w32/file_error.cxx b/sal/osl/w32/file_error.cxx
index da71664b6fdb..5336c17fd970 100644
--- a/sal/osl/w32/file_error.cxx
+++ b/sal/osl/w32/file_error.cxx
@@ -103,7 +103,7 @@ oslFileError oslTranslateFileError (/*DWORD*/ unsigned long dwError)
for (i = 0; i < n; ++i )
{
if (dwError == errtable[i].oscode)
- return (oslFileError)(errtable[i].errnocode);
+ return static_cast<oslFileError>(errtable[i].errnocode);
}
/* The error code wasn't in the table. We check for a range of
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index f89f2033e168..9b5cb51b110a 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -513,7 +513,7 @@ static bool osl_decodeURL_( rtl_String* strUTF8, rtl_uString** pstrDecodedURL )
aToken[1] = *pSrc++;
aToken[2] = 0;
- aChar = (sal_Char)strtoul( aToken, nullptr, 16 );
+ aChar = static_cast<sal_Char>(strtoul( aToken, nullptr, 16 ));
/* The chars are path delimiters and must not be encoded */
@@ -575,7 +575,7 @@ static void osl_encodeURL_( rtl_uString *strURL, rtl_String **pstrEncodedURL )
default:
if (!( ( cCurrent >= 'a' && cCurrent <= 'z' ) || ( cCurrent >= 'A' && cCurrent <= 'Z' ) || ( cCurrent >= '0' && cCurrent <= '9' ) ) )
{
- sprintf( pURLDest, "%%%02X", (unsigned char)cCurrent );
+ sprintf( pURLDest, "%%%02X", static_cast<unsigned char>(cCurrent) );
pURLDest += 3;
break;
}
diff --git a/sal/osl/w32/nlsupport.cxx b/sal/osl/w32/nlsupport.cxx
index 5c937ed6de39..1de8cb780dd1 100644
--- a/sal/osl/w32/nlsupport.cxx
+++ b/sal/osl/w32/nlsupport.cxx
@@ -56,7 +56,7 @@ struct EnumLocalesParams
LCID Locale;
};
-static DWORD g_dwTLSLocaleEncId = (DWORD) -1;
+static DWORD g_dwTLSLocaleEncId = DWORD(-1);
/*****************************************************************************
* callback function test
@@ -148,14 +148,14 @@ rtl_TextEncoding SAL_CALL osl_getTextEncodingFromLocale( rtl_Locale * pLocale )
struct EnumLocalesParams params = { L"", L"", 0 };
/* initialise global TLS id */
- if( (DWORD) -1 == g_dwTLSLocaleEncId )
+ if( DWORD(-1) == g_dwTLSLocaleEncId )
{
oslMutex globalMutex = * osl_getGlobalMutex();
/* initializing must be thread save */
osl_acquireMutex( globalMutex );
- if( (DWORD) -1 == g_dwTLSLocaleEncId )
+ if( DWORD(-1) == g_dwTLSLocaleEncId )
g_dwTLSLocaleEncId = TlsAlloc();
osl_releaseMutex( globalMutex );
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index febc4f19c562..b61526f3edf6 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -386,7 +386,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
if (lastError == ERROR_PIPE_NOT_CONNECTED)
nBytes = 0;
else
- nBytes = (DWORD) -1;
+ nBytes = DWORD(-1);
pPipe->m_Error = osl_Pipe_E_ConnectionAbort;
}
@@ -415,7 +415,7 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe,
if (GetLastError() == ERROR_PIPE_NOT_CONNECTED)
nBytes = 0;
else
- nBytes = (DWORD) -1;
+ nBytes = DWORD(-1);
pPipe->m_Error = osl_Pipe_E_ConnectionAbort;
}
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index e17d43a787a5..897b88a1767e 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -147,7 +147,7 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident)
{
oslProcessImpl* pProcImpl;
HANDLE hProcess = OpenProcess(
- STANDARD_RIGHTS_REQUIRED | PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, (DWORD)Ident);
+ STANDARD_RIGHTS_REQUIRED | PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, static_cast<DWORD>(Ident));
if (hProcess)
{
@@ -222,7 +222,7 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F
lpAddress = static_cast<LPBYTE>(lpAddress) + Info.RegionSize;
}
- while (reinterpret_cast<uintptr_t>(lpAddress) <= (uintptr_t)0x7FFFFFFF); // 2GB address space
+ while (reinterpret_cast<uintptr_t>(lpAddress) <= uintptr_t(0x7FFFFFFF)); // 2GB address space
pInfo->Fields |= osl_Process_HEAPUSAGE;
}
@@ -237,12 +237,12 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F
__int64 Value;
Value = osl::detail::getFiletime(UserTime);
- pInfo->UserTime.Seconds = (unsigned long) (Value / 10000000L);
- pInfo->UserTime.Nanosec = (unsigned long)((Value % 10000000L) * 100);
+ pInfo->UserTime.Seconds = static_cast<unsigned long>(Value / 10000000L);
+ pInfo->UserTime.Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100);
Value = osl::detail::getFiletime(KernelTime);
- pInfo->SystemTime.Seconds = (unsigned long) (Value / 10000000L);
- pInfo->SystemTime.Nanosec = (unsigned long)((Value % 10000000L) * 100);
+ pInfo->SystemTime.Seconds = static_cast<unsigned long>(Value / 10000000L);
+ pInfo->SystemTime.Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100);
pInfo->Fields |= osl_Process_CPUTIMES;
}
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index d4e0ed6e5dbb..b9fd1dc6e646 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -1207,7 +1207,7 @@ static bool getLine(osl_TFile* pFile, sal_Char *pszLine, int MaxLen)
(pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1));
pChr++);
- Max = min((int) (pChr - pFile->m_pReadPtr), MaxLen);
+ Max = min(static_cast<int>(pChr - pFile->m_pReadPtr), MaxLen);
memcpy(pLine, pFile->m_pReadPtr, Max);
MaxLen -= Max;
pLine += Max;
diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx
index 986afc83412e..8192dbbb6ded 100644
--- a/sal/osl/w32/security.cxx
+++ b/sal/osl/w32/security.cxx
@@ -329,21 +329,21 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
{
dwSidSize+=wsprintfW(o3tl::toW(Ident) + wcslen(o3tl::toW(Ident)),
L"0x%02hx%02hx%02hx%02hx%02hx%02hx",
- (USHORT)psia->Value[0],
- (USHORT)psia->Value[1],
- (USHORT)psia->Value[2],
- (USHORT)psia->Value[3],
- (USHORT)psia->Value[4],
- (USHORT)psia->Value[5]);
+ static_cast<USHORT>(psia->Value[0]),
+ static_cast<USHORT>(psia->Value[1]),
+ static_cast<USHORT>(psia->Value[2]),
+ static_cast<USHORT>(psia->Value[3]),
+ static_cast<USHORT>(psia->Value[4]),
+ static_cast<USHORT>(psia->Value[5]));
}
else
{
dwSidSize+=wsprintfW(o3tl::toW(Ident) + wcslen(o3tl::toW(Ident)),
L"%lu",
- (ULONG)(psia->Value[5] ) +
- (ULONG)(psia->Value[4] << 8) +
- (ULONG)(psia->Value[3] << 16) +
- (ULONG)(psia->Value[2] << 24) );
+ static_cast<ULONG>(psia->Value[5] ) +
+ static_cast<ULONG>(psia->Value[4] << 8) +
+ static_cast<ULONG>(psia->Value[3] << 16) +
+ static_cast<ULONG>(psia->Value[2] << 24) );
}
/* loop through SidSubAuthorities */
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index a369d7ab8d87..bf27bba1a04d 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -65,18 +65,18 @@ static DWORD FamilyMap[]= {
static oslAddrFamily osl_AddrFamilyFromNative(DWORD nativeType)
{
- oslAddrFamily i= (oslAddrFamily) 0;
+ oslAddrFamily i= oslAddrFamily(0);
while(i != osl_Socket_FamilyInvalid)
{
if(FamilyMap[i] == nativeType)
return i;
- i = (oslAddrFamily) ( (int)i + 1);
+ i = static_cast<oslAddrFamily>( static_cast<int>(i) + 1);
}
return i;
}
#define FAMILY_FROM_NATIVE(y) osl_AddrFamilyFromNative(y)
-#define FAMILY_TO_NATIVE(x) (short)FamilyMap[x]
+#define FAMILY_TO_NATIVE(x) static_cast<short>(FamilyMap[x])
static DWORD ProtocolMap[]= {
0, /* osl_Socket_FamilyInet */
@@ -99,12 +99,12 @@ static DWORD TypeMap[]= {
static oslSocketType osl_SocketTypeFromNative(DWORD nativeType)
{
- oslSocketType i= (oslSocketType)0;
+ oslSocketType i= oslSocketType(0);
while(i != osl_Socket_TypeInvalid)
{
if(TypeMap[i] == nativeType)
return i;
- i = (oslSocketType)((int)i+1);
+ i = static_cast<oslSocketType>(static_cast<int>(i)+1);
}
return i;
}
@@ -197,14 +197,14 @@ static int SocketError[]= {
static oslSocketError osl_SocketErrorFromNative(int nativeType)
{
- oslSocketError i= (oslSocketError)0;
+ oslSocketError i= oslSocketError(0);
while(i != osl_Socket_E_InvalidError)
{
if(SocketError[i] == nativeType)
return i;
- i = (oslSocketError)( (int) i + 1);
+ i = static_cast<oslSocketError>( static_cast<int>(i) + 1);
}
return i;
}
@@ -263,7 +263,7 @@ static oslSocketAddr createSocketAddrWithFamily(
pInetAddr->sin_family = FAMILY_TO_NATIVE(osl_Socket_FamilyInet);
pInetAddr->sin_addr.s_addr = nAddr;
- pInetAddr->sin_port = (sal_uInt16)(port&0xffff);
+ pInetAddr->sin_port = static_cast<sal_uInt16>(port&0xffff);
break;
}
default:
@@ -394,7 +394,7 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
}
oslSocketAddr pAddr =
- createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( (sal_uInt16) Port), nAddr );
+ createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( static_cast<sal_uInt16>(Port)), nAddr );
return pAddr;
}
@@ -411,7 +411,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr (
oslSocketAddr pAddr = nullptr;
if(Addr != OSL_INADDR_NONE)
{
- pAddr = createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( (sal_uInt16)Port), Addr );
+ pAddr = createSocketAddrWithFamily( osl_Socket_FamilyInet, htons( static_cast<sal_uInt16>(Port)), Addr );
}
return pAddr;
}
@@ -723,7 +723,7 @@ sal_Bool SAL_CALL osl_setInetPortOfSocketAddr (
if (pSystemInetAddr->sin_family != FAMILY_TO_NATIVE(osl_Socket_FamilyInet))
return false;
- pSystemInetAddr->sin_port= htons((short)Port);
+ pSystemInetAddr->sin_port= htons(static_cast<short>(Port));
return true;
}
diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx
index 1e347dc3ebd5..716e299f2a50 100644
--- a/sal/osl/w32/thread.cxx
+++ b/sal/osl/w32/thread.cxx
@@ -134,9 +134,9 @@ oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread)
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
if (pThreadImpl != nullptr)
- return (oslThreadIdentifier)pThreadImpl->m_ThreadId;
+ return static_cast<oslThreadIdentifier>(pThreadImpl->m_ThreadId);
else
- return (oslThreadIdentifier)GetCurrentThreadId();
+ return static_cast<oslThreadIdentifier>(GetCurrentThreadId());
}
void SAL_CALL osl_destroyThread(oslThread Thread)
@@ -366,7 +366,7 @@ void SAL_CALL osl_setThreadName(char const * name) {
#pragma pack(pop)
info.dwType = 0x1000;
info.szName = name;
- info.dwThreadID = (DWORD) -1;
+ info.dwThreadID = DWORD(-1);
info.dwFlags = 0;
__try {
RaiseException(
@@ -453,7 +453,7 @@ oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback
if ( pTls )
{
pTls->pfnCallback = pCallback;
- if ( (DWORD)-1 == (pTls->dwIndex = TlsAlloc()) )
+ if ( DWORD(-1) == (pTls->dwIndex = TlsAlloc()) )
{
rtl_freeMemory( pTls );
pTls = nullptr;
@@ -511,7 +511,7 @@ sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData)
return false;
}
-DWORD g_dwTLSTextEncodingIndex = (DWORD)-1;
+DWORD g_dwTLSTextEncodingIndex = DWORD(-1);
rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
{
@@ -519,7 +519,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
rtl_TextEncoding _encoding;
BOOL gotACP;
- if ( (DWORD)-1 == g_dwTLSTextEncodingIndex )
+ if ( DWORD(-1) == g_dwTLSTextEncodingIndex )
g_dwTLSTextEncodingIndex = TlsAlloc();
dwEncoding = reinterpret_cast<DWORD_PTR>(TlsGetValue( g_dwTLSTextEncodingIndex ));
@@ -529,7 +529,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
if ( !gotACP )
{
_encoding = rtl_getTextEncodingFromWindowsCodePage( GetACP() );
- TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>((DWORD_PTR)MAKELONG( _encoding, TRUE )) );
+ TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>(static_cast<DWORD_PTR>(MAKELONG( _encoding, TRUE ))) );
}
return _encoding;
@@ -539,7 +539,7 @@ rtl_TextEncoding SAL_CALL osl_setThreadTextEncoding( rtl_TextEncoding Encoding )
{
rtl_TextEncoding oldEncoding = osl_getThreadTextEncoding();
- TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>((DWORD_PTR)MAKELONG( Encoding, TRUE)) );
+ TlsSetValue( g_dwTLSTextEncodingIndex, reinterpret_cast<LPVOID>(static_cast<DWORD_PTR>(MAKELONG( Encoding, TRUE))) );
return oldEncoding;
}
diff --git a/sal/osl/w32/time.cxx b/sal/osl/w32/time.cxx
index 51f05ab30a4c..d1284b663fae 100644
--- a/sal/osl/w32/time.cxx
+++ b/sal/osl/w32/time.cxx
@@ -70,8 +70,8 @@ sal_Bool SAL_CALL osl_getSystemTime(TimeValue* pTimeVal)
Value = *reinterpret_cast<__int64 *>(&CurTime) - *reinterpret_cast<__int64 *>(&OffTime);
- pTimeVal->Seconds = (unsigned long) (Value / 10000000L);
- pTimeVal->Nanosec = (unsigned long)((Value % 10000000L) * 100);
+ pTimeVal->Seconds = static_cast<unsigned long>(Value / 10000000L);
+ pTimeVal->Nanosec = static_cast<unsigned long>((Value % 10000000L) * 100);
return true;
}
@@ -143,9 +143,9 @@ sal_Bool SAL_CALL osl_getLocalTimeFromSystemTime( const TimeValue* pSystemTimeVa
if ( Success== TIME_ZONE_ID_DAYLIGHT )
bias+=aTimeZoneInformation.DaylightBias;
- if ( (sal_Int64) pSystemTimeVal->Seconds > ( bias * 60 ) )
+ if ( static_cast<sal_Int64>(pSystemTimeVal->Seconds) > ( bias * 60 ) )
{
- pLocalTimeVal->Seconds = (sal_uInt32) (pSystemTimeVal->Seconds - ( bias * 60) );
+ pLocalTimeVal->Seconds = static_cast<sal_uInt32>(pSystemTimeVal->Seconds - ( bias * 60) );
pLocalTimeVal->Nanosec = pSystemTimeVal->Nanosec;
return true;
@@ -170,9 +170,9 @@ sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime( const TimeValue* pLocalTimeVal
if ( Success== TIME_ZONE_ID_DAYLIGHT )
bias+=aTimeZoneInformation.DaylightBias;
- if ( (sal_Int64) pLocalTimeVal->Seconds + ( bias * 60 ) > 0 )
+ if ( static_cast<sal_Int64>(pLocalTimeVal->Seconds) + ( bias * 60 ) > 0 )
{
- pSystemTimeVal->Seconds = (sal_uInt32) ( pLocalTimeVal->Seconds + ( bias * 60) );
+ pSystemTimeVal->Seconds = static_cast<sal_uInt32>( pLocalTimeVal->Seconds + ( bias * 60) );
pSystemTimeVal->Nanosec = pLocalTimeVal->Nanosec;
return true;
@@ -195,9 +195,9 @@ sal_uInt32 SAL_CALL osl_getGlobalTimer(void)
_ftime( ¤tTime );
- nSeconds = (sal_uInt32)( currentTime.time - startTime.time );
+ nSeconds = static_cast<sal_uInt32>( currentTime.time - startTime.time );
- return ( nSeconds * 1000 ) + (long)( currentTime.millitm - startTime.millitm );
+ return ( nSeconds * 1000 ) + static_cast<long>( currentTime.millitm - startTime.millitm );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 7a1d60b5c780..5d7ebe2905dc 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -488,7 +488,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
psia=GetSidIdentifierAuthority(pSid);
/* obtain sidsubauthority count */
- dwSubAuthorities=std::min((int) *GetSidSubAuthorityCount(pSid), 5);
+ dwSubAuthorities=std::min(static_cast<int>(*GetSidSubAuthorityCount(pSid)), 5);
/* buffer length: S-SID_REVISION- + identifierauthority- + subauthorities- + NULL */
Ident=static_cast<wchar_t *>(malloc(88*sizeof(wchar_t)));
@@ -501,21 +501,21 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
{
dwSidSize+=wsprintfW(Ident + wcslen(Ident),
L"0x%02hx%02hx%02hx%02hx%02hx%02hx",
- (sal_uInt16)psia->Value[0],
- (sal_uInt16)psia->Value[1],
- (sal_uInt16)psia->Value[2],
- (sal_uInt16)psia->Value[3],
- (sal_uInt16)psia->Value[4],
- (sal_uInt16)psia->Value[5]);
+ static_cast<sal_uInt16>(psia->Value[0]),
+ static_cast<sal_uInt16>(psia->Value[1]),
+ static_cast<sal_uInt16>(psia->Value[2]),
+ static_cast<sal_uInt16>(psia->Value[3]),
+ static_cast<sal_uInt16>(psia->Value[4]),
+ static_cast<sal_uInt16>(psia->Value[5]));
}
else
{
dwSidSize+=wsprintfW(Ident + wcslen(Ident),
L"%lu",
- (sal_uInt32)(psia->Value[5] ) +
- (sal_uInt32)(psia->Value[4] << 8) +
- (sal_uInt32)(psia->Value[3] << 16) +
- (sal_uInt32)(psia->Value[2] << 24) );
+ static_cast<sal_uInt32>(psia->Value[5] ) +
+ static_cast<sal_uInt32>(psia->Value[4] << 8) +
+ static_cast<sal_uInt32>(psia->Value[3] << 16) +
+ static_cast<sal_uInt32>(psia->Value[2] << 24) );
}
/* loop through SidSubAuthorities */
diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx
index 2d1d17c1378b..0ea1a39167ea 100644
--- a/sal/rtl/alloc_arena.cxx
+++ b/sal/rtl/alloc_arena.cxx
@@ -1062,7 +1062,7 @@ void * rtl_machdep_alloc(
#if defined(SAL_UNX)
addr = mmap (nullptr, static_cast<size_t>(size), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
#elif defined(_WIN32)
- addr = VirtualAlloc (nullptr, (SIZE_T)size, MEM_COMMIT, PAGE_READWRITE);
+ addr = VirtualAlloc (nullptr, static_cast<SIZE_T>(size), MEM_COMMIT, PAGE_READWRITE);
#endif /* (SAL_UNX || _WIN32) */
if (addr != MAP_FAILED)
@@ -1092,7 +1092,7 @@ void rtl_machdep_free(
#if defined(SAL_UNX)
(void) munmap(pAddr, nSize);
#elif defined(_WIN32)
- (void) VirtualFree (pAddr, (SIZE_T)0, MEM_RELEASE);
+ (void) VirtualFree (pAddr, SIZE_T(0), MEM_RELEASE);
#endif /* (SAL_UNX || _WIN32) */
}
@@ -1107,7 +1107,7 @@ sal_Size rtl_machdep_pagesize()
#elif defined(_WIN32)
SYSTEM_INFO info;
GetSystemInfo (&info);
- return (sal_Size)info.dwPageSize;
+ return static_cast<sal_Size>(info.dwPageSize);
#endif /* (SAL_UNX || _WIN32) */
}
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index a753b2060d20..56357d25ac38 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -1252,7 +1252,7 @@ static void rtl_cache_wsupdate_wait(unsigned int seconds)
if (seconds > 0)
{
RTL_MEMORY_LOCK_RELEASE(&(g_cache_list.m_lock));
- WaitForSingleObject (g_cache_list.m_update_cond, (DWORD)(seconds * 1000));
+ WaitForSingleObject (g_cache_list.m_update_cond, static_cast<DWORD>(seconds * 1000));
RTL_MEMORY_LOCK_ACQUIRE(&(g_cache_list.m_lock));
}
}
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index 28f0857986ac..d943f5af9a38 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -555,7 +555,7 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
aGrammar,
boost::spirit::space_p );
#if OSL_DEBUG_LEVEL > 0
- SAL_INFO("sdext.pdfimport.pdfparse", "parseinfo: stop = " << aInfo.stop << " (buff=" << pBuffer << ", offset = " << aInfo.stop - pBuffer << "), hit = " << (aInfo.hit ? OUString("true") : OUString("false")) << ", full = " << (aInfo.full ? OUString("true") : OUString("false")) << ", length = " << (int)aInfo.length );
+ SAL_INFO("sdext.pdfimport.pdfparse", "parseinfo: stop = " << aInfo.stop << " (buff=" << pBuffer << ", offset = " << aInfo.stop - pBuffer << "), hit = " << (aInfo.hit ? OUString("true") : OUString("false")) << ", full = " << (aInfo.full ? OUString("true") : OUString("false")) << ", length = " << static_cast<int>(aInfo.length) );
#endif
}
catch( const parser_error<const char*, const char*>& rError )
@@ -602,7 +602,7 @@ PDFEntry* PDFReader::read( const char* pFileName )
if( fp )
{
fseek( fp, 0, SEEK_END );
- unsigned int nLen = (unsigned int)ftell( fp );
+ unsigned int nLen = static_cast<unsigned int>(ftell( fp ));
fseek( fp, 0, SEEK_SET );
char* pBuf = static_cast<char*>(rtl_allocateMemory( nLen ));
if( pBuf )
diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx
index 419bf385d02e..aaf8e3ffe7b3 100644
--- a/setup_native/source/win32/customactions/sellang/sellang.cxx
+++ b/setup_native/source/win32/customactions/sellang/sellang.cxx
@@ -175,7 +175,7 @@ enum_ui_lang_proc (LPTSTR language, LONG_PTR /* unused_lParam */)
long langid = strtol(language, nullptr, 16);
if (langid > 0xFFFF)
return TRUE;
- add_ui_lang(langid_to_string((LANGID) langid));
+ add_ui_lang(langid_to_string(static_cast<LANGID>(langid)));
if (num_ui_langs == SAL_N_ELEMENTS(ui_langs) )
return FALSE;
return TRUE;
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index d91b7c3f05b9..01db07340973 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -640,7 +640,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) );
- DrawStateW( lpdis->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hIcon), (WPARAM)0, x, y+(height-cy)/2, 0, 0, DST_ICON | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) );
+ DrawStateW( lpdis->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hIcon), WPARAM(0), x, y+(height-cy)/2, 0, 0, DST_ICON | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) );
DeleteObject( hbrIcon );
@@ -663,7 +663,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
SIZE size;
GetTextExtentPointW( lpdis->hDC, o3tl::toW(pMyItem->text.getStr()), pMyItem->text.getLength(), &size );
- DrawStateW( lpdis->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(pMyItem->text.getStr()), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) );
+ DrawStateW( lpdis->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(pMyItem->text.getStr()), WPARAM(0), aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) );
// Restore the original font and colors.
DeleteObject( SelectObject( lpdis->hDC, hbrOld ) );
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index a4e4d63e5a53..644aa40c687c 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -143,7 +143,7 @@ namespace
for ( i = 0; i < ERRTABLESIZE; ++i )
{
if ( dwError == errtable[i].oscode )
- return (oslFileError)errtable[i].errnocode;
+ return static_cast<oslFileError>(errtable[i].errnocode);
}
/* The error code wasn't in the table. We check for a range of */
diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx b/shell/source/win32/shlxthandler/infotips/infotips.cxx
index 682fb3478eef..088eb8e5a983 100644
--- a/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -150,7 +150,7 @@ std::wstring formatSizeOfFile( DWORD dwSize )
char *buffer=nullptr;
int decimal, sign;
- double dFileSize = (double)dwSize/KB;
+ double dFileSize = static_cast<double>(dwSize)/KB;
buffer = _fcvt( dFileSize, 1, &decimal, &sign );
diff --git a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx
index 88a194e9a603..222c9342d9ea 100644
--- a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx
@@ -149,7 +149,7 @@ BOOL CFullPropSpec::SetProperty( WCHAR const * wcsProperty )
CoTaskMemFree( _psProperty.lpwstr );
}
_psProperty.ulKind = PRSPEC_LPWSTR;
- int len = (int) ( (wcslen( wcsProperty ) + 1) * sizeof( WCHAR ) );
+ int len = static_cast<int>( (wcslen( wcsProperty ) + 1) * sizeof( WCHAR ) );
_psProperty.lpwstr = static_cast<WCHAR *>(CoTaskMemAlloc( len ));
if ( nullptr != _psProperty.lpwstr )
{
diff --git a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
index 3c734be76fe4..0d0e475ef678 100644
--- a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
@@ -59,7 +59,7 @@ unsigned long BufferStream::sread (unsigned char *buf, unsigned long size)
if (hr == S_OK)
return newsize;
else
- return (unsigned long)0;
+ return static_cast<unsigned long>(0);
}
long BufferStream::stell ()
@@ -72,7 +72,7 @@ long BufferStream::stell ()
hr = stream->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
if (hr == S_OK)
- return (long) NewPosition.QuadPart;
+ return static_cast<long>(NewPosition.QuadPart);
else
return -1;
}
@@ -82,7 +82,7 @@ long BufferStream::sseek (long offset, int origin)
HRESULT hr;
LARGE_INTEGER Move;
DWORD dwOrigin;
- Move.QuadPart = (__int64)offset;
+ Move.QuadPart = static_cast<__int64>(offset);
switch (origin)
{
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
index dd71a44f2390..655f1c6cadde 100644
--- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -285,7 +285,7 @@ void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader )
OutputDebugStringFormatW( L"CPropertyHdl: LoadProperties\n" );
PROPVARIANT propvarValues;
- for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
+ for ( UINT i = 0; i < UINT(gPropertyMapTableSize); ++i )
{
PropVariantClear( &propvarValues );
HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues);
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 4fe52c351bc9..87a125a21b1a 100644
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -194,7 +194,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Read(void *pv, ULONG cb, ULONG *pcb
HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *)
{
- __int64 size = (__int64) ref_zip_buffer_.size();
+ __int64 size = static_cast<__int64>(ref_zip_buffer_.size());
__int64 p = 0;
switch (dwOrigin)
@@ -202,7 +202,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD
case STREAM_SEEK_SET:
break;
case STREAM_SEEK_CUR:
- p = (__int64) pos_;
+ p = static_cast<__int64>(pos_);
break;
case STREAM_SEEK_END:
p = size - 1;
@@ -215,7 +215,7 @@ HRESULT STDMETHODCALLTYPE StreamOnZipBuffer::Seek(LARGE_INTEGER dlibMove, DWORD
if ( ( p >= 0 ) && (p < size) )
{
- pos_ = (size_t) p;
+ pos_ = static_cast<size_t>(p);
hr = S_OK;
}
return hr;
diff --git a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
index 12ed69e549cf..c55d9513b67c 100644
--- a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
+++ b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
@@ -50,13 +50,13 @@ std::wstring iso8601_date_to_local_date(const std::wstring& isoDate )
{
std::string asDateTime = WStringToString( ws8601DateTime );
SYSTEMTIME DateTime;
- DateTime.wYear = ( unsigned short )strtol( asDateTime.substr( 0, 4 ).c_str(), nullptr, 10 );
- DateTime.wMonth = ( unsigned short )strtol( asDateTime.substr( 5, 2 ).c_str(), nullptr, 10 );
+ DateTime.wYear = static_cast<unsigned short>(strtol( asDateTime.substr( 0, 4 ).c_str(), nullptr, 10 ));
+ DateTime.wMonth = static_cast<unsigned short>(strtol( asDateTime.substr( 5, 2 ).c_str(), nullptr, 10 ));
DateTime.wDayOfWeek = 0;
- DateTime.wDay = ( unsigned short )strtol( asDateTime.substr( 8, 2 ).c_str(), nullptr, 10 );
- DateTime.wHour = ( unsigned short )strtol( asDateTime.substr( 11,2 ).c_str(), nullptr, 10 );
- DateTime.wMinute = ( unsigned short )strtol( asDateTime.substr( 14,2 ).c_str(), nullptr, 10 );
- DateTime.wSecond = ( unsigned short )strtol( asDateTime.substr( 17,2 ).c_str(), nullptr, 10 );
+ DateTime.wDay = static_cast<unsigned short>(strtol( asDateTime.substr( 8, 2 ).c_str(), nullptr, 10 ));
+ DateTime.wHour = static_cast<unsigned short>(strtol( asDateTime.substr( 11,2 ).c_str(), nullptr, 10 ));
+ DateTime.wMinute = static_cast<unsigned short>(strtol( asDateTime.substr( 14,2 ).c_str(), nullptr, 10 ));
+ DateTime.wSecond = static_cast<unsigned short>(strtol( asDateTime.substr( 17,2 ).c_str(), nullptr, 10 ));
DateTime.wMilliseconds = 0;
//get Date info from structure
diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx
index 1a1ee62fe4ec..0cf7f204cf7e 100644
--- a/shell/source/win32/zipfile/zipfile.cxx
+++ b/shell/source/win32/zipfile/zipfile.cxx
@@ -444,7 +444,7 @@ void ZipFile::GetUncompressedContent(
return;
m_pStream->sseek(end.cdir_offset, SEEK_SET);
CentralDirectoryEntry entry;
- while (m_pStream->stell() != -1 && (unsigned long)m_pStream->stell() < end.cdir_offset + end.cdir_size)
+ while (m_pStream->stell() != -1 && static_cast<unsigned long>(m_pStream->stell()) < end.cdir_offset + end.cdir_size)
{
if (!readCentralDirectoryEntry(m_pStream, entry))
return;
@@ -516,7 +516,7 @@ ZipFile::DirectoryPtr_t ZipFile::GetDirectory() const
return dir;
m_pStream->sseek(end.cdir_offset, SEEK_SET);
CentralDirectoryEntry entry;
- while (m_pStream->stell() != -1 && (unsigned long)m_pStream->stell() < end.cdir_offset + end.cdir_size)
+ while (m_pStream->stell() != -1 && static_cast<unsigned long>(m_pStream->stell()) < end.cdir_offset + end.cdir_size)
{
if (!readCentralDirectoryEntry(m_pStream, entry))
return dir;
@@ -555,7 +555,7 @@ long ZipFile::GetFileLongestFileNameLength() const
return lmax;
m_pStream->sseek(end.cdir_offset, SEEK_SET);
CentralDirectoryEntry entry;
- while (m_pStream->stell() != -1 && (unsigned long)m_pStream->stell() < end.cdir_offset + end.cdir_size)
+ while (m_pStream->stell() != -1 && static_cast<unsigned long>(m_pStream->stell()) < end.cdir_offset + end.cdir_size)
{
if (!readCentralDirectoryEntry(m_pStream, entry))
return lmax;
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index e3844d19feda..919a5edc7818 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -64,13 +64,13 @@ static const sal_Int64 SAL_INT64_MIN =
/* MS Visual C++ no conversion from unsigned __int64 to double */
#ifdef _MSC_VER
-static const double DOUBLE_SAL_UINT64_MAX = ((((double)SAL_INT64_MAX) * 2) + 1);
+static const double DOUBLE_SAL_UINT64_MAX = (((double(SAL_INT64_MAX)) * 2) + 1);
static inline double unsigned_int64_to_double( sal_uInt64 n )
{
sal_uInt64 n2 = (n / 3);
n -= (2 * n2);
- return (((double)(sal_Int64)n2) * 2.0) + ((double)(sal_Int64)n);
+ return (static_cast<double>(static_cast<sal_Int64>(n2)) * 2.0) + static_cast<double>(static_cast<sal_Int64>(n));
}
#else
static const double DOUBLE_SAL_UINT64_MAX =
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index e4c9337c2a6a..429468b6e9fa 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -2349,15 +2349,15 @@ bool Signing::Verify(const std::vector<unsigned char>& aData,
if (rInformation.ouDateTime.isEmpty())
{
OUStringBuffer rBuffer;
- rBuffer.append((sal_Int32)aDateTime.GetYear());
+ rBuffer.append(static_cast<sal_Int32>(aDateTime.GetYear()));
rBuffer.append('-');
if (aDateTime.GetMonth() < 10)
rBuffer.append('0');
- rBuffer.append((sal_Int32)aDateTime.GetMonth());
+ rBuffer.append(static_cast<sal_Int32>(aDateTime.GetMonth()));
rBuffer.append('-');
if (aDateTime.GetDay() < 10)
rBuffer.append('0');
- rBuffer.append((sal_Int32)aDateTime.GetDay());
+ rBuffer.append(static_cast<sal_Int32>(aDateTime.GetDay()));
rInformation.ouDateTime = rBuffer.makeStringAndClear();
}
break;
diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index c84bb92592de..3faef58aca80 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -84,7 +84,7 @@ HDDEDATA CALLBACK DdeInternal::CliCallback( UINT nCode, UINT nCbType,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list