Kaydet (Commit) b7f0446d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More loplugin:cstylecast: unotools

auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I40a3ff5a436766f8d16f154eff2726b4873a0eb1
üst d9384ef6
......@@ -100,8 +100,8 @@ class SvtDynMenu
// special string "sSeparator" to perform too ...
Sequence< Sequence< PropertyValue > > GetList() const
{
sal_Int32 nSetupCount = (sal_Int32)lSetupEntries.size();
sal_Int32 nUserCount = (sal_Int32)lUserEntries.size();
sal_Int32 nSetupCount = static_cast<sal_Int32>(lSetupEntries.size());
sal_Int32 nUserCount = static_cast<sal_Int32>(lUserEntries.size());
sal_Int32 nStep = 0;
Sequence< PropertyValue > lProperties ( PROPERTYCOUNT );
Sequence< Sequence< PropertyValue > > lResult ( nSetupCount+nUserCount );
......
......@@ -173,7 +173,7 @@ void SvtExtendedSecurityOptions_Impl::ImplCommit()
switch( nProperty )
{
case PROPERTYHANDLE_HYPERLINKS_OPEN: {
seqValues[nProperty] <<= (sal_Int32)m_eOpenHyperlinkMode;
seqValues[nProperty] <<= static_cast<sal_Int32>(m_eOpenHyperlinkMode);
}
break;
}
......
......@@ -613,14 +613,14 @@ static bool ImplKillLeading( OUString& rName, const char* const* ppStr )
{
const char* pStr = *ppStr;
const sal_Unicode* pNameStr = rName.getStr();
while ( (*pNameStr == (sal_Unicode)(unsigned char)*pStr) && *pStr )
while ( (*pNameStr == static_cast<sal_Unicode>(static_cast<unsigned char>(*pStr))) && *pStr )
{
pNameStr++;
pStr++;
}
if ( !*pStr )
{
sal_Int32 nLen = (sal_Int32)(pNameStr - rName.getStr());
sal_Int32 nLen = static_cast<sal_Int32>(pNameStr - rName.getStr());
rName = rName.copy(nLen);
return true;
}
......@@ -641,7 +641,7 @@ static bool ImplKillLeading( OUString& rName, const char* const* ppStr )
static sal_Int32 ImplIsTrailing( const OUString& rName, const char* pStr )
{
sal_Int32 nStrLen = (sal_Int32)strlen( pStr );
sal_Int32 nStrLen = static_cast<sal_Int32>(strlen( pStr ));
if( nStrLen >= rName.getLength() )
return 0;
......@@ -696,7 +696,7 @@ static bool ImplKillTrailingWithExceptions( OUString& rName, const char* const*
static bool ImplFindAndErase( OUString& rName, const char* pStr )
{
sal_Int32 nLen = (sal_Int32)strlen(pStr);
sal_Int32 nLen = static_cast<sal_Int32>(strlen(pStr));
sal_Int32 nPos = rName.indexOfAsciiL(pStr, nLen );
if ( nPos < 0 )
return false;
......
......@@ -394,7 +394,7 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
else if (pnVal)
aRes <<= *pnVal;
else if (plVal)
aRes <<= (sal_Int16)(sal_uInt16)*plVal;
aRes <<= static_cast<sal_Int16>(static_cast<sal_uInt16>(*plVal));
else if (pnInt32Val)
aRes <<= *pnInt32Val;
......@@ -522,7 +522,7 @@ bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any
sal_Int16 nNew = sal_Int16();
if (rValue >>= nNew)
{
if (nNew != (sal_uInt16)*plVal)
if (nNew != static_cast<sal_uInt16>(*plVal))
{
*plVal = LanguageType(static_cast<sal_uInt16>(nNew));
bMod = true;
......
......@@ -152,7 +152,7 @@ void SvtOptionsDlgOptions_Impl::ReadNode( const OUString& _rNode, NodeType _eTyp
Sequence< OUString > aNodes = GetNodeNames( sNodes );
if ( aNodes.getLength() > 0 )
{
for ( sal_uInt32 n = 0; n < (sal_uInt32)aNodes.getLength(); ++n )
for ( sal_uInt32 n = 0; n < static_cast<sal_uInt32>(aNodes.getLength()); ++n )
{
OUString sSubNodeName( sNodes + m_sPathDelimiter + aNodes[n] );
ReadNode( sSubNodeName, _eType == NT_Group ? NT_Page : NT_Option );
......
......@@ -219,7 +219,7 @@ const OUString& SvtPathOptions_Impl::GetPath( SvtPathOptions::Paths ePath )
{
OUString aPathValue;
OUString aResult;
sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ];
sal_Int32 nHandle = m_aMapEnumToPropHandle[ static_cast<sal_Int32>(ePath) ];
// Substitution is done by the service itself using the substition service
Any a = m_xPathSettings->getFastPropertyValue( nHandle );
......@@ -297,7 +297,7 @@ void SvtPathOptions_Impl::SetPath( SvtPathOptions::Paths ePath, const OUString&
a <<= aNewValue;
try
{
m_xPathSettings->setFastPropertyValue( m_aMapEnumToPropHandle[ (sal_Int32)ePath], a );
m_xPathSettings->setFastPropertyValue( m_aMapEnumToPropHandle[ static_cast<sal_Int32>(ePath)], a );
}
catch (const Exception& e)
{
......@@ -396,7 +396,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const
}
SvtPathOptions_Impl::SvtPathOptions_Impl() :
m_aPathArray( (sal_Int32)SvtPathOptions::PATH_COUNT )
m_aPathArray( sal_Int32(SvtPathOptions::PATH_COUNT) )
{
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
......
......@@ -97,7 +97,7 @@ void SvtSearchOptions_Impl::SetFlag( sal_uInt16 nOffset, bool bVal )
{
DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range");
sal_Int32 nOldFlags = nFlags;
sal_Int32 nMask = ((sal_Int32) 1) << nOffset;
sal_Int32 nMask = (sal_Int32(1)) << nOffset;
if (bVal)
nFlags |= nMask;
else
......
......@@ -715,7 +715,7 @@ void SvtSecurityOptions_Impl::ImplCommit()
{
bDone = !m_bROBasicMode;
if( bDone )
lValues[ nRealCount ] <<= (sal_Int32)m_eBasicMode;
lValues[ nRealCount ] <<= static_cast<sal_Int32>(m_eBasicMode);
}
break;
case PROPERTYHANDLE_EXECUTEPLUGINS:
......
......@@ -337,7 +337,7 @@ std::vector< LanguageType > LocaleDataWrapper::getInstalledLanguageTypes()
OUStringBuffer aMsg("ConvertIsoNamesToLanguage/ConvertLanguageToIsoNames: ambiguous locale (MS-LCID?)\n");
aMsg.append(aDebugLocale);
aMsg.append(" -> 0x");
aMsg.append((sal_Int32)(sal_uInt16)eLang, 16);
aMsg.append(static_cast<sal_Int32>(static_cast<sal_uInt16>(eLang)), 16);
aMsg.append(" -> ");
aMsg.append(aBackLanguageTag.getBcp47());
outputCheckMessage( aMsg.makeStringAndClear() );
......@@ -727,7 +727,7 @@ void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode,
p = pStop;
break;
default:
if (!nInSection && nSym == -1 && rCode.match(aCurrSymbol, (sal_Int32)(p - pStr)))
if (!nInSection && nSym == -1 && rCode.match(aCurrSymbol, static_cast<sal_Int32>(p - pStr)))
{ // currency symbol not surrounded by [$...]
nSym = p - pStr;
if (nBlank == -1 && pStr < p && *(p-1) == ' ')
......@@ -1125,7 +1125,7 @@ static sal_Unicode* ImplAddUNum( sal_Unicode* pBuf, sal_uInt64 nNumber )
sal_Unicode* pTempBuf = aTempBuf;
do
{
*pTempBuf = (sal_Unicode)(nNumber % 10) + '0';
*pTempBuf = static_cast<sal_Unicode>(nNumber % 10) + '0';
pTempBuf++;
nNumber /= 10;
}
......@@ -1150,7 +1150,7 @@ static sal_Unicode* ImplAddUNum( sal_Unicode* pBuf, sal_uInt64 nNumber, int nMin
sal_Unicode* pTempBuf = aTempBuf;
do
{
*pTempBuf = (sal_Unicode)(nNumber % 10) + '0';
*pTempBuf = static_cast<sal_Unicode>(nNumber % 10) + '0';
pTempBuf++;
nNumber /= 10;
nMinLen--;
......@@ -1278,8 +1278,8 @@ sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf,
}
// convert number
pNumBuf = ImplAddUNum( aNumBuf, (sal_uInt64)nNumber );
nNumLen = (sal_uInt16)(sal_uLong)(pNumBuf-aNumBuf);
pNumBuf = ImplAddUNum( aNumBuf, static_cast<sal_uInt64>(nNumber) );
nNumLen = static_cast<sal_uInt16>(static_cast<sal_uLong>(pNumBuf-aNumBuf));
pNumBuf = aNumBuf;
if ( nNumLen <= nDecimals )
......@@ -1577,7 +1577,7 @@ OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
// convert number
sal_Unicode* pEndNumBuf = ImplAddFormatNum( pNumBuffer, nNumber, nDecimals,
bUseThousandSep, true );
sal_Int32 nNumLen = (sal_Int32)(sal_uLong)(pEndNumBuf-pNumBuffer);
sal_Int32 nNumLen = static_cast<sal_Int32>(static_cast<sal_uLong>(pEndNumBuf-pNumBuffer));
// replace zeros with zero character
if ( (cZeroChar != '0') && nDecimals /* && IsNumTrailingZeros() */ )
......
......@@ -233,15 +233,15 @@ void extractDate(const css::util::DateTime& _rDateTime, css::util::Date& _rOut)
OUString toISO8601(const css::util::DateTime& rDateTime)
{
OUStringBuffer rBuffer;
rBuffer.append((sal_Int32) rDateTime.Year);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Year));
rBuffer.append('-');
if( rDateTime.Month < 10 )
rBuffer.append('0');
rBuffer.append((sal_Int32) rDateTime.Month);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Month));
rBuffer.append('-');
if( rDateTime.Day < 10 )
rBuffer.append('0');
rBuffer.append((sal_Int32) rDateTime.Day);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Day));
if( rDateTime.NanoSeconds != 0 ||
rDateTime.Seconds != 0 ||
......@@ -251,15 +251,15 @@ OUString toISO8601(const css::util::DateTime& rDateTime)
rBuffer.append('T');
if( rDateTime.Hours < 10 )
rBuffer.append('0');
rBuffer.append((sal_Int32) rDateTime.Hours);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Hours));
rBuffer.append(':');
if( rDateTime.Minutes < 10 )
rBuffer.append('0');
rBuffer.append((sal_Int32) rDateTime.Minutes);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Minutes));
rBuffer.append(':');
if( rDateTime.Seconds < 10 )
rBuffer.append('0');
rBuffer.append((sal_Int32) rDateTime.Seconds);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Seconds));
if ( rDateTime.NanoSeconds > 0)
{
OSL_ENSURE(rDateTime.NanoSeconds < 1000000000,"NanoSeconds cannot be more than 999 999 999");
......@@ -344,9 +344,9 @@ bool ISO8601parseDate(const OUString &aDateStr, css::util::Date& rDate)
if (bSuccess)
{
rDate.Year = (sal_uInt16)nYear;
rDate.Month = (sal_uInt16)nMonth;
rDate.Day = (sal_uInt16)nDay;
rDate.Year = static_cast<sal_uInt16>(nYear);
rDate.Month = static_cast<sal_uInt16>(nMonth);
rDate.Day = static_cast<sal_uInt16>(nDay);
}
return bSuccess;
......@@ -480,9 +480,9 @@ bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
if(!tokTz.isEmpty())
rTime.IsUTC = (tokTz == "Z");
rTime.Hours = (sal_uInt16)nHour;
rTime.Minutes = (sal_uInt16)nMin;
rTime.Seconds = (sal_uInt16)nSec;
rTime.Hours = static_cast<sal_uInt16>(nHour);
rTime.Minutes = static_cast<sal_uInt16>(nMin);
rTime.Seconds = static_cast<sal_uInt16>(nSec);
rTime.NanoSeconds = nNanoSec;
}
......
......@@ -47,7 +47,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
throw css::io::IOException(OUString(), static_cast<css::uno::XWeak*>(this));
// adjust sequence if data read is lower than the desired data
if (nRead < (std::size_t)aData.getLength())
if (nRead < static_cast<std::size_t>(aData.getLength()))
aData.realloc( nRead );
return nRead;
......
......@@ -65,7 +65,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 >
checkError();
// If read characters < MaxLength, adjust css::uno::Sequence
if (nRead < (std::size_t)aData.getLength())
if (nRead < static_cast<std::size_t>(aData.getLength()))
aData.realloc( nRead );
return nRead;
......@@ -107,7 +107,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::available()
m_pSvStream->Seek(STREAM_SEEK_TO_END);
checkError();
sal_Int32 nAvailable = (sal_Int32)m_pSvStream->Tell() - nPos;
sal_Int32 nAvailable = static_cast<sal_Int32>(m_pSvStream->Tell()) - nPos;
m_pSvStream->Seek(nPos);
checkError();
......@@ -159,7 +159,7 @@ void SAL_CALL OSeekableInputStreamWrapper::seek( sal_Int64 _nLocation )
::osl::MutexGuard aGuard( m_aMutex );
checkConnected();
m_pSvStream->Seek((sal_uInt32)_nLocation);
m_pSvStream->Seek(static_cast<sal_uInt32>(_nLocation));
checkError();
}
......@@ -170,7 +170,7 @@ sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getPosition( )
sal_uInt32 nPos = m_pSvStream->Tell();
checkError();
return (sal_Int64)nPos;
return static_cast<sal_Int64>(nPos);
}
sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getLength( )
......@@ -187,7 +187,7 @@ sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getLength( )
checkError();
return (sal_Int64)nEndPos;
return static_cast<sal_Int64>(nEndPos);
}
//= OOutputStreamWrapper
......@@ -203,7 +203,7 @@ void SAL_CALL OOutputStreamWrapper::writeBytes(const css::uno::Sequence< sal_Int
sal_uInt32 nWritten = rStream.WriteBytes(aData.getConstArray(), aData.getLength());
ErrCode err = rStream.GetError();
if ( (ERRCODE_NONE != err)
|| (nWritten != (sal_uInt32)aData.getLength())
|| (nWritten != static_cast<sal_uInt32>(aData.getLength()))
)
{
throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this));
......@@ -256,7 +256,7 @@ void SAL_CALL OSeekableOutputStreamWrapper::release( ) throw ()
void SAL_CALL OSeekableOutputStreamWrapper::seek( sal_Int64 _nLocation )
{
rStream.Seek((sal_uInt32)_nLocation);
rStream.Seek(static_cast<sal_uInt32>(_nLocation));
checkError();
}
......@@ -264,7 +264,7 @@ sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getPosition( )
{
sal_uInt32 nPos = rStream.Tell();
checkError();
return (sal_Int64)nPos;
return static_cast<sal_Int64>(nPos);
}
sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getLength( )
......@@ -278,7 +278,7 @@ sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getLength( )
checkError();
return (sal_Int64)nEndPos;
return static_cast<sal_Int64>(nEndPos);
}
OStreamWrapper::~OStreamWrapper() = default;
......@@ -303,7 +303,7 @@ void SAL_CALL OStreamWrapper::writeBytes(const css::uno::Sequence< sal_Int8 >& a
sal_uInt32 nWritten = m_pSvStream->WriteBytes(aData.getConstArray(), aData.getLength());
ErrCode err = m_pSvStream->GetError();
if ( (ERRCODE_NONE != err)
|| (nWritten != (sal_uInt32)aData.getLength())
|| (nWritten != static_cast<sal_uInt32>(aData.getLength()))
)
{
throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this));
......
......@@ -150,7 +150,7 @@ sal_Int32 SAL_CALL OTempFileService::readBytes( css::uno::Sequence< sal_Int8 >&
sal_uInt32 nRead = mpStream->ReadBytes(static_cast<void*>(aData.getArray()), nBytesToRead);
checkError();
if (nRead < (std::size_t)aData.getLength())
if (nRead < static_cast<std::size_t>(aData.getLength()))
aData.realloc( nRead );
if ( sal::static_int_cast<sal_uInt32>(nBytesToRead) > nRead )
......@@ -241,7 +241,7 @@ void SAL_CALL OTempFileService::writeBytes( const css::uno::Sequence< sal_Int8 >
checkConnected();
sal_uInt32 nWritten = mpStream->WriteBytes(aData.getConstArray(), aData.getLength());
checkError();
if ( nWritten != (sal_uInt32)aData.getLength())
if ( nWritten != static_cast<sal_uInt32>(aData.getLength()))
throw css::io::BufferSizeExceededException( OUString(),static_cast < css::uno::XWeak * > ( this ) );
}
void SAL_CALL OTempFileService::flush( )
......@@ -322,7 +322,7 @@ void SAL_CALL OTempFileService::seek( sal_Int64 nLocation )
if ( nLocation < 0 || nLocation > getLength() )
throw css::lang::IllegalArgumentException();
mpStream->Seek((sal_uInt32) nLocation );
mpStream->Seek(static_cast<sal_uInt32>(nLocation) );
checkError();
}
sal_Int64 SAL_CALL OTempFileService::getPosition( )
......@@ -332,7 +332,7 @@ sal_Int64 SAL_CALL OTempFileService::getPosition( )
sal_uInt32 nPos = mpStream->Tell();
checkError();
return (sal_Int64)nPos;
return static_cast<sal_Int64>(nPos);
}
sal_Int64 SAL_CALL OTempFileService::getLength( )
{
......@@ -348,7 +348,7 @@ sal_Int64 SAL_CALL OTempFileService::getLength( )
checkError();
return (sal_Int64)nEndPos;
return static_cast<sal_Int64>(nEndPos);
}
// XStream
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment