loplugin:constantparam in svl

Change-Id: Iefc441262cbdc6f115ea4ca5a673456b59477e13
This commit is contained in:
Noel Grandin
2016-03-08 15:19:44 +02:00
parent 44bccf92bc
commit 96a2aa94b2
5 changed files with 19 additions and 25 deletions

View File

@@ -295,7 +295,7 @@ protected:
sal_uInt16 nTag, sal_uInt8 nCurVer ); sal_uInt16 nTag, sal_uInt8 nCurVer );
public: public:
sal_uInt32 Close( bool bSeekToEndOfRec = true ); sal_uInt32 Close();
}; };
/** /**
@@ -588,7 +588,7 @@ inline void SfxMiniRecordReader::Skip()
} }
/// @see SfxMiniRecordWriter::Close() /// @see SfxMiniRecordWriter::Close()
inline sal_uInt32 SfxSingleRecordWriter::Close( bool bSeekToEndOfRec ) inline sal_uInt32 SfxSingleRecordWriter::Close()
{ {
sal_uInt32 nRet = 0; sal_uInt32 nRet = 0;
@@ -596,17 +596,16 @@ inline sal_uInt32 SfxSingleRecordWriter::Close( bool bSeekToEndOfRec )
if ( !_bHeaderOk ) if ( !_bHeaderOk )
{ {
// write base class header // write base class header
sal_uInt32 nEndPos = SfxMiniRecordWriter::Close( bSeekToEndOfRec ); sal_uInt32 nEndPos = SfxMiniRecordWriter::Close( false/*bSeekToEndOfRec*/ );
// seek the end of the own header if needed or stay behind the record // seek the end of the own header if needed or stay behind the record
if ( !bSeekToEndOfRec ) _pStream->SeekRel( SFX_REC_HEADERSIZE_SINGLE );
_pStream->SeekRel( SFX_REC_HEADERSIZE_SINGLE );
nRet = nEndPos; nRet = nEndPos;
} }
#ifdef DBG_UTIL #ifdef DBG_UTIL
else else
// check base class header // check base class header
SfxMiniRecordWriter::Close( bSeekToEndOfRec ); SfxMiniRecordWriter::Close( false/*bSeekToEndOfRec*/ );
#endif #endif
return nRet; return nRet;

View File

@@ -354,7 +354,7 @@ public:
/** removes the oldest Undo actions from the stack /** removes the oldest Undo actions from the stack
*/ */
void RemoveOldestUndoActions( size_t const i_count ); void RemoveOldestUndoAction();
void dumpAsXml(struct _xmlTextWriter* pWriter) const; void dumpAsXml(struct _xmlTextWriter* pWriter) const;

View File

@@ -313,7 +313,7 @@ sal_uInt32 SfxMultiFixRecordWriter::Close()
if ( !_bHeaderOk ) if ( !_bHeaderOk )
{ {
// remember position after header, to be able to seek back to it // remember position after header, to be able to seek back to it
sal_uInt32 nEndPos = SfxSingleRecordWriter::Close( false ); sal_uInt32 nEndPos = SfxSingleRecordWriter::Close();
// write extended header after SfxSingleRecord // write extended header after SfxSingleRecord
_pStream->WriteUInt16( _nContentCount ); _pStream->WriteUInt16( _nContentCount );
@@ -432,7 +432,7 @@ sal_uInt32 SfxMultiVarRecordWriter::Close()
_pStream->WriteUInt32( _aContentOfs[n] ); _pStream->WriteUInt32( _aContentOfs[n] );
// skip SfxMultiFixRecordWriter::Close()! // skip SfxMultiFixRecordWriter::Close()!
sal_uInt32 nEndPos = SfxSingleRecordWriter::Close( false ); sal_uInt32 nEndPos = SfxSingleRecordWriter::Close();
// write own header // write own header
_pStream->WriteUInt16( _nContentCount ); _pStream->WriteUInt16( _nContentCount );

View File

@@ -1254,26 +1254,21 @@ bool SfxUndoManager::HasTopUndoActionMark( UndoStackMark const i_mark )
} }
void SfxUndoManager::RemoveOldestUndoActions( size_t const i_count ) void SfxUndoManager::RemoveOldestUndoAction()
{ {
UndoManagerGuard aGuard( *m_xData ); UndoManagerGuard aGuard( *m_xData );
size_t nActionsToRemove = i_count; SfxUndoAction* pActionToRemove = m_xData->pUndoArray->aUndoActions[0].pAction;
while ( nActionsToRemove )
if ( IsInListAction() && ( m_xData->pUndoArray->nCurUndoAction == 1 ) )
{ {
SfxUndoAction* pActionToRemove = m_xData->pUndoArray->aUndoActions[0].pAction; assert(!"SfxUndoManager::RemoveOldestUndoActions: cannot remove a not-yet-closed list action!");
return;
if ( IsInListAction() && ( m_xData->pUndoArray->nCurUndoAction == 1 ) )
{
assert(!"SfxUndoManager::RemoveOldestUndoActions: cannot remove a not-yet-closed list action!");
return;
}
aGuard.markForDeletion( pActionToRemove );
m_xData->pUndoArray->aUndoActions.Remove( 0 );
--m_xData->pUndoArray->nCurUndoAction;
--nActionsToRemove;
} }
aGuard.markForDeletion( pActionToRemove );
m_xData->pUndoArray->aUndoActions.Remove( 0 );
--m_xData->pUndoArray->nCurUndoAction;
} }
void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const

View File

@@ -424,7 +424,7 @@ void UndoManager::AddUndoAction(SfxUndoAction *pAction, bool bTryMerge)
// if the undo nodes array is too large, delete some actions // if the undo nodes array is too large, delete some actions
while (UNDO_ACTION_LIMIT < GetUndoNodes().Count()) while (UNDO_ACTION_LIMIT < GetUndoNodes().Count())
{ {
RemoveOldestUndoActions(1); RemoveOldestUndoAction();
} }
} }