svl/source/svdde/ddesvr.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit e473d49f5666382a8d5b696a00330a55c889f56e
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Oct 21 17:08:51 2018 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Oct 21 21:09:27 2018 +0200

    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.kagan...@collabora.com>

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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to