[Libreoffice-commits] core.git: chart2/source compilerplugins/clang connectivity/source editeng/inc editeng/source filter/source framework/source sal/osl sax/source scaddins/source sd/source svtools/source svx/source sw/source toolkit/source ucb/source vcl/source

Stephan Bergmann sbergman at redhat.com
Thu Nov 30 18:30:00 UTC 2017


 chart2/source/controller/main/ChartController_Properties.cxx |    2 -
 compilerplugins/clang/test/unnecessaryparen.cxx              |    9 +++++++
 compilerplugins/clang/unnecessaryparen.cxx                   |   13 +++++++++++
 connectivity/source/drivers/hsqldb/HStorageAccess.cxx        |    2 -
 editeng/inc/editdoc.hxx                                      |    2 -
 editeng/source/editeng/impedit2.cxx                          |    4 +--
 editeng/source/editeng/impedit3.cxx                          |    8 +++---
 editeng/source/outliner/outlvw.cxx                           |    4 +--
 filter/source/xsltfilter/LibXSLTTransformer.cxx              |    2 -
 framework/source/loadenv/loadenv.cxx                         |    4 +--
 sal/osl/unx/file.cxx                                         |    2 -
 sax/source/tools/converter.cxx                               |    6 ++---
 scaddins/source/analysis/bessel.cxx                          |    4 +--
 sd/source/ui/view/drtxtob1.cxx                               |    2 -
 svtools/source/contnr/svimpbox.cxx                           |    2 -
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx           |    2 -
 svx/source/sidebar/paragraph/ParaSpacingWindow.cxx           |    2 -
 sw/source/core/frmedt/fetab.cxx                              |    2 -
 sw/source/core/frmedt/tblsel.cxx                             |    4 +--
 sw/source/filter/ww8/ww8par2.cxx                             |    2 -
 sw/source/uibase/shells/drwtxtex.cxx                         |    2 -
 sw/source/uibase/uiview/viewtab.cxx                          |    2 -
 toolkit/source/awt/vclxtoolkit.cxx                           |    2 -
 toolkit/source/helper/unopropertyarrayhelper.cxx             |    2 -
 ucb/source/ucp/ftp/ftpdirp.hxx                               |    2 -
 vcl/source/edit/texteng.cxx                                  |    2 -
 26 files changed, 56 insertions(+), 34 deletions(-)

New commits:
commit b15f79a8f8de27c9d186ae1fbd0c86f194aed0ac
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Nov 30 07:17:53 2017 +0100

    loplugin:unnecessaryparen: signed numeric literals
    
    Change-Id: I75c8224452ca9c3711a2ccaca9ecf549fa59cb64
    Reviewed-on: https://gerrit.libreoffice.org/45549
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index e61194bce8da..46f5579542ad 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -423,7 +423,7 @@ OUString lcl_getGridCIDForCommand( const OString& rDispatchCommand, const uno::R
 
     uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, true/*bMainAxis*/, xDiagram ) );
 
-    sal_Int32   nSubGridIndex= bMainGrid ? (-1) : 0;
+    sal_Int32   nSubGridIndex= bMainGrid ? -1 : 0;
     OUString aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGridIndex ) );
     return aCID;
 }
diff --git a/compilerplugins/clang/test/unnecessaryparen.cxx b/compilerplugins/clang/test/unnecessaryparen.cxx
index 78e2096abf9e..b7117a126edb 100644
--- a/compilerplugins/clang/test/unnecessaryparen.cxx
+++ b/compilerplugins/clang/test/unnecessaryparen.cxx
@@ -82,6 +82,15 @@ int main()
     // Expecting just one error, not reported twice during TraverseInitListExpr:
     int a[] = {(x)}; // expected-error {{unnecessary parentheses around identifier [loplugin:unnecessaryparen]}}
     (void) a;
+
+    (void) (+1); // expected-error {{unnecessary parentheses around signed numeric literal [loplugin:unnecessaryparen]}}
+    (void) (-1); // expected-error {{unnecessary parentheses around signed numeric literal [loplugin:unnecessaryparen]}}
+
+    // For simplicity's sake, even warn about pathological cases that would require adding
+    // whitespace when removing the parentheses (as is also necessary in other cases anyway, like
+    // "throw(x);"); it is unlikely that there are any actual occurrences of code like "-(-1)" that
+    // would benefit from the parentheses readability-wise, compared to "- -1":
+    (void) -(-1); // expected-error {{unnecessary parentheses around signed numeric literal [loplugin:unnecessaryparen]}}
 };
 
 struct S2 {
diff --git a/compilerplugins/clang/unnecessaryparen.cxx b/compilerplugins/clang/unnecessaryparen.cxx
index 692e23706cc9..db241024dba4 100644
--- a/compilerplugins/clang/unnecessaryparen.cxx
+++ b/compilerplugins/clang/unnecessaryparen.cxx
@@ -180,6 +180,19 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr)
                 << parenExpr->getSourceRange();
             handled_.insert(parenExpr);
         }
+    } else if (auto const e = dyn_cast<UnaryOperator>(subExpr)) {
+        auto const op = e->getOpcode();
+        if (op == UO_Plus || op == UO_Minus) {
+            auto const e2 = e->getSubExpr();
+            if (isa<IntegerLiteral>(e2) || isa<FloatingLiteral>(e2) || isa<ImaginaryLiteral>(e2)) {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "unnecessary parentheses around signed numeric literal",
+                    parenExpr->getLocStart())
+                    << parenExpr->getSourceRange();
+                handled_.insert(parenExpr);
+            }
+        }
     } else if (isa<CXXNamedCastExpr>(subExpr)) {
         report(
             DiagnosticsEngine::Warning, "unnecessary parentheses around cast",
diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
index ac705e7df694..845da8abb825 100644
--- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx
@@ -164,7 +164,7 @@ jint read_from_storage_stream( JNIEnv * env, jstring name, jstring key )
         }
         if (nBytesRead <= 0)
         {
-            return (-1);
+            return -1;
         }
         else
         {
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index a46330c9badf..59ebecc11a32 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -430,7 +430,7 @@ public:
     sal_Unicode    GetExtraValue() const       { return nExtraValue; }
     void           SetExtraValue( sal_Unicode n )  { nExtraValue = n; }
 
-    bool           HasValidSize() const        { return aOutSz.Width() != (-1); }
+    bool           HasValidSize() const        { return aOutSz.Width() != -1; }
 
     ExtraPortionInfo*   GetExtraInfos() const { return xExtraInfos.get(); }
     void                SetExtraInfos( ExtraPortionInfo* p ) { xExtraInfos.reset(p); }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 0b24721a93c7..acd94199875e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1454,7 +1454,7 @@ EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM )
         if ( aBoundary.startPos >= nCurrentPos )
             aBoundary = _xBI->previousWord(
                 aNewPaM.GetNode()->GetString(), nCurrentPos, aLocale, css::i18n::WordType::ANYWORD_IGNOREWHITESPACES);
-        aNewPaM.SetIndex( ( aBoundary.startPos != (-1) ) ? aBoundary.startPos : 0 );
+        aNewPaM.SetIndex( ( aBoundary.startPos != -1 ) ? aBoundary.startPos : 0 );
     }
 
     return aNewPaM;
@@ -1674,7 +1674,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
         short nScriptType = _xBI->getScriptType( aText, nPos );
         rTypes.emplace_back( nScriptType, nPos, nTextLen );
         nPos = _xBI->endOfScript( aText, nPos, nScriptType );
-        while ( ( nPos != (-1) ) && ( nPos < nTextLen ) )
+        while ( ( nPos != -1 ) && ( nPos < nTextLen ) )
         {
             rTypes.back().nEndPos = nPos;
 
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 6953b98df9fa..ee2dac949f40 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -934,7 +934,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                     nTmpWidth -= rPrev.GetSize().Width();
                     nTmpPos = nTmpPos - rPrev.GetLen();
                     rPrev.SetLen(rPrev.GetLen() + nTmpLen);
-                    rPrev.GetSize().Width() = (-1);
+                    rPrev.GetSize().Width() = -1;
                 }
 
                 DBG_ASSERT( nTmpPortion < pParaPortion->GetTextPortions().Count(), "No more Portions left!" );
@@ -2384,7 +2384,7 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_Int32 nPos
         }
     }
     else
-        pTextPortion->GetSize().Width() = (-1);
+        pTextPortion->GetSize().Width() = -1;
 
     return nSplitPortion;
 }
@@ -2523,7 +2523,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta
                 FindPortion( nStartPos, nPortionStart );
             TextPortion& rTP = pParaPortion->GetTextPortions()[ nTP ];
             rTP.SetLen( rTP.GetLen() + nNewChars );
-            rTP.GetSize().Width() = (-1);
+            rTP.GetSize().Width() = -1;
         }
     }
     else
@@ -2589,7 +2589,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta
                     TextPortion& rPrev = pParaPortion->GetTextPortions()[nLastPortion - 1];
                     DBG_ASSERT( rPrev.GetKind() == PortionKind::TEXT, "Portion?!" );
                     rPrev.SetLen( rPrev.GetLen() + pTP->GetLen() );
-                    rPrev.GetSize().Width() = (-1);
+                    rPrev.GetSize().Width() = -1;
                 }
                 pParaPortion->GetTextPortions().Remove( nLastPortion );
             }
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 4e24d2023c70..22299ee40f42 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -152,13 +152,13 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra
                          ( pOwner->ImplGetOutlinerMode() != OutlinerMode::TitleObject ) &&
                          ( bSelection || !aSel.nStartPos ) )
                     {
-                        Indent( aKeyCode.IsShift() ? (-1) : (+1) );
+                        Indent( aKeyCode.IsShift() ? -1 : +1 );
                         bKeyProcessed = true;
                     }
                     else if ( ( pOwner->ImplGetOutlinerMode() == OutlinerMode::TextObject ) &&
                               !bSelection && !aSel.nEndPos && pOwner->ImplHasNumberFormat( aSel.nEndPara ) )
                     {
-                        Indent( aKeyCode.IsShift() ? (-1) : (+1) );
+                        Indent( aKeyCode.IsShift() ? -1 : +1 );
                         bKeyProcessed = true;
                     }
                 }
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 339c1a62faab..7accfcb0a384 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -217,7 +217,7 @@ namespace XSLT
     {
         //        const char *ptr = (const char *) context;
         if (buffer == nullptr || len < 0)
-            return (-1);
+            return -1;
         sal_Int32 n;
         css::uno::Reference<XInputStream> xis = m_transformer->getInputStream();
         n = xis.get()->readBytes(m_readBuf, len);
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 6ad9498f776f..e0e8ab53610d 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1249,7 +1249,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
     // Note: To detect if a document was already loaded before
     // we check URLs here only. But might the existing and the required
     // document has different versions! Then its URLs are the same ...
-    sal_Int16 nNewVersion = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_VERSION(), (sal_Int16)(-1));
+    sal_Int16 nNewVersion = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_VERSION(), (sal_Int16)-1);
 
     // will be used to save the first hidden frame referring the searched model
     // Normally we are interested on visible frames ... but if there is no such visible
@@ -1298,7 +1298,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
             // or must not have any file revision set (-1 == -1!)
             utl::MediaDescriptor lOldDocDescriptor(xModel->getArgs());
 
-            if (lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_VERSION(), (sal_Int32)(-1)) != nNewVersion)
+            if (lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_VERSION(), (sal_Int32)-1) != nNewVersion)
             {
                 xTask.clear ();
                 continue;
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index c7d6522ff3d0..68d384414af3 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -310,7 +310,7 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize)
 
         /* Save current position */
         off_t const nCurPos = lseek(m_fd, (off_t)0, SEEK_CUR);
-        if (nCurPos == (off_t)(-1))
+        if (nCurPos == (off_t)-1)
             return result;
 
         /* Try 'expand' via 'lseek()' and 'write()' */
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index ad5cb8c19113..b78e4e1413f2 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1778,12 +1778,12 @@ static bool lcl_parseDateTime(
 
     if (bSuccess)
     {
-        sal_Int16 const nTimezoneOffset = (bHaveTimezoneMinus ? (-1) : (+1))
+        sal_Int16 const nTimezoneOffset = (bHaveTimezoneMinus ? -1 : +1)
                         * ((nTimezoneHours * 60) + nTimezoneMinutes);
         if (!pDate || bHaveTime) // time is optional
         {
             rDateTime.Year =
-                (isNegative ? (-1) : (+1)) * static_cast<sal_Int16>(nYear);
+                (isNegative ? -1 : +1) * static_cast<sal_Int16>(nYear);
             rDateTime.Month = static_cast<sal_uInt16>(nMonth);
             rDateTime.Day = static_cast<sal_uInt16>(nDay);
             rDateTime.Hours = static_cast<sal_uInt16>(nHours);
@@ -1818,7 +1818,7 @@ static bool lcl_parseDateTime(
         else
         {
             pDate->Year =
-                (isNegative ? (-1) : (+1)) * static_cast<sal_Int16>(nYear);
+                (isNegative ? -1 : +1) * static_cast<sal_Int16>(nYear);
             pDate->Month = static_cast<sal_uInt16>(nMonth);
             pDate->Day = static_cast<sal_uInt16>(nDay);
             if (bHaveTimezone)
diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx
index bc0c1d8a6b0b..ee41ce07b8a3 100644
--- a/scaddins/source/analysis/bessel.cxx
+++ b/scaddins/source/analysis/bessel.cxx
@@ -261,7 +261,7 @@ double Besselk1( double fNum )
 
         fRet = log( fNum2 ) * BesselI( fNum, 1 ) +
                 ( 1.0 + y * ( 0.15443144 + y * ( -0.67278579 + y * ( -0.18156897 + y * ( -0.1919402e-1 +
-                    y * ( -0.110404e-2 + y * ( -0.4686e-4 ) ) ) ) ) ) )
+                    y * ( -0.110404e-2 + y * -0.4686e-4 ) ) ) ) ) )
                 / fNum;
     }
     else
@@ -270,7 +270,7 @@ double Besselk1( double fNum )
 
         fRet = exp( -fNum ) / sqrt( fNum ) * ( 1.25331414 + y * ( 0.23498619 +
                 y * ( -0.3655620e-1 + y * ( 0.1504268e-1 + y * ( -0.780353e-2 +
-                y * ( 0.325614e-2 + y * ( -0.68245e-3 ) ) ) ) ) ) );
+                y * ( 0.325614e-2 + y * -0.68245e-3 ) ) ) ) ) );
     }
 
     return fRet;
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 40af5696ff75..16d465cf75f9 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -285,7 +285,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
             SvxLRSpaceItem aNewMargin( EE_PARA_LRSPACE );
             aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOfst() );
             aNewMargin.SetRight( aParaMargin.GetRight() );
-            aNewMargin.SetTextFirstLineOfst( ( aParaMargin.GetTextFirstLineOfst() ) * (-1) );
+            aNewMargin.SetTextFirstLineOfst( ( aParaMargin.GetTextFirstLineOfst() ) * -1 );
             aLRSpaceSet.Put( aNewMargin );
             mpView->SetAttributes( aLRSpaceSet );
 
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 6153f987efd3..acf2e84e216f 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -338,7 +338,7 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void )
     }
     else
     {
-        nDelta *= (-1);
+        nDelta *= -1;
         if( nDelta == 1 )
             CursorUp();
         else
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 4b7fbf56c016..3fceef172b1e 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -276,7 +276,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo
              && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Default)
              && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Table))
         {
-            mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
+            mpFLineIndent->SetMin( nVal*-1, FUNIT_100TH_MM );
         }
 
         long nrVal = OutputDevice::LogicToLogic( aTxtRight, MapUnit::MapTwip, MapUnit::Map100thMM );
diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
index f854752163a5..4d3f2b147d17 100644
--- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
+++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx
@@ -217,7 +217,7 @@ void ParaLRSpacingWindow::SetValue(SfxItemState eState, const SfxPoolItem* pStat
              && m_aContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Default)
              && m_aContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Table))
         {
-            m_pFLSpacing->SetMin(aTxtLeft*(-1), FUNIT_100TH_MM);
+            m_pFLSpacing->SetMin(aTxtLeft*-1, FUNIT_100TH_MM);
         }
 
         aTxtRight = (long)m_pAfterSpacing->Normalize(aTxtRight);
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 1546fb1fd0e8..8dbb24fc91ee 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1474,7 +1474,7 @@ static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point
                     SwTwips& rPointX = aRectFnSet.IsVert() ? aPt.Y() : aPt.X();
                     SwTwips& rPointY = aRectFnSet.IsVert() ? aPt.X() : aPt.Y();
 
-                    const SwTwips nXDiff = aRectFnSet.XDiff( nLeft, rPointX ) * ( bRTL ? (-1) : 1 );
+                    const SwTwips nXDiff = aRectFnSet.XDiff( nLeft, rPointX ) * ( bRTL ? -1 : 1 );
                     const SwTwips nYDiff = aRectFnSet.YDiff( nTop, rPointY );
 
                     bCloseToRow = nXDiff >= 0 && nXDiff < nFuzzy;
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index b72a02ce5ab9..8c61f32042d4 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -606,7 +606,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
                                     aRectFnSet.GetLeft(rCF.pFrame->getFrameArea()) ) &&
                          nHeight == aRectFnSet.GetHeight(rCF.pFrame->getFrameArea()) )
                 {
-                    nXPos += ( bRTL ? (-1) : 1 ) *
+                    nXPos += ( bRTL ? -1 : 1 ) *
                              aRectFnSet.GetWidth(rCF.pFrame->getFrameArea());
                     ++nCellCnt;
                 }
@@ -1509,7 +1509,7 @@ static SwTwips lcl_CalcWish( const SwLayoutFrame *pCell, long nWish,
             pTmp = static_cast<const SwLayoutFrame*>(pTmp->GetPrev());
             sal_Int64 nTmp = pTmp->GetFormat()->GetFrameSize().GetWidth();
             // multiply in 64-bit to avoid overflow here!
-            nRet += ( bRTL ? ( -1 ) : 1 ) * nTmp * nAct / nWish;
+            nRet += ( bRTL ? -1 : 1 ) * nTmp * nAct / nWish;
         }
         pTmp = pTmp->GetUpper()->GetUpper();
         if ( pTmp && !pTmp->IsCellFrame() )
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index a517dffe03ea..0e70d550f67f 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2865,7 +2865,7 @@ void WW8TabDesc::FinishSwTable()
                     {
                         const long nRowSpanSet = (n == 0) && (i == 0) ?
                             nRowSpan :
-                            ((-1) * (nRowSpan - n));
+                            (-1 * (nRowSpan - n));
                         SwTableBox* pCurrentBox = rRow[i];
                         pCurrentBox->setRowSpan(nRowSpanSet);
 
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 09bced48737c..6275fc7f9421 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -229,7 +229,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
                     short int nFirstLineOffset = aParaMargin.GetTextFirstLineOfst();
                     aParaMargin.SetTextLeft( aParaMargin.GetTextLeft() + nFirstLineOffset );
                     aParaMargin.SetRight( aParaMargin.GetRight() );
-                    aParaMargin.SetTextFirstLineOfst( nFirstLineOffset * (-1) );
+                    aParaMargin.SetTextFirstLineOfst( nFirstLineOffset * -1 );
                     aNewAttr.Put(aParaMargin);
                     rReq.Done();
                 }
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 773c3aeef388..dd2ac2be7bd5 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -662,7 +662,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
         SvxLRSpaceItem aNewMargin( RES_LR_SPACE );
         aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOfst() );
         aNewMargin.SetRight( aParaMargin.GetRight() );
-        aNewMargin.SetTextFirstLineOfst( (aParaMargin.GetTextFirstLineOfst()) * (-1) );
+        aNewMargin.SetTextFirstLineOfst( (aParaMargin.GetTextFirstLineOfst()) * -1 );
 
         rSh.SetAttrItem( aNewMargin );
         break;
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index f5a68b8a2645..e2df8b70f695 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1327,7 +1327,7 @@ css::uno::Sequence< css::uno::Reference< css::awt::XWindowPeer > > VCLXToolkit::
     {
         css::awt::WindowDescriptor aDescr = rDescriptors.getConstArray()[n];
 
-        if ( aDescr.ParentIndex == (-1) )
+        if ( aDescr.ParentIndex == -1 )
             aDescr.Parent = nullptr;
         else if ( ( aDescr.ParentIndex >= 0 ) && ( aDescr.ParentIndex < (short)n ) )
             aDescr.Parent = aSeq.getConstArray()[aDescr.ParentIndex];
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
index 40cea05ca486..fce8ee8ac834 100644
--- a/toolkit/source/helper/unopropertyarrayhelper.cxx
+++ b/toolkit/source/helper/unopropertyarrayhelper.cxx
@@ -122,7 +122,7 @@ sal_Bool UnoPropertyArrayHelper::hasPropertyByName(const OUString& rPropertyName
 sal_Int32 UnoPropertyArrayHelper::getHandleByName( const OUString & rPropertyName )
 {
     sal_Int32 nId = (sal_Int32 ) GetPropertyId( rPropertyName );
-    return nId ? nId : (-1);
+    return nId ? nId : -1;
 }
 
 sal_Int32 UnoPropertyArrayHelper::fillHandles( sal_Int32* pHandles, const css::uno::Sequence< OUString > & rPropNames )
diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx
index 238b761455b6..31e617bc3567 100644
--- a/ucb/source/ucp/ftp/ftpdirp.hxx
+++ b/ucb/source/ucp/ftp/ftpdirp.hxx
@@ -80,7 +80,7 @@ namespace ftp {
         FTPDirentry()
             : m_aDate(),
               m_nMode(INETCOREFTP_FILEMODE_UNKNOWN),
-              m_nSize((sal_uInt32)(-1)) { }
+              m_nSize((sal_uInt32)-1) { }
 
         void clear() {
             m_aURL.clear();
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index e369e8299f9c..5d470d164b97 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1849,7 +1849,7 @@ void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_I
             TETextPortion* const pTP = pTEParaPortion->GetTextPortions()[ nTP ];
             SAL_WARN_IF( !pTP, "vcl", "RecalcTextPortion: Portion not found!"  );
             pTP->GetLen() += nNewChars;
-            pTP->GetWidth() = (-1);
+            pTP->GetWidth() = -1;
         }
     }
     else


More information about the Libreoffice-commits mailing list