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

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
üst d76f636c
...@@ -49,38 +49,38 @@ SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVec ...@@ -49,38 +49,38 @@ SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVec
SotClipboardFormatId nId ); SotClipboardFormatId nId );
// actions // actions
#define EXCHG_INOUT_ACTION_NONE ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_NONE) #define EXCHG_INOUT_ACTION_NONE (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_NONE))
#define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE #define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
#define EXCHG_IN_ACTION_MOVE ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_MOVE) #define EXCHG_IN_ACTION_MOVE (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_MOVE))
#define EXCHG_IN_ACTION_COPY ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_COPY) #define EXCHG_IN_ACTION_COPY (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_COPY))
#define EXCHG_IN_ACTION_LINK ((sal_uInt8)css::datatransfer::dnd::DNDConstants::ACTION_LINK) #define EXCHG_IN_ACTION_LINK (sal_uInt8(css::datatransfer::dnd::DNDConstants::ACTION_LINK))
#define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt8)17) #define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt8)17)
#define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt8)18) #define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt8)18)
#define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt8)20) #define EXCHG_OUT_ACTION_INSERT_FILE (sal_uInt8(20))
#define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt8)22) #define EXCHG_OUT_ACTION_INSERT_IMAGEMAP (sal_uInt8(22))
#define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt8)23) #define EXCHG_OUT_ACTION_INSERT_OLE (sal_uInt8(23))
#define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt8)24) #define EXCHG_OUT_ACTION_INSERT_INTERACTIVE (sal_uInt8(24))
#define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt8)29) #define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP (sal_uInt8(29))
#define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt8)30) #define EXCHG_OUT_ACTION_GET_ATTRIBUTES (sal_uInt8(30))
#define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt8)32) #define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt8)32)
#define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt8)33) #define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt8)33)
#define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt8)34) #define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt8)34)
#define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt8)35) #define EXCHG_OUT_ACTION_INSERT_PRIVATE (sal_uInt8(35))
#define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt8)36) #define EXCHG_OUT_ACTION_INSERT_HTML (sal_uInt8(36))
#define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt8)37) #define EXCHG_OUT_ACTION_MOVE_PRIVATE (sal_uInt8(37))
#define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt8)38) #define EXCHG_OUT_ACTION_INSERT_STRING (sal_uInt8(38))
#define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt8)39) #define EXCHG_OUT_ACTION_INSERT_DRAWOBJ (sal_uInt8(39))
#define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt8)40) #define EXCHG_OUT_ACTION_INSERT_SVXB (sal_uInt8(40))
#define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt8)41) #define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE (sal_uInt8(41))
#define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt8)42) #define EXCHG_OUT_ACTION_INSERT_BITMAP (sal_uInt8(42))
#define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt8)43) #define EXCHG_OUT_ACTION_INSERT_DDE (sal_uInt8(43))
#define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt8)44) #define EXCHG_OUT_ACTION_INSERT_HYPERLINK (sal_uInt8(44))
#define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt8)45) #define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ (sal_uInt8(45))
#define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt8)46) #define EXCHG_OUT_ACTION_REPLACE_SVXB (sal_uInt8(46))
#define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt8)47) #define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE (sal_uInt8(47))
#define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt8)48) #define EXCHG_OUT_ACTION_REPLACE_BITMAP (sal_uInt8(48))
#define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt8)49) #define EXCHG_OUT_ACTION_REPLACE_GRAPH (sal_uInt8(49))
#define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt8)50) #define EXCHG_OUT_ACTION_INSERT_GRAPH (sal_uInt8(50))
enum class SotExchangeActionFlags { enum class SotExchangeActionFlags {
NONE = 0x0000, NONE = 0x0000,
......
...@@ -52,7 +52,7 @@ SvStream& ReadFileList( SvStream& rIStm, FileList& rFileList ) ...@@ -52,7 +52,7 @@ SvStream& ReadFileList( SvStream& rIStm, FileList& rFileList )
// read string till c==0 // read string till c==0
while (c && !rIStm.eof()) while (c && !rIStm.eof())
{ {
sBuf.append((sal_Unicode)c); sBuf.append(static_cast<sal_Unicode>(c));
rIStm.ReadUInt16( c ); rIStm.ReadUInt16( c );
} }
......
...@@ -190,7 +190,7 @@ sal_uLong StorageStream::Read( void* pData, sal_uLong nSize ) ...@@ -190,7 +190,7 @@ sal_uLong StorageStream::Read( void* pData, sal_uLong nSize )
if( Validate() ) if( Validate() )
{ {
pEntry->Seek( nPos ); pEntry->Seek( nPos );
nSize = pEntry->Read( pData, (sal_Int32) nSize ); nSize = pEntry->Read( pData, static_cast<sal_Int32>(nSize) );
pIo->MoveError( *this ); pIo->MoveError( *this );
nPos += nSize; nPos += nSize;
} }
...@@ -204,7 +204,7 @@ sal_uLong StorageStream::Write( const void* pData, sal_uLong nSize ) ...@@ -204,7 +204,7 @@ sal_uLong StorageStream::Write( const void* pData, sal_uLong nSize )
if( Validate( true ) ) if( Validate( true ) )
{ {
pEntry->Seek( nPos ); pEntry->Seek( nPos );
nSize = pEntry->Write( pData, (sal_Int32) nSize ); nSize = pEntry->Write( pData, static_cast<sal_Int32>(nSize) );
pIo->MoveError( *this ); pIo->MoveError( *this );
nPos += nSize; nPos += nSize;
} }
...@@ -231,7 +231,7 @@ bool StorageStream::SetSize( sal_uLong nNewSize ) ...@@ -231,7 +231,7 @@ bool StorageStream::SetSize( sal_uLong nNewSize )
{ {
if( Validate( true ) ) if( Validate( true ) )
{ {
bool b = pEntry->SetSize( (sal_Int32) nNewSize ); bool b = pEntry->SetSize( static_cast<sal_Int32>(nNewSize) );
pIo->MoveError( *this ); pIo->MoveError( *this );
return b; return b;
} }
......
...@@ -58,7 +58,7 @@ rtl::Reference< StgPage > StgPage::Create( short nData, sal_Int32 nPage ) ...@@ -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 ) 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 #ifdef OSL_BIGENDIAN
nVal = OSL_SWAPDWORD(nVal); nVal = OSL_SWAPDWORD(nVal);
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
inline sal_Int32 StgCache::GetFromPage ( const rtl::Reference< StgPage >& rPage, short nOff ) 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; return -1;
sal_Int32 n = static_cast<sal_Int32*>(rPage->GetData())[ nOff ]; sal_Int32 n = static_cast<sal_Int32*>(rPage->GetData())[ nOff ];
#ifdef OSL_BIGENDIAN #ifdef OSL_BIGENDIAN
......
...@@ -260,7 +260,7 @@ bool StgDirEntry::IsDirty() ...@@ -260,7 +260,7 @@ bool StgDirEntry::IsDirty()
void StgDirEntry::OpenStream( StgIo& rIo ) 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; delete m_pStgStrm;
if( m_aEntry.GetSize() < nThreshold ) if( m_aEntry.GetSize() < nThreshold )
m_pStgStrm = new StgSmallStrm( rIo, *this ); m_pStgStrm = new StgSmallStrm( rIo, *this );
...@@ -336,13 +336,13 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize ) ...@@ -336,13 +336,13 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize )
if( nNewSize >= nThreshold && m_pStgStrm->IsSmallStrm() ) if( nNewSize >= nThreshold && m_pStgStrm->IsSmallStrm() )
{ {
pOld = m_pStgStrm; pOld = m_pStgStrm;
nOldSize = (sal_uInt16) pOld->GetSize(); nOldSize = static_cast<sal_uInt16>(pOld->GetSize());
m_pStgStrm = new StgDataStrm( rIo, STG_EOF, 0 ); m_pStgStrm = new StgDataStrm( rIo, STG_EOF, 0 );
} }
else if( nNewSize < nThreshold && !m_pStgStrm->IsSmallStrm() ) else if( nNewSize < nThreshold && !m_pStgStrm->IsSmallStrm() )
{ {
pOld = m_pStgStrm; pOld = m_pStgStrm;
nOldSize = (sal_uInt16) nNewSize; nOldSize = static_cast<sal_uInt16>(nNewSize);
m_pStgStrm = new StgSmallStrm( rIo, STG_EOF ); m_pStgStrm = new StgSmallStrm( rIo, STG_EOF );
} }
// now set the new size // now set the new size
...@@ -582,7 +582,7 @@ bool StgDirEntry::Strm2Tmp() ...@@ -582,7 +582,7 @@ bool StgDirEntry::Strm2Tmp()
sal_uLong nn = n; sal_uLong nn = n;
if( nn > 4096 ) if( nn > 4096 )
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; break;
if (m_pTmpStrm->WriteBytes( p, nn ) != nn) if (m_pTmpStrm->WriteBytes( p, nn ) != nn)
break; break;
...@@ -628,7 +628,7 @@ bool StgDirEntry::Tmp2Strm() ...@@ -628,7 +628,7 @@ bool StgDirEntry::Tmp2Strm()
sal_uInt64 n = m_pTmpStrm->GetSize(); sal_uInt64 n = m_pTmpStrm->GetSize();
StgStrm* pNewStrm; StgStrm* pNewStrm;
StgIo& rIo = m_pStgStrm->GetIo(); 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 ) if( n < nThreshold )
pNewStrm = new StgSmallStrm( rIo, STG_EOF ); pNewStrm = new StgSmallStrm( rIo, STG_EOF );
else else
...@@ -644,7 +644,7 @@ bool StgDirEntry::Tmp2Strm() ...@@ -644,7 +644,7 @@ bool StgDirEntry::Tmp2Strm()
nn = 4096; nn = 4096;
if (m_pTmpStrm->ReadBytes( p, nn ) != nn) if (m_pTmpStrm->ReadBytes( p, nn ) != nn)
break; break;
if( (sal_uLong) pNewStrm->Write( p, nn ) != nn ) if( static_cast<sal_uLong>(pNewStrm->Write( p, nn )) != nn )
break; break;
n -= nn; n -= nn;
} }
......
...@@ -184,7 +184,7 @@ bool StgHeader::Store( StgIo& rIo ) ...@@ -184,7 +184,7 @@ bool StgHeader::Store( StgIo& rIo )
static bool lcl_wontoverflow(short shift) 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) static bool isKnownSpecial(sal_Int32 nLocation)
...@@ -199,7 +199,7 @@ static bool isKnownSpecial(sal_Int32 nLocation) ...@@ -199,7 +199,7 @@ static bool isKnownSpecial(sal_Int32 nLocation)
bool StgHeader::Check() bool StgHeader::Check()
{ {
return memcmp( m_cSignature, cStgSignature, 8 ) == 0 return memcmp( m_cSignature, cStgSignature, 8 ) == 0
&& (short) ( m_nVersion >> 16 ) == 3 && static_cast<short>( m_nVersion >> 16 ) == 3
&& m_nPageSize == 9 && m_nPageSize == 9
&& lcl_wontoverflow(m_nPageSize) && lcl_wontoverflow(m_nPageSize)
&& lcl_wontoverflow(m_nDataPageSize) && lcl_wontoverflow(m_nDataPageSize)
......
...@@ -126,7 +126,7 @@ public: ...@@ -126,7 +126,7 @@ public:
void Store( void* ); void Store( void* );
StgEntryType GetType() const { return (StgEntryType) m_cType; } StgEntryType GetType() const { return (StgEntryType) m_cType; }
sal_Int32 GetStartPage() const { return m_nPage1; } 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; } sal_Int32 GetSize() const { return m_nSize; }
void SetSize( sal_Int32 n ) { m_nSize = n; } void SetSize( sal_Int32 n ) { m_nSize = n; }
const ClsId& GetClassId() const { return m_aClsId; } const ClsId& GetClassId() const { return m_aClsId; }
......
...@@ -118,7 +118,7 @@ bool StgCompObjStream::Load() ...@@ -118,7 +118,7 @@ bool StgCompObjStream::Load()
if ( nLen1 > 0 ) if ( nLen1 > 0 )
{ {
// higher bits are ignored // 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 ]); std::unique_ptr<sal_Char[]> p(new sal_Char[ nStrLen+1 ]);
p[nStrLen] = 0; p[nStrLen] = 0;
......
...@@ -408,7 +408,7 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos ) ...@@ -408,7 +408,7 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
sal_Int32 nMask = ~( m_nPageSize - 1 ); sal_Int32 nMask = ~( m_nPageSize - 1 );
sal_Int32 nOld = m_nPos & nMask; sal_Int32 nOld = m_nPos & nMask;
sal_Int32 nNew = nBytePos & nMask; sal_Int32 nNew = nBytePos & nMask;
m_nOffset = (short) ( nBytePos & ~nMask ); m_nOffset = static_cast<short>( nBytePos & ~nMask );
m_nPos = nBytePos; m_nPos = nBytePos;
if( nOld == nNew ) if( nOld == nNew )
return true; return true;
...@@ -586,9 +586,9 @@ bool StgFATStrm::Pos2Page( sal_Int32 nBytePos ) ...@@ -586,9 +586,9 @@ bool StgFATStrm::Pos2Page( sal_Int32 nBytePos )
if( nBytePos < 0 || nBytePos >= m_nSize ) if( nBytePos < 0 || nBytePos >= m_nSize )
nBytePos = m_nSize ? m_nSize - 1 : 0; nBytePos = m_nSize ? m_nSize - 1 : 0;
m_nPage = nBytePos / m_nPageSize; m_nPage = nBytePos / m_nPageSize;
m_nOffset = (short) ( nBytePos % m_nPageSize ); m_nOffset = static_cast<short>( nBytePos % m_nPageSize );
m_nPos = nBytePos; m_nPos = nBytePos;
m_nPage = GetPage( (short) m_nPage, false ); m_nPage = GetPage( static_cast<short>(m_nPage), false );
return m_nPage >= 0; return m_nPage >= 0;
} }
...@@ -624,7 +624,7 @@ sal_Int32 StgFATStrm::GetPage( short nOff, bool bMake, sal_uInt16 *pnMasterAlloc ...@@ -624,7 +624,7 @@ sal_Int32 StgFATStrm::GetPage( short nOff, bool bMake, sal_uInt16 *pnMasterAlloc
pMaster = m_rIo.Copy( nFAT ); pMaster = m_rIo.Copy( nFAT );
if ( pMaster.is() ) 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 ); m_rIo.SetToPage( pMaster, k, STG_FREE );
// chaining // chaining
if( !pOldPage.is() ) if( !pOldPage.is() )
...@@ -731,8 +731,8 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) ...@@ -731,8 +731,8 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes )
m_aPagesCache.clear(); m_aPagesCache.clear();
// Set the number of entries to a multiple of the page size // Set the number of entries to a multiple of the page size
short nOld = (short) ( ( m_nSize + ( m_nPageSize - 1 ) ) / m_nPageSize ); short nOld = static_cast<short>( ( m_nSize + ( m_nPageSize - 1 ) ) / m_nPageSize );
short nNew = (short) ( short nNew = static_cast<short>(
( nBytes + ( m_nPageSize - 1 ) ) / m_nPageSize ) ; ( nBytes + ( m_nPageSize - 1 ) ) / m_nPageSize ) ;
if( nNew < nOld ) if( nNew < nOld )
{ {
...@@ -776,7 +776,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) ...@@ -776,7 +776,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes )
rtl::Reference< StgPage > pPg = m_rIo.Copy( nNewPage ); rtl::Reference< StgPage > pPg = m_rIo.Copy( nNewPage );
if ( !pPg.is() ) if ( !pPg.is() )
return false; 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 ); m_rIo.SetToPage( pPg, j, STG_FREE );
// store the page number into the master FAT // store the page number into the master FAT
...@@ -808,7 +808,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) ...@@ -808,7 +808,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes )
nOld++; nOld++;
// We have used up 4 bytes for the STG_FAT entry // We have used up 4 bytes for the STG_FAT entry
nBytes += 4; nBytes += 4;
nNew = (short) ( nNew = static_cast<short>(
( nBytes + ( m_nPageSize - 1 ) ) / m_nPageSize ); ( nBytes + ( m_nPageSize - 1 ) ) / m_nPageSize );
} }
} }
...@@ -921,8 +921,8 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -921,8 +921,8 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
{ {
short nBytes = m_nPageSize - m_nOffset; short nBytes = m_nPageSize - m_nOffset;
rtl::Reference< StgPage > pPg; rtl::Reference< StgPage > pPg;
if( (sal_Int32) nBytes > n ) if( static_cast<sal_Int32>(nBytes) > n )
nBytes = (short) n; nBytes = static_cast<short>(n);
if( nBytes ) if( nBytes )
{ {
short nRes; short nRes;
...@@ -938,7 +938,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -938,7 +938,7 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
} }
else else
// do a direct (unbuffered) read // 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 else
{ {
...@@ -980,8 +980,8 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -980,8 +980,8 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
{ {
short nBytes = m_nPageSize - m_nOffset; short nBytes = m_nPageSize - m_nOffset;
rtl::Reference< StgPage > pPg; rtl::Reference< StgPage > pPg;
if( (sal_Int32) nBytes > n ) if( static_cast<sal_Int32>(nBytes) > n )
nBytes = (short) n; nBytes = static_cast<short>(n);
if( nBytes ) if( nBytes )
{ {
short nRes; short nRes;
...@@ -998,7 +998,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -998,7 +998,7 @@ sal_Int32 StgDataStrm::Write( const void* pBuf, sal_Int32 n )
} }
else else
// do a direct (unbuffered) write // 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 else
{ {
...@@ -1070,8 +1070,8 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -1070,8 +1070,8 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
while( n ) while( n )
{ {
short nBytes = m_nPageSize - m_nOffset; short nBytes = m_nPageSize - m_nOffset;
if( (sal_Int32) nBytes > n ) if( static_cast<sal_Int32>(nBytes) > n )
nBytes = (short) n; nBytes = static_cast<short>(n);
if( nBytes ) if( nBytes )
{ {
if (!m_pData) if (!m_pData)
...@@ -1082,7 +1082,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n ) ...@@ -1082,7 +1082,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
if (!m_pData->Pos2Page(nPos + m_nOffset)) if (!m_pData->Pos2Page(nPos + m_nOffset))
break; break;
// all reading through the stream // 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; nDone = nDone + nRes;
m_nPos += nRes; m_nPos += nRes;
n -= nRes; n -= nRes;
...@@ -1113,8 +1113,8 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -1113,8 +1113,8 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
while( n ) while( n )
{ {
short nBytes = m_nPageSize - m_nOffset; short nBytes = m_nPageSize - m_nOffset;
if( (sal_Int32) nBytes > n ) if( static_cast<sal_Int32>(nBytes) > n )
nBytes = (short) n; nBytes = static_cast<short>(n);
if( nBytes ) if( nBytes )
{ {
// all writing goes through the stream // all writing goes through the stream
...@@ -1125,7 +1125,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n ) ...@@ -1125,7 +1125,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
break; break;
if( !m_pData->Pos2Page( nDataPos ) ) if( !m_pData->Pos2Page( nDataPos ) )
break; 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; nDone = nDone + nRes;
m_nPos += nRes; m_nPos += nRes;
n -= nRes; n -= nRes;
...@@ -1268,7 +1268,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) ...@@ -1268,7 +1268,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
} }
m_pStrm = s; m_pStrm = s;
// Shrink the memory to 16 bytes, which seems to be the minimum // Shrink the memory to 16 bytes, which seems to be the minimum
ReAllocateMemory( - ( (long) nEndOfData - 16 ) ); ReAllocateMemory( - ( static_cast<long>(nEndOfData) - 16 ) );
} }
else else
{ {
......
...@@ -152,7 +152,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData ...@@ -152,7 +152,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
checkError(); checkError();
// if read characters < MaxLength, adjust sequence // if read characters < MaxLength, adjust sequence
if ((sal_Int32)nRead < aData.getLength()) if (static_cast<sal_Int32>(nRead) < aData.getLength())
aData.realloc( nRead ); aData.realloc( nRead );
return nRead; return nRead;
...@@ -209,7 +209,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::available() ...@@ -209,7 +209,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::available()
m_pSvStream->Seek(STREAM_SEEK_TO_END); m_pSvStream->Seek(STREAM_SEEK_TO_END);
checkError(); 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); m_pSvStream->Seek(nPos);
checkError(); checkError();
...@@ -241,7 +241,7 @@ void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation ) ...@@ -241,7 +241,7 @@ void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation )
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
checkConnected(); checkConnected();
m_pSvStream->Seek((sal_uInt32)_nLocation); m_pSvStream->Seek(static_cast<sal_uInt32>(_nLocation));
checkError(); checkError();
} }
...@@ -256,7 +256,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( ) ...@@ -256,7 +256,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( )
sal_uInt32 nPos = m_pSvStream->Tell(); sal_uInt32 nPos = m_pSvStream->Tell();
checkError(); checkError();
return (sal_Int64)nPos; return static_cast<sal_Int64>(nPos);
} }
...@@ -277,7 +277,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( ) ...@@ -277,7 +277,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( )
checkError(); checkError();
return (sal_Int64)nEndPos; return static_cast<sal_Int64>(nEndPos);
} }
...@@ -1735,7 +1735,7 @@ void UCBStorage_Impl::ReadContent() ...@@ -1735,7 +1735,7 @@ void UCBStorage_Impl::ReadContent()
bool bIsFolder( xRow->getBoolean(2) ); bool bIsFolder( xRow->getBoolean(2) );
sal_Int64 nSize = xRow->getLong(4); 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 ); m_aChildrenList.emplace_back( pElement );
bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != SvGlobalName() ); bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != SvGlobalName() );
......
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