summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:15:28 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:15:28 +0100
commit5632c830e944c18c3b3c88e1bd19906d537c820b (patch)
tree9ec479835abcbd2929b68fe68719e432ce9abf8e /sot
parentd76f636cc41df3618962aac44ef989f13d4680b8 (diff)
More loplugin:cstylecast: sot
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: I7387e4c7877faba8bc82372734c14d2263457300
Diffstat (limited to 'sot')
-rw-r--r--sot/source/base/filelist.cxx2
-rw-r--r--sot/source/sdstor/stg.cxx6
-rw-r--r--sot/source/sdstor/stgcache.cxx2
-rw-r--r--sot/source/sdstor/stgcache.hxx2
-rw-r--r--sot/source/sdstor/stgdir.cxx12
-rw-r--r--sot/source/sdstor/stgelem.cxx4
-rw-r--r--sot/source/sdstor/stgelem.hxx2
-rw-r--r--sot/source/sdstor/stgole.cxx2
-rw-r--r--sot/source/sdstor/stgstrms.cxx42
-rw-r--r--sot/source/sdstor/ucbstorage.cxx12
10 files changed, 43 insertions, 43 deletions
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index 6fe95dfab89d..9db281b7d3ce 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.cxx
@@ -52,7 +52,7 @@ SvStream& ReadFileList( SvStream& rIStm, FileList& rFileList )
// read string till c==0
while (c && !rIStm.eof())
{
- sBuf.append((sal_Unicode)c);
+ sBuf.append(static_cast<sal_Unicode>(c));
rIStm.ReadUInt16( c );
}
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 64583644d7cc..bb74237bff5a 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -190,7 +190,7 @@ sal_uLong StorageStream::Read( void* pData, sal_uLong nSize )
if( Validate() )
{
pEntry->Seek( nPos );
- nSize = pEntry->Read( pData, (sal_Int32) nSize );
+ nSize = pEntry->Read( pData, static_cast<sal_Int32>(nSize) );
pIo->MoveError( *this );
nPos += nSize;
}
@@ -204,7 +204,7 @@ sal_uLong StorageStream::Write( const void* pData, sal_uLong nSize )
if( Validate( true ) )
{
pEntry->Seek( nPos );
- nSize = pEntry->Write( pData, (sal_Int32) nSize );
+ nSize = pEntry->Write( pData, static_cast<sal_Int32>(nSize) );
pIo->MoveError( *this );
nPos += nSize;
}
@@ -231,7 +231,7 @@ bool StorageStream::SetSize( sal_uLong nNewSize )
{
if( Validate( true ) )
{
- bool b = pEntry->SetSize( (sal_Int32) nNewSize );
+ bool b = pEntry->SetSize( static_cast<sal_Int32>(nNewSize) );
pIo->MoveError( *this );
return b;
}
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 3665aac7b856..e21ac2335af0 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -58,7 +58,7 @@ rtl::Reference< StgPage > StgPage::Create( short nData, sal_Int32 nPage )
void StgCache::SetToPage ( const rtl::Reference< StgPage >& rPage, short nOff, sal_Int32 nVal )
{
- if( ( nOff < (short) ( rPage->GetSize() / sizeof( sal_Int32 ) ) ) && nOff >= 0 )
+ if( ( nOff < static_cast<short>( rPage->GetSize() / sizeof( sal_Int32 ) ) ) && nOff >= 0 )
{
#ifdef OSL_BIGENDIAN
nVal = OSL_SWAPDWORD(nVal);
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 9f311ffbd702..b4262c80a1bc 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -118,7 +118,7 @@ public:
inline sal_Int32 StgCache::GetFromPage ( const rtl::Reference< StgPage >& rPage, short nOff )
{
- if( ( nOff >= (short) ( rPage->GetSize() / sizeof( sal_Int32 ) ) ) || nOff < 0 )
+ if( ( nOff >= static_cast<short>( rPage->GetSize() / sizeof( sal_Int32 ) ) ) || nOff < 0 )
return -1;
sal_Int32 n = static_cast<sal_Int32*>(rPage->GetData())[ nOff ];
#ifdef OSL_BIGENDIAN
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 3cad0ee08962..253fb4399d05 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -260,7 +260,7 @@ bool StgDirEntry::IsDirty()
void StgDirEntry::OpenStream( StgIo& rIo )
{
- sal_Int32 nThreshold = (sal_uInt16) rIo.m_aHdr.GetThreshold();
+ sal_Int32 nThreshold = static_cast<sal_uInt16>(rIo.m_aHdr.GetThreshold());
delete m_pStgStrm;
if( m_aEntry.GetSize() < nThreshold )
m_pStgStrm = new StgSmallStrm( rIo, *this );
@@ -336,13 +336,13 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize )
if( nNewSize >= nThreshold && m_pStgStrm->IsSmallStrm() )
{
pOld = m_pStgStrm;
- nOldSize = (sal_uInt16) pOld->GetSize();
+ nOldSize = static_cast<sal_uInt16>(pOld->GetSize());
m_pStgStrm = new StgDataStrm( rIo, STG_EOF, 0 );
}
else if( nNewSize < nThreshold && !m_pStgStrm->IsSmallStrm() )
{
pOld = m_pStgStrm;
- nOldSize = (sal_uInt16) nNewSize;
+ nOldSize = static_cast<sal_uInt16>(nNewSize);
m_pStgStrm = new StgSmallStrm( rIo, STG_EOF );
}
// now set the new size
@@ -582,7 +582,7 @@ bool StgDirEntry::Strm2Tmp()
sal_uLong nn = n;
if( nn > 4096 )
nn = 4096;
- if( (sal_uLong) m_pStgStrm->Read( p, nn ) != nn )
+ if( static_cast<sal_uLong>(m_pStgStrm->Read( p, nn )) != nn )
break;
if (m_pTmpStrm->WriteBytes( p, nn ) != nn)
break;
@@ -628,7 +628,7 @@ bool StgDirEntry::Tmp2Strm()
sal_uInt64 n = m_pTmpStrm->GetSize();
StgStrm* pNewStrm;
StgIo& rIo = m_pStgStrm->GetIo();
- sal_uLong nThreshold = (sal_uLong) rIo.m_aHdr.GetThreshold();
+ sal_uLong nThreshold = static_cast<sal_uLong>(rIo.m_aHdr.GetThreshold());
if( n < nThreshold )
pNewStrm = new StgSmallStrm( rIo, STG_EOF );
else
@@ -644,7 +644,7 @@ bool StgDirEntry::Tmp2Strm()
nn = 4096;
if (m_pTmpStrm->ReadBytes( p, nn ) != nn)
break;
- if( (sal_uLong) pNewStrm->Write( p, nn ) != nn )
+ if( static_cast<sal_uLong>(pNewStrm->Write( p, nn )) != nn )
break;
n -= nn;
}
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index c474d5b3e100..88f7bcb7c876 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -184,7 +184,7 @@ bool StgHeader::Store( StgIo& rIo )
static bool lcl_wontoverflow(short shift)
{
- return shift >= 0 && shift < (short)sizeof(short) * 8 - 1;
+ return shift >= 0 && shift < short(sizeof(short)) * 8 - 1;
}
static bool isKnownSpecial(sal_Int32 nLocation)
@@ -199,7 +199,7 @@ static bool isKnownSpecial(sal_Int32 nLocation)
bool StgHeader::Check()
{
return memcmp( m_cSignature, cStgSignature, 8 ) == 0
- && (short) ( m_nVersion >> 16 ) == 3
+ && static_cast<short>( m_nVersion >> 16 ) == 3
&& m_nPageSize == 9
&& lcl_wontoverflow(m_nPageSize)
&& lcl_wontoverflow(m_nDataPageSize)
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index 610c912136cf..3479fd6b2143 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -126,7 +126,7 @@ public:
void Store( void* );
StgEntryType GetType() const { return (StgEntryType) m_cType; }
sal_Int32 GetStartPage() const { return m_nPage1; }
- void SetType( StgEntryType t ) { m_cType = (sal_uInt8) t; }
+ void SetType( StgEntryType t ) { m_cType = static_cast<sal_uInt8>(t); }
sal_Int32 GetSize() const { return m_nSize; }
void SetSize( sal_Int32 n ) { m_nSize = n; }
const ClsId& GetClassId() const { return m_aClsId; }
diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index c91d86120867..f4ca083393eb 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -118,7 +118,7 @@ bool StgCompObjStream::Load()
if ( nLen1 > 0 )
{
// higher bits are ignored
- sal_uLong nStrLen = ::std::min( nLen1, (sal_Int32)0xFFFE );
+ sal_uLong nStrLen = ::std::min( nLen1, sal_Int32(0xFFFE) );
std::unique_ptr<sal_Char[]> p(new sal_Char[ nStrLen+1 ]);
p[nStrLen] = 0;
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index d83ffff27399..00a1a53c4314 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -408,7 +408,7 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
sal_Int32 nMask = ~( m_nPageSize - 1 );
sal_Int32 nOld = m_nPos & nMask;
sal_Int32 nNew = nBytePos & nMask;
- m_nOffset = (short) ( nBytePos & ~nMask );
+ m_nOffset = static_cast<short>( nBytePos & ~nMask );
m_nPos = nBytePos;
if( nOld == nNew )
return true;
@@ -586,9 +586,9 @@ bool StgFATStrm::Pos2Page( sal_Int32 nBytePos )
if( nBytePos < 0 || nBytePos >= m_nSize )
nBytePos = m_nSize ? m_nSize - 1 : 0;
m_nPage = nBytePos / m_nPageSize;
- m_nOffset = (short) ( nBytePos % m_nPageSize );
+ m_nOffset = static_cast<short>( nBytePos % m_nPageSize );
m_nPos = nBytePos;
- m_nPage = GetPage( (short) m_nPage, false );
+ m_nPage = GetPage( static_cast<short>(m_nPage), false );
return m_nPage >= 0;
}
@@ -624,7 +624,7 @@ sal_Int32 StgFATStrm::GetPage( short nOff, bool bMake, sal_uInt16 *pnMasterAlloc
pMaster = m_rIo.Copy( nFAT );
if ( pMaster.is() )
{
- for( short k = 0; k < (short)( m_nPageSize >> 2 ); k++ )
+ for( short k = 0; k < static_cast<short>( m_nPageSize >> 2 ); k++ )
m_rIo.SetToPage( pMaster, k, STG_FREE );
// chaining
if( !pOldPage.is() )
@@ -731,8 +731,8 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes )
m_aPagesCache.clear();
// Set the number of entries to a multiple of the page size
- short nOld = (short) ( ( m_nSize + ( m_nPageSize - 1 ) ) / m_nPageSize );
- short nNew = (short) (
+ short nOld = static_cast<short>( ( m_nSize + ( m_nPageSize - 1 ) ) / m_nPageSize );
+ short nNew = static_cast<short>(
( nBytes + ( m_nPageSize - 1 ) ) / m_nPageSize ) ;
if( nNew < nOld )
{
@@ -776,7 +776,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes )
rtl::Reference< StgPage > pPg = m_rIo.Copy( nNewPage );
if ( !pPg.is() )
return false;
- for( short j = 0; j < (short)( m_nPageSize >> 2 ); j++ )
+ for( short j = 0; j < static_cast<short>( m_nPageSize >> 2 ); j++ )
m_rIo.SetToPage( pPg, j, STG_FREE );
// store the page number into the master FAT
@@ -808,7 +808,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes )
nOld++;
// We have used up 4 bytes for the STG_FAT entry
nBytes += 4;
- nNew = (short) (
+ nNew = static_cast<short>(
( nBytes + ( m_nPageSize - 1 ) ) / m_nPageSize );
}
}
@@ -921,8 +921,8 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
{
short nBytes = m_nPageSize - m_nOffset;
rtl::Reference< StgPage > pPg;
- if( (sal_Int32) nBytes > n )
- nBytes = (short) n;
+ if( static_cast<sal_Int32>(nBytes) > n )
+ nBytes = static_cast<short>(n);
if( nBytes )
{
short nRes;
@@ -938,7 +938,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
}
else
// do a direct (unbuffered) read
- nRes = (short) m_rIo.Read( m_nPage, p ) * m_nPageSize;
+ nRes = static_cast<short>(m_rIo.Read( m_nPage, p )) * m_nPageSize;
}
else
{
@@ -980,8 +980,8 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
{
short nBytes = m_nPageSize - m_nOffset;
rtl::Reference< StgPage > pPg;
- if( (sal_Int32) nBytes > n )
- nBytes = (short) n;
+ if( static_cast<sal_Int32>(nBytes) > n )
+ nBytes = static_cast<short>(n);
if( nBytes )
{
short nRes;
@@ -998,7 +998,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
}
else
// do a direct (unbuffered) write
- nRes = (short) m_rIo.Write( m_nPage, p ) * m_nPageSize;
+ nRes = static_cast<short>(m_rIo.Write( m_nPage, p )) * m_nPageSize;
}
else
{
@@ -1070,8 +1070,8 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
while( n )
{
short nBytes = m_nPageSize - m_nOffset;
- if( (sal_Int32) nBytes > n )
- nBytes = (short) n;
+ if( static_cast<sal_Int32>(nBytes) > n )
+ nBytes = static_cast<short>(n);
if( nBytes )
{
if (!m_pData)
@@ -1082,7 +1082,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
if (!m_pData->Pos2Page(nPos + m_nOffset))
break;
// all reading through the stream
- short nRes = (short) m_pData->Read( static_cast<sal_uInt8*>(pBuf) + nDone, nBytes );
+ short nRes = static_cast<short>(m_pData->Read( static_cast<sal_uInt8*>(pBuf) + nDone, nBytes ));
nDone = nDone + nRes;
m_nPos += nRes;
n -= nRes;
@@ -1113,8 +1113,8 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
while( n )
{
short nBytes = m_nPageSize - m_nOffset;
- if( (sal_Int32) nBytes > n )
- nBytes = (short) n;
+ if( static_cast<sal_Int32>(nBytes) > n )
+ nBytes = static_cast<short>(n);
if( nBytes )
{
// all writing goes through the stream
@@ -1125,7 +1125,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
break;
if( !m_pData->Pos2Page( nDataPos ) )
break;
- short nRes = (short) m_pData->Write( static_cast<sal_uInt8 const *>(pBuf) + nDone, nBytes );
+ short nRes = static_cast<short>(m_pData->Write( static_cast<sal_uInt8 const *>(pBuf) + nDone, nBytes ));
nDone = nDone + nRes;
m_nPos += nRes;
n -= nRes;
@@ -1268,7 +1268,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
}
m_pStrm = s;
// Shrink the memory to 16 bytes, which seems to be the minimum
- ReAllocateMemory( - ( (long) nEndOfData - 16 ) );
+ ReAllocateMemory( - ( static_cast<long>(nEndOfData) - 16 ) );
}
else
{
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 272e65a82fdc..71403d35e82f 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -152,7 +152,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
checkError();
// if read characters < MaxLength, adjust sequence
- if ((sal_Int32)nRead < aData.getLength())
+ if (static_cast<sal_Int32>(nRead) < aData.getLength())
aData.realloc( nRead );
return nRead;
@@ -209,7 +209,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::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();
@@ -241,7 +241,7 @@ void SAL_CALL FileStreamWrapper_Impl::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();
}
@@ -256,7 +256,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( )
sal_uInt32 nPos = m_pSvStream->Tell();
checkError();
- return (sal_Int64)nPos;
+ return static_cast<sal_Int64>(nPos);
}
@@ -277,7 +277,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( )
checkError();
- return (sal_Int64)nEndPos;
+ return static_cast<sal_Int64>(nEndPos);
}
@@ -1735,7 +1735,7 @@ void UCBStorage_Impl::ReadContent()
bool bIsFolder( xRow->getBoolean(2) );
sal_Int64 nSize = xRow->getLong(4);
- UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( aTitle, bIsFolder, (sal_uLong) nSize );
+ UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( aTitle, bIsFolder, static_cast<sal_uLong>(nSize) );
m_aChildrenList.emplace_back( pElement );
bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != SvGlobalName() );