Kaydet (Commit) cf6b3bec authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 PVS: Let ScConflictsFinder::GetEntry return reference

V560 A part of conditional expression is always true: pEntry.

V560 A part of conditional expression is always true: pConflictEntry.

Change-Id: I54fad2b0236c8c686f470a50ce45b096a842d56a
Reviewed-on: https://gerrit.libreoffice.org/63519
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 19d74750
......@@ -83,7 +83,7 @@ private:
static bool DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 );
ScConflictsListEntry* GetIntersectingEntry( const ScChangeAction* pAction ) const;
ScConflictsListEntry* GetEntry( sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions );
ScConflictsListEntry& GetEntry(sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions);
public:
ScConflictsFinder( ScChangeTrack* pTrack, sal_uLong nStartShared, sal_uLong nEndShared,
......
......@@ -155,13 +155,13 @@ ScConflictsListEntry* ScConflictsFinder::GetIntersectingEntry( const ScChangeAct
return nullptr;
}
ScConflictsListEntry* ScConflictsFinder::GetEntry( sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions )
ScConflictsListEntry& ScConflictsFinder::GetEntry( sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions )
{
// try to get a list entry which already contains the shared action
ScConflictsListEntry* pEntry = ScConflictsListHelper::GetSharedActionEntry( mrConflictsList, nSharedAction );
if ( pEntry )
{
return pEntry;
return *pEntry;
}
// try to get a list entry for which the shared action intersects with any
......@@ -170,7 +170,7 @@ ScConflictsListEntry* ScConflictsFinder::GetEntry( sal_uLong nSharedAction, cons
if ( pEntry )
{
pEntry->maSharedActions.push_back( nSharedAction );
return pEntry;
return *pEntry;
}
// try to get a list entry for which any of the own actions intersects with
......@@ -181,7 +181,7 @@ ScConflictsListEntry* ScConflictsFinder::GetEntry( sal_uLong nSharedAction, cons
if ( pEntry )
{
pEntry->maSharedActions.push_back( nSharedAction );
return pEntry;
return *pEntry;
}
}
......@@ -190,7 +190,7 @@ ScConflictsListEntry* ScConflictsFinder::GetEntry( sal_uLong nSharedAction, cons
aEntry.meConflictAction = SC_CONFLICT_ACTION_NONE;
aEntry.maSharedActions.push_back( nSharedAction );
mrConflictsList.push_back( aEntry );
return &(mrConflictsList.back());
return mrConflictsList.back();
}
bool ScConflictsFinder::Find()
......@@ -217,12 +217,12 @@ bool ScConflictsFinder::Find()
if ( !aOwnActions.empty() )
{
ScConflictsListEntry* pEntry = GetEntry( pSharedAction->GetActionNumber(), aOwnActions );
ScConflictsListEntry& rEntry = GetEntry(pSharedAction->GetActionNumber(), aOwnActions);
for ( auto& aOwnAction : aOwnActions )
{
if ( pEntry && !ScConflictsListHelper::HasOwnAction( mrConflictsList, aOwnAction ) )
if (!ScConflictsListHelper::HasOwnAction(mrConflictsList, aOwnAction))
{
pEntry->maOwnActions.push_back( aOwnAction );
rEntry.maOwnActions.push_back(aOwnAction);
}
}
bReturn = true;
......@@ -631,11 +631,11 @@ void ScConflictsDlg::UpdateView()
ScConflictsList::iterator aEndItr = mrConflictsList.end();
for ( ScConflictsList::iterator aItr = mrConflictsList.begin(); aItr != aEndItr; ++aItr )
{
ScConflictsListEntry* pConflictEntry = &(*aItr);
if ( pConflictEntry && pConflictEntry->meConflictAction == SC_CONFLICT_ACTION_NONE )
ScConflictsListEntry& rConflictEntry = *aItr;
if (rConflictEntry.meConflictAction == SC_CONFLICT_ACTION_NONE)
{
RedlinData* pRootUserData = new RedlinData();
pRootUserData->pData = static_cast< void* >( pConflictEntry );
pRootUserData->pData = static_cast<void*>(&rConflictEntry);
SvTreeListEntry* pRootEntry = m_pLbConflicts->InsertEntry( GetConflictString( *aItr ), pRootUserData );
for ( auto& aSharedAction : aItr->maSharedActions )
......
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