diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-21 17:08:51 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-21 21:09:27 +0200 |
commit | e473d49f5666382a8d5b696a00330a55c889f56e (patch) | |
tree | b486722d91e8a4600a1dd846374cd269a8a1f1d8 /svl | |
parent | 34208a37bf22823ac80aa9fb7938af759c66f5ca (diff) |
tdf#120703 (PVS): redundant nullptr check; loop index size
V668 There is no sense in testing the 's' pointer against null, as the
memory was allocated using the 'new' operator. The exception will
be generated in the case of memory allocation error.
V1029 Numeric Truncation Error. Result of the 'size' function is written
to the 16-bit variable.
Change-Id: I8e0598e892ca160ac074bccfed87c14367a3b46a
Reviewed-on: https://gerrit.libreoffice.org/62139
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/svdde/ddesvr.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 1848342b893b..b9b6bcce4660 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -577,11 +577,8 @@ DdeItem* DdeTopic::AddItem( const DdeItem& r ) else s = new DdeItem( r ); - if ( s ) - { - aItems.push_back( s ); - s->pMyTopic = this; - } + aItems.push_back( s ); + s->pMyTopic = this; return s; } @@ -770,9 +767,9 @@ short DdeItem::GetLinks() short nCnt = 0; if( pImpData ) { - for( sal_uInt16 n = pImpData->size(); n; ) + for (const auto& rData : *pImpData) { - nCnt = nCnt + (*pImpData)[ --n ].nCnt; + nCnt += rData.nCnt; } } return nCnt; |