[Libreoffice-commits] core.git: sfx2/source soltools/cpp sot/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 15 18:59:25 UTC 2020


 sfx2/source/appl/linkmgr2.cxx    |    9 +++++----
 sfx2/source/appl/opengrf.cxx     |    3 ++-
 sfx2/source/dialog/mailmodel.cxx |    4 ++--
 soltools/cpp/_cpp.c              |    3 ++-
 soltools/cpp/_eval.c             |   18 ++++++++++++------
 soltools/cpp/_lex.c              |   10 +++++++---
 soltools/cpp/_unix.c             |   14 ++++++++++++--
 sot/source/sdstor/stg.cxx        |    5 ++++-
 sot/source/sdstor/stgdir.cxx     |    3 ++-
 9 files changed, 48 insertions(+), 21 deletions(-)

New commits:
commit a2362e0ff5a7cec16e888502a3c16fe2fa7ba0fe
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 15 19:32:09 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 15 20:58:44 2020 +0200

    loplugin:buriedassign in sfx2..sot
    
    Change-Id: I917752edb50020f9acb203038ce65f1ea25afa64
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92312
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index ca9cde51e17f..4c5af8b85cda 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -476,15 +476,16 @@ void LinkManager::InsertFileLink(
 // (for now this is only of interest for the file links!)
 void LinkManager::CancelTransfers()
 {
-    SvFileObject* pFileObj;
 
     const sfx2::SvBaseLinks& rLnks = GetLinks();
     for( size_t n = rLnks.size(); n; )
     {
         const sfx2::SvBaseLink& rLnk = *rLnks[--n];
-        if (isClientFileType(rLnk.GetObjType())
-            && nullptr != (pFileObj = static_cast<SvFileObject*>(rLnk.GetObj())))
-            pFileObj->CancelTransfers();
+        if (isClientFileType(rLnk.GetObjType()))
+        {
+            if (SvFileObject* pFileObj = static_cast<SvFileObject*>(rLnk.GetObj()))
+                pFileObj->CancelTransfers();
+        }
     }
 }
 
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 02b44545bf73..6ef8ecdf4b61 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -138,7 +138,8 @@ ErrCode SvxOpenGraphicDialog::Execute()
             }
             else
             {
-                if( (nImpRet=rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat )) != ERRCODE_NONE )
+                nImpRet = rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat );
+                if( nImpRet != ERRCODE_NONE )
                     nImpRet = rFilter.CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat );
             }
 
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 5aad8f3698a3..63e29270d6c2 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -498,8 +498,8 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
                         xPrepareDispatch.set( xDispatchProvider->queryDispatch( aPrepareURL, OUString(), 0 ));
                         if ( xPrepareDispatch.is() )
                         {
-                                PrepareListener_Impl* pPrepareListener;
-                                uno::Reference< css::frame::XStatusListener > xStatusListener = pPrepareListener = new PrepareListener_Impl;
+                                PrepareListener_Impl* pPrepareListener = new PrepareListener_Impl;
+                                uno::Reference< css::frame::XStatusListener > xStatusListener = pPrepareListener;
                                 xPrepareDispatch->addStatusListener( xStatusListener, aPrepareURL );
                                 bNeedsPreparation = pPrepareListener->IsSet();
                                 xPrepareDispatch->removeStatusListener( xStatusListener, aPrepareURL );
diff --git a/soltools/cpp/_cpp.c b/soltools/cpp/_cpp.c
index 003611c3f53b..77a7193477c9 100644
--- a/soltools/cpp/_cpp.c
+++ b/soltools/cpp/_cpp.c
@@ -129,7 +129,8 @@ void
             error(ERROR, "Unidentifiable control line");
         return;                         /* else empty line */
     }
-    if ((np = lookup(tp, 0)) == NULL || ((np->flag & ISKW) == 0 && !skipping))
+    np = lookup(tp, 0);
+    if (np == NULL || ((np->flag & ISKW) == 0 && !skipping))
     {
         error(WARNING, "Unknown preprocessor control %t", tp);
         return;
diff --git a/soltools/cpp/_eval.c b/soltools/cpp/_eval.c
index 7efdd82715d9..e8b679ea93e1 100644
--- a/soltools/cpp/_eval.c
+++ b/soltools/cpp/_eval.c
@@ -633,12 +633,14 @@ struct value
             break;
 
         case NAME1:
-            if ((np = lookup(tp, 0)) != NULL && np->flag & (ISDEFINED | ISMAC))
+            np = lookup(tp, 0);
+            if (np != NULL && np->flag & (ISDEFINED | ISMAC))
                 v.val = 1;
             break;
 
         case NAME2:
-            if ((np = lookup(tp, 0)) != NULL && np->flag & (ISARCHITECTURE))
+            np = lookup(tp, 0);
+            if (np != NULL && np->flag & (ISARCHITECTURE))
                 v.val = 1;
             break;
 
@@ -700,16 +702,19 @@ struct value
             if (*p == '\\')
             {
                 p += 1;
-                if ((i = digit(*p)) >= 0 && i <= 7)
+                i = digit(*p);
+                if (i >= 0 && i <= 7)
                 {
                     n = i;
                     p += 1;
-                    if ((i = digit(*p)) >= 0 && i <= 7)
+                    i = digit(*p);
+                    if (i >= 0 && i <= 7)
                     {
                         p += 1;
                         n <<= 3;
                         n += i;
-                        if ((i = digit(*p)) >= 0 && i <= 7)
+                        i = digit(*p);
+                        if (i >= 0 && i <= 7)
                         {
                             p += 1;
                             n <<= 3;
@@ -721,7 +726,8 @@ struct value
                     if (*p == 'x')
                     {
                         p += 1;
-                        while ((i = digit(*p)) >= 0 && i <= 15)
+                        i = digit(*p);
+                        while (i >= 0 && i <= 15)
                         {
                             p += 1;
                             n <<= 4;
diff --git a/soltools/cpp/_lex.c b/soltools/cpp/_lex.c
index 135c36ca4f93..28fae7a548ec 100644
--- a/soltools/cpp/_lex.c
+++ b/soltools/cpp/_lex.c
@@ -624,10 +624,14 @@ int
 int
     fillbuf(Source * s)
 {
-    int n;
+    int n = 0;
 
-    if (s->fd < 0 || (n = read(s->fd, (char *) s->inl, INS / 8)) <= 0)
-        n = 0;
+    if (s->fd >= 0)
+    {
+        n = read(s->fd, (char *) s->inl, INS / 8);
+        if (n <= 0)
+            n = 0;
+    }
     s->inl += n;
     s->inl[0] = s->inl[1] = s->inl[2] = s->inl[3] = EOB;
     if (n == 0)
diff --git a/soltools/cpp/_unix.c b/soltools/cpp/_unix.c
index ac4b7624a00a..1135bb08ea40 100644
--- a/soltools/cpp/_unix.c
+++ b/soltools/cpp/_unix.c
@@ -99,7 +99,11 @@ void
                 break;
 
             case 'V':
-                for (n = 0; (c = optarg[n]) != '\0'; n++)
+                for (n = 0;; n++)
+                {
+                    c = optarg[n];
+                    if (c == '\0')
+                        break;
                     switch (c)
                     {
                         case 'i':
@@ -125,10 +129,15 @@ void
                         default:
                             error(WARNING, "Unknown verbose option %c", c);
                     }
+                }
                 break;
 
             case 'X':
-                for (n = 0; (c = optarg[n]) != '\0'; n++)
+                for (n = 0;; n++)
+                {
+                    c = optarg[n];
+                    if (c == '\0')
+                        break;
                     switch (c)
                     {
                         case 'a':
@@ -167,6 +176,7 @@ void
                         default:
                             error(WARNING, "Unknown extension option %c", c);
                     }
+                }
                 break;
 
             case '+':
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index edc2477f7651..3e72d13b3fff 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -211,7 +211,10 @@ sal_uLong StorageStream::Write( const void* pData, sal_uLong nSize )
 sal_uInt64 StorageStream::Seek( sal_uInt64 n )
 {
     if( Validate() )
-        return nPos = pEntry->Seek( n );
+    {
+        nPos = pEntry->Seek( n );
+        return nPos;
+    }
     else
         return n;
 }
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 4002d637230d..f7047dc28600 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -423,7 +423,8 @@ sal_Int32 StgDirEntry::Seek( sal_Int32 nNew )
         nNew = m_pStgStrm->GetPos();
     }
 
-    return m_nPos = nNew;
+    m_nPos = nNew;
+    return m_nPos;
 }
 
 // Read


More information about the Libreoffice-commits mailing list