loplugin:constantparam in svl

Change-Id: If23e43beb401047825641817e09d7fdeb904f9d9
Reviewed-on: https://gerrit.libreoffice.org/23317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-03-17 09:45:22 +02:00 committed by Noel Grandin
parent 16fc620a22
commit 07da25064f
11 changed files with 32 additions and 45 deletions

View File

@ -236,11 +236,11 @@ protected:
, _nPreTag(0)
{
}
void Construct_Impl( SvStream *pStream, sal_uInt8 nTag )
void Construct_Impl( SvStream *pStream )
{
_pStream = pStream;
_bSkipped = false;
_nPreTag = nTag;
_nPreTag = SFX_REC_PRETAG_EXT;
}
inline bool SetHeader_Impl( sal_uInt32 nHeader );
@ -319,8 +319,7 @@ protected:
}
void Construct_Impl( SvStream *pStream )
{
SfxMiniRecordReader::Construct_Impl(
pStream, SFX_REC_PRETAG_EXT );
SfxMiniRecordReader::Construct_Impl( pStream );
}
bool FindHeader_Impl( sal_uInt16 nTypes, sal_uInt16 nTag );
};
@ -444,8 +443,7 @@ protected:
public:
SfxMultiVarRecordWriter( SvStream *pStream,
sal_uInt16 nRecordTag,
sal_uInt8 nRecordVer );
sal_uInt16 nRecordTag );
virtual ~SfxMultiVarRecordWriter();
void NewContent();
@ -484,8 +482,7 @@ class SVL_DLLPUBLIC SfxMultiMixRecordWriter: public SfxMultiVarRecordWriter
{
public:
inline SfxMultiMixRecordWriter( SvStream *pStream,
sal_uInt16 nRecordTag,
sal_uInt8 nRecordVer );
sal_uInt16 nRecordTag );
void NewContent( sal_uInt16 nTag, sal_uInt8 nVersion );
};
@ -627,12 +624,10 @@ inline SfxMultiFixRecordWriter::~SfxMultiFixRecordWriter()
*
* @param pStream target stream in which the record will be created
* @param nRecordTag tag for the total record
* @param nRecordVer version for the total record
*/
inline SfxMultiMixRecordWriter::SfxMultiMixRecordWriter( SvStream* pStream,
sal_uInt16 nRecordTag,
sal_uInt8 nRecordVer )
: SfxMultiVarRecordWriter( SFX_REC_TYPE_MIXTAGS, pStream, nRecordTag, nRecordVer )
sal_uInt16 nRecordTag )
: SfxMultiVarRecordWriter( SFX_REC_TYPE_MIXTAGS, pStream, nRecordTag, 0 )
{
}

View File

@ -151,7 +151,6 @@ public:
const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;
const SfxPoolItem* LoadItem( SvStream &rStream,
bool bDirect = false,
const SfxItemPool *pRefPool = nullptr );
bool StoreItem( SvStream &rStream,
const SfxPoolItem &rItem,

View File

@ -57,11 +57,11 @@ struct SfxItemPropertySimpleEntry
}
SfxItemPropertySimpleEntry(sal_uInt16 _nWID, css::uno::Type const & _rType,
long _nFlags, sal_uInt8 _nMemberId)
long _nFlags)
: nWID( _nWID )
, aType( _rType )
, nFlags( _nFlags )
, nMemberId( _nMemberId )
, nMemberId( 0 )
{
}

View File

@ -50,7 +50,7 @@ public:
const SfxItemSet *pPutSet );
~SfxItemPoolCache();
const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem, bool bNew = false );
const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem );
};

View File

@ -798,7 +798,7 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
do
{
const ScPatternAttr* pOldPattern = pData[nPos].pPattern;
const ScPatternAttr* pNewPattern = static_cast<const ScPatternAttr*>( &pCache->ApplyTo( *pOldPattern, true ) );
const ScPatternAttr* pNewPattern = static_cast<const ScPatternAttr*>( &pCache->ApplyTo( *pOldPattern ) );
ScDocumentPool::CheckRef( *pOldPattern );
ScDocumentPool::CheckRef( *pNewPattern );
if (pNewPattern != pOldPattern)

View File

@ -494,7 +494,7 @@ void ScColumn::ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr )
// true = keep old content
const ScPatternAttr* pNewPattern = static_cast<const ScPatternAttr*>( &aCache.ApplyTo( *pPattern, true ) );
const ScPatternAttr* pNewPattern = static_cast<const ScPatternAttr*>( &aCache.ApplyTo( *pPattern ) );
ScDocumentPool::CheckRef( *pPattern );
ScDocumentPool::CheckRef( *pNewPattern );

View File

@ -362,10 +362,9 @@ SfxMultiVarRecordWriter::SfxMultiVarRecordWriter(sal_uInt8 nRecordType,
* for initializing the <SvULong> members.
*/
SfxMultiVarRecordWriter::SfxMultiVarRecordWriter(SvStream* pStream,
sal_uInt16 nRecordTag,
sal_uInt8 nRecordVer)
sal_uInt16 nRecordTag)
: SfxMultiFixRecordWriter( SFX_REC_TYPE_VARSIZE,
pStream, nRecordTag, nRecordVer ),
pStream, nRecordTag, 0 ),
_nContentVer( 0 )
{
}

View File

@ -142,8 +142,7 @@ void SfxItemPropertyMap::mergeProperties( const uno::Sequence< beans::Property >
SfxItemPropertySimpleEntry aTemp(
sal::static_int_cast< sal_Int16 >( pPropArray[nElement].Handle ), //nWID
pPropArray[nElement].Type, //aType
pPropArray[nElement].Attributes, //nFlags
0 ); //nMemberId
pPropArray[nElement].Attributes); //nFlags
(*m_pImpl)[pPropArray[nElement].Name] = aTemp;
}
}

View File

@ -1339,7 +1339,7 @@ void SfxItemSet::Load
{
// Load Surrogate/Item and resolve Surrogate
const SfxPoolItem *pItem =
m_pPool->LoadItem( rStream, false/*bDirect*/, pRefPool );
m_pPool->LoadItem( rStream, pRefPool );
// Did we load an Item or resolve a Surrogate?
if ( pItem )

View File

@ -59,7 +59,7 @@ SfxItemPoolCache::~SfxItemPoolCache()
}
const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, bool bNew )
const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem )
{
DBG_ASSERT( pPool == rOrigItem.GetItemSet().GetPool(), "invalid Pool" );
DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ),
@ -75,8 +75,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, bool b
if ( rMapEntry.pPoolItem != &rOrigItem )
{
rMapEntry.pPoolItem->AddRef(2); // One for the cache
if ( bNew )
pPool->Put( rOrigItem ); //FIXME: AddRef?
pPool->Put( rOrigItem ); //FIXME: AddRef?
}
return *rMapEntry.pPoolItem;
}
@ -98,8 +97,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, bool b
// Adapt refcount; one each for the cache
pNewPoolItem->AddRef( pNewPoolItem != &rOrigItem ? 2 : 1 );
if ( bNew )
pPool->Put( rOrigItem ); //FIXME: AddRef?
pPool->Put( rOrigItem ); //FIXME: AddRef?
// Add the transformation to the cache
SfxItemModifyImpl aModify;

View File

@ -154,7 +154,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
// VersionMaps
{
SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP, 0 );
SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP );
for ( size_t nVerNo = 0; nVerNo < pImp->aVersions.size(); ++nVerNo )
{
aVerRec.NewContent();
@ -176,7 +176,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
// Pooled Items
{
SfxMultiMixRecordWriter aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS, 0 );
SfxMultiMixRecordWriter aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS );
// First write the atomic Items and then write the Sets (important when loading)
for (int ft = 0 ; ft < 2 && !rStream.GetError(); ft++)
@ -209,7 +209,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
rStream.WriteUInt32( nCount );
// Write Items
SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS, 0 );
SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS );
for ( size_t j = 0; j < nCount; ++j )
{
// Get Item
@ -254,7 +254,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
// Save the set Defaults (PoolDefaults)
if ( !rStream.GetError() )
{
SfxMultiMixRecordWriter aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS, 0 );
SfxMultiMixRecordWriter aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS );
sal_uInt16 nCount = GetSize_Impl();
for ( sal_uInt16 n = 0; n < nCount; ++n )
{
@ -1187,7 +1187,7 @@ bool SfxItemPool::StoreItem( SvStream &rStream, const SfxPoolItem &rItem,
/**
* If pRefPool==-1 => do not put!
*/
const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect,
const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream,
const SfxItemPool *pRefPool )
{
sal_uInt16 nWhich(0), nSlot(0); // nSurrogate;
@ -1228,19 +1228,16 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect,
// Are we loading via surrogate?
const SfxPoolItem *pItem = nullptr;
if ( !bDirect )
{
// WhichId known in this version?
if ( nWhich )
// Load surrogate and react if none present
pItem = LoadSurrogate( rStream, nWhich, nSlot, pRefPool );
else
// Else skip it
rStream.SeekRel( sizeof(sal_uInt16) );
}
// WhichId known in this version?
if ( nWhich )
// Load surrogate and react if none present
pItem = LoadSurrogate( rStream, nWhich, nSlot, pRefPool );
else
// Else skip it
rStream.SeekRel( sizeof(sal_uInt16) );
// Is loaded directly (not via surrogate)?
if ( bDirect || ( nWhich && !pItem ) )
if ( nWhich && !pItem )
{
// bDirekt or not IsPoolable() => Load Item directly
sal_uInt16 nVersion(0);