[Libreoffice-commits] core.git: 10 commits - svx/source ucb/source

Stephan Bergmann sbergman at redhat.com
Wed Oct 7 08:52:01 PDT 2015


 svx/source/dialog/srchdlg.cxx                                         |    7 +-
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx                  |    4 -
 svx/source/svdraw/svdedxv.cxx                                         |    2 
 svx/source/svdraw/svdhdl.cxx                                          |   33 ++++++----
 svx/source/svdraw/svdocapt.cxx                                        |   30 ++++++---
 svx/source/svdraw/svdoedge.cxx                                        |    7 +-
 svx/source/svdraw/svdopath.cxx                                        |   12 ++-
 svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx |    4 -
 ucb/source/ucp/gio/gio_seekable.cxx                                   |    1 
 ucb/source/ucp/webdav-neon/NeonSession.cxx                            |    8 --
 10 files changed, 68 insertions(+), 40 deletions(-)

New commits:
commit b270233f4b88a8a37f354f2d3af7b3a0f8a8c08b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:35:15 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: Ic94b5fdcf88a9580e816aceb199753e88636810a

diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 0e6bef6..c4581e1 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -358,7 +358,7 @@ namespace {
 } // namespace
 
 extern "C" int NeonSession_CertificationNotify( void *userdata,
-                                                int failures,
+                                                int,
                                                 const ne_ssl_certificate *cert )
 {
     OSL_ASSERT( cert );
@@ -376,8 +376,6 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
     if ( !xCertificateContainer.is() )
         return 1;
 
-    failures = 0;
-
     char * dn = ne_ssl_readable_dname( ne_ssl_cert_subject( cert ) );
     OUString cert_subject( dn, strlen( dn ), RTL_TEXTENCODING_UTF8, 0 );
 
@@ -462,15 +460,13 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
         pSession->getRequestEnvironment().m_xEnv );
     if ( xEnv.is() )
     {
-        failures = static_cast< int >( certValidity );
-
         uno::Reference< task::XInteractionHandler > xIH(
             xEnv->getInteractionHandler() );
         if ( xIH.is() )
         {
             rtl::Reference< ucbhelper::SimpleCertificateValidationRequest >
                 xRequest( new ucbhelper::SimpleCertificateValidationRequest(
-                    (sal_Int32)failures, xEECert, pSession->getHostName() ) );
+                    (sal_Int32)certValidity, xEECert, pSession->getHostName() ) );
             xIH->handle( xRequest.get() );
 
             rtl::Reference< ucbhelper::InteractionContinuation > xSelection
commit 7fa6bdeda854a801d2a1b30324b29fdd383ca0c2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:35:04 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I5f5eb507e1c5bbdc8a0517244e867724249f3661

diff --git a/ucb/source/ucp/gio/gio_seekable.cxx b/ucb/source/ucp/gio/gio_seekable.cxx
index 509eb29..9777fb5 100644
--- a/ucb/source/ucp/gio/gio_seekable.cxx
+++ b/ucb/source/ucp/gio/gio_seekable.cxx
@@ -107,7 +107,6 @@ sal_Int64 SAL_CALL Seekable::getLength() throw( io::IOException, uno::RuntimeExc
             convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
         nSize = getPosition();
         seek(nCurr);
-        bOk = true;
     }
 
     return nSize;
commit efa6fc2218a27f64771fb259d009d64f5ce460a0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:33:48 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I02a276eb929800692dff51e9241cab9d2345fae1

diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index 5697713..c3c6543 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -748,8 +748,8 @@ IMPL_LINK_NOARG_TYPED(ChineseDictionaryDialog, ModifyHdl, Button*, void)
         {
             if( m_pCB_Reverse->IsChecked() )
             {
-                sal_uIntPtr nPos = rReverse.deleteEntries( pE->m_aMapping );
-                nPos = rReverse.deleteEntries( aMapping );
+                rReverse.deleteEntries( pE->m_aMapping );
+                sal_uIntPtr nPos = rReverse.deleteEntries( aMapping );
                 rReverse.addEntry( aMapping, aTerm, nConversionPropertyType, nPos );
             }
 
commit fb499c00744bd7ff5629be0db9ff98c6fb4844b6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:33:16 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I9f495d748c2fe47fe5a91db21f44725fc00a7ed1

diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 95e6ce8..3f04723 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -794,7 +794,7 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
         // now check symmetric plus handles
         if (bControl) { // cases 5,6,7,8
             sal_uInt16   nSt; // the associated support point
-            sal_uInt16   nFix=nPnt;  // the opposing control point
+            sal_uInt16   nFix;  // the opposing control point
             if (bIsNextControl) { // if the next one is a control point, the on before has to be a support point
                 nSt=nPrevPnt;
                 nFix=nPrevPrevPnt;
commit 8737001fe8230ad301a716ec1f61b61ccd265422
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:33:10 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I6ddee7ee5f54388dae6f001d9fb9fbdb4012e11d

diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 10a8aea..95e6ce8 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -389,15 +389,17 @@ XPolygon ImpPathCreateUser::GetCirclePoly() const
 
 Point ImpPathCreateUser::CalcLine(const Point& aCsr, long nDirX, long nDirY, SdrView* pView)
 {
-    long x=aCsr.X(),x1=x,x2=x;
-    long y=aCsr.Y(),y1=y,y2=y;
+    long x=aCsr.X();
+    long y=aCsr.Y();
     bool bHLin=nDirY==0;
     bool bVLin=nDirX==0;
     if (bHLin) y=0;
     else if (bVLin) x=0;
     else {
-        x1=BigMulDiv(y,nDirX,nDirY);
-        y2=BigMulDiv(x,nDirY,nDirX);
+        long x1=BigMulDiv(y,nDirX,nDirY);
+        long y1=y;
+        long x2=x;
+        long y2=BigMulDiv(x,nDirY,nDirX);
         long l1=std::abs(x1)+std::abs(y1);
         long l2=std::abs(x2)+std::abs(y2);
         if ((l1<=l2) != (pView!=NULL && pView->IsBigOrtho())) {
commit 9c8601416ce87ed2fdebbf3eb8059deb0c9a9f18
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:31:57 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: Idebc9fabd8110dcd82c8cab7c5c7300e4c2c6f1d

diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index d0f2e00..a1e42f3 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1262,9 +1262,8 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
         aXP1.Insert(XPOLY_APPEND,aXP2[nNum],XPOLY_NORMAL);
     }
     sal_uInt16 nPointCount=aXP1.GetPointCount();
-    char cForm=0;
+    char cForm;
     if (bInfo || pnQuality!=NULL) {
-        cForm='?';
         if (nPointCount==2) cForm='I';
         else if (nPointCount==3) cForm='L';
         else if (nPointCount==4) { // Z or U
@@ -1305,6 +1304,10 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
             }
         }
     }
+    else
+    {
+        cForm = 0;
+    }
     if (pnQuality!=NULL) {
         sal_uIntPtr nQual=0;
         sal_uIntPtr nQual0=nQual; // prevent overruns
commit 981ae9f89a2762fb36fe0ac3fee6826f11425de3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:30:06 2015 +0200

    Avoid clang-analyzer-deadcode.DeadStores
    
    ...in case future modifications to SdrCaptionObj::TRSetBaseGeometry /will/ make
    use of fRotate.
    
    Change-Id: I25480efcbf1fede4af7241c4627dbfa7981793ed

diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 52d37e7..b7f6b5e 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <cassert>
+
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
@@ -761,6 +765,23 @@ SdrObject* SdrCaptionObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
     return pRet;
 }
 
+namespace {
+
+void handleNegativeScale(basegfx::B2DTuple & scale, double * rotate) {
+    assert(rotate != nullptr);
+
+    // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
+    // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
+    if(basegfx::fTools::less(scale.getX(), 0.0) && basegfx::fTools::less(scale.getY(), 0.0))
+    {
+        scale.setX(fabs(scale.getX()));
+        scale.setY(fabs(scale.getY()));
+        *rotate = fmod(*rotate + F_PI, F_2PI);
+    }
+}
+
+}
+
 // #i32599#
 // Add own implementation for TRSetBaseGeometry to handle TailPos over changes.
 void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
@@ -771,14 +792,7 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons
     double fRotate, fShearX;
     rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
 
-    // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
-    // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
-    if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
-    {
-        aScale.setX(fabs(aScale.getX()));
-        aScale.setY(fabs(aScale.getY()));
-        fRotate = fmod(fRotate + F_PI, F_2PI);
-    }
+    handleNegativeScale(aScale, &fRotate);
 
     // force metric to pool metric
     SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0);
commit 3f6e074d8e77c0cd82f9715b48024e81470180d3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:28:09 2015 +0200

    Avoid clang-analyzer-deadcode.DeadStores
    
    ...in case future modifications to SdrCropViewHdl::CreateB2dIAObject /will/ make
    use of fRotate.
    
    Change-Id: I059d61879fceca88893625b099d4e2c0bda65067

diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index f30421e..92ed90c 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1683,7 +1683,6 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
                 mxTextEditObj->SetMergedItemSetAndBroadcast(*pSet, bReplaceAll);
 
                 FlushComeBackTimer(); // to set ModeHasChanged immediately
-                bRet=true;
             }
         }
         else if (!bOnlyEEItems)
@@ -1728,7 +1727,6 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
                 }
             }
             FlushComeBackTimer();
-            bRet=true;
         }
         if(!bNoEEItems)
         {
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 256e003..84a53dc 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -19,6 +19,7 @@
 
 
 #include <algorithm>
+#include <cassert>
 
 #include <svx/svdhdl.hxx>
 #include <svx/svdpagv.hxx>
@@ -2396,6 +2397,26 @@ SdrCropViewHdl::SdrCropViewHdl(
 {
 }
 
+namespace {
+
+void translateRotationToMirroring(basegfx::B2DVector & scale, double * rotate) {
+    assert(rotate != nullptr);
+
+    // detect 180 degree rotation, this is the same as mirrored in X and Y,
+    // thus change to mirroring. Prefer mirroring here. Use the equal call
+    // with getSmallValue here, the original which uses rtl::math::approxEqual
+    // is too correct here. Maybe this changes with enhanced precision in aw080
+    // to the better so that this can be reduced to the more precise call again
+    if(basegfx::fTools::equal(fabs(*rotate), F_PI, 0.000000001))
+    {
+        scale.setX(scale.getX() * -1.0);
+        scale.setY(scale.getY() * -1.0);
+        *rotate = 0.0;
+    }
+}
+
+}
+
 void SdrCropViewHdl::CreateB2dIAObject()
 {
     GetRidOfIAObject();
@@ -2418,17 +2439,7 @@ void SdrCropViewHdl::CreateB2dIAObject()
         return;
     }
 
-    // detect 180 degree rotation, this is the same as mirrored in X and Y,
-    // thus change to mirroring. Prefer mirroring here. Use the equal call
-    // with getSmallValue here, the original which uses rtl::math::approxEqual
-    // is too correct here. Maybe this changes with enhanced precision in aw080
-    // to the better so that this can be reduced to the more precise call again
-    if(basegfx::fTools::equal(fabs(fRotate), F_PI, 0.000000001))
-    {
-        aScale.setX(aScale.getX() * -1.0);
-        aScale.setY(aScale.getY() * -1.0);
-        fRotate = 0.0;
-    }
+    translateRotationToMirroring(aScale, &fRotate);
 
     // remember mirroring, reset at Scale and adapt crop values for usage;
     // mirroring can stay in the object transformation, so do not have to
commit 6483e1c0cd61c36bd326621ba653413ae25503b3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:22:31 2015 +0200

    clang-analyzer-deadcode.DeadStores
    
    Change-Id: I103580d25ebc3287fac4c8c846731192e4320dc9

diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index 542198a..d9b7a43 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -87,8 +87,6 @@ namespace drawinglayer
             Primitive2DSequence aRetval;
             css::uno::Reference<SdrBlockTextPrimitive2D> xBlockText;
             basegfx::B2DRange aTextRange;
-            double fTextX((getStart().getX() + getEnd().getX()) * 0.5);
-            double fTextY((getStart().getX() + getEnd().getX()) * 0.5);
             const basegfx::B2DVector aLine(getEnd() - getStart());
             const double fDistance(aLine.getLength());
             const double fAngle(atan2(aLine.getY(), aLine.getX()));
@@ -140,6 +138,8 @@ namespace drawinglayer
             }
 
             // prepare line attribute and result
+            double fTextX;
+            double fTextY;
             {
                 const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine());
                 bool bArrowsOutside(false);
commit 152e24885d625c336e4530c2a5aede2b712fe213
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Oct 7 17:16:13 2015 +0200

    Work around overly optimistic clang-analyzer-deadcode.DeadStores
    
    ...which assumes that the switch is exhaustive over all possible
    SvxSearchCellType values, which in fact it is not (see the mail thread starting
    at <http://lists.llvm.org/pipermail/cfe-dev/2015-September/045021.html>
    "[cfe-dev] Unsound assumptions about exhaustiveness of enum switch cases?").
    Make it clear via "default: std::abort();" that the switch /is/ known to be
    exhaustive over the possible values of pSearchItem->GetCellType().
    
    Change-Id: Id06abc19c0092a334c363ee739a0eda1dc8cf760

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 85028fc..4688a8b 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -68,6 +68,8 @@
 #include <tools/resary.hxx>
 #include <svx/svxdlg.hxx>
 #include <vcl/toolbox.hxx>
+
+#include <cstdlib>
 #include <memory>
 
 using namespace com::sun::star::i18n;
@@ -812,7 +814,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
         m_pColumnsBtn->SetClickHdl( aLink );
         m_pAllSheetsCB->SetClickHdl( aLink );
 
-        sal_uIntPtr nModifyFlagCheck(nModifyFlag);
+        sal_uIntPtr nModifyFlagCheck;
         switch ( pSearchItem->GetCellType() )
         {
             case SvxSearchCellType::FORMULA:
@@ -826,6 +828,9 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
             case SvxSearchCellType::NOTE:
                 nModifyFlagCheck = MODIFY_CALC_NOTES;
                 break;
+
+            default:
+                std::abort(); // cannot happen
         }
         if ( (nModifyFlag & nModifyFlagCheck) == 0 )
             m_pCalcSearchInLB->SelectEntryPos( static_cast<sal_Int32>(pSearchItem->GetCellType()) );


More information about the Libreoffice-commits mailing list