diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-22 09:33:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-23 06:59:31 +0100 |
commit | 7a1c21e53fc4733a4bb52282ce0098fcc085ab0e (patch) | |
tree | c1b90f74e1ce9e9f3a852f398890899459189cab /sc | |
parent | c24c32bf71b8e64bd0d36e511f554e1f6c015842 (diff) |
loplugin:simplifybool for negation of comparison operator
Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791
Reviewed-on: https://gerrit.libreoffice.org/45068
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/document.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/opencl/op_database.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/charthelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/orcus/filterdetect.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLStylesExportHelper.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 12 |
9 files changed, 18 insertions, 18 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 828e9cd0871d..60795d5bebf4 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4803,7 +4803,7 @@ void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange, void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex ) { - if(!(static_cast<size_t>(nTab) < maTabs.size())) + if(static_cast<size_t>(nTab) >= maTabs.size()) return; if(!maTabs[nTab]) @@ -4814,7 +4814,7 @@ void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_u void ScDocument::RemoveCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex ) { - if(!(static_cast<size_t>(nTab) < maTabs.size())) + if(static_cast<size_t>(nTab) >= maTabs.size()) return; if(!maTabs[nTab]) diff --git a/sc/source/core/opencl/op_database.cxx b/sc/source/core/opencl/op_database.cxx index a86a49198a0c..b51712382639 100644 --- a/sc/source/core/opencl/op_database.cxx +++ b/sc/source/core/opencl/op_database.cxx @@ -1533,8 +1533,8 @@ void OpDcount2::GenSlidingWindowFunction(std::stringstream &ss, GenTmpVariables(ss,vSubArguments); int dataCol = 0; int dataRow = 0; - if(!(vSubArguments[0]->GetFormulaToken()->GetType() == - formula::svDoubleVectorRef)) + if(vSubArguments[0]->GetFormulaToken()->GetType() != + formula::svDoubleVectorRef) throw Unhandled(__FILE__, __LINE__); formula::FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index a122be12f155..12e05fa415e9 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -258,7 +258,7 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument xLabeledSequence->setLabel( xNewSeq ); } - if( !(nRange<rRanges.getLength()) ) + if( nRange >= rRanges.getLength() ) break; if( xValues.is()) diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index c64396b5bb7d..36205c5867e9 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -2300,7 +2300,7 @@ void XclImpOptionButtonObj::DoProcessControl( ScfPropertySet& rPropSet ) const } else pTbxObj = nullptr; - } while ( pTbxObj && !( pTbxObj->mnFirstInGroup == 1 ) ); + } while ( pTbxObj && ( pTbxObj->mnFirstInGroup != 1 ) ); } else { diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 5cbbf7a299bc..3ecdcc8de976 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1069,7 +1069,7 @@ void ScHTMLLayoutParser::TableOn( HtmlImportInfo* pInfo ) } } bInCell = false; - if ( bTabInTabCell && !(nTableWidth < nLastWidth) ) + if ( bTabInTabCell && (nTableWidth >= nLastWidth) ) { // Multiple tables in one cell, underneath each other bTabInTabCell = false; NextRow( pInfo ); diff --git a/sc/source/filter/orcus/filterdetect.cxx b/sc/source/filter/orcus/filterdetect.cxx index d32c84380afe..861c351f0611 100644 --- a/sc/source/filter/orcus/filterdetect.cxx +++ b/sc/source/filter/orcus/filterdetect.cxx @@ -75,7 +75,7 @@ OUString OrcusFormatDetect::detect(css::uno::Sequence<css::beans::PropertyValue> while(!bEnd) { sal_Int32 nReadBytes = xInputStream->readBytes(aSeq, nBytes); - bEnd = !(nReadBytes == nBytes); + bEnd = (nReadBytes != nBytes); aContent.append(reinterpret_cast<const char*>(aSeq.getConstArray()), nReadBytes); } diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 3b1e749c6318..dd6b115d4df4 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -815,7 +815,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const { OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table"); - if (!(static_cast<size_t>(nTable) < aTables.size())) + if (static_cast<size_t>(nTable) >= aTables.size()) return -1; ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]); ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin()); @@ -840,7 +840,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow) { OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table"); - if (!(static_cast<size_t>(nTable) < aTables.size())) + if (static_cast<size_t>(nTable) >= aTables.size()) return -1; ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]); ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin()); @@ -1107,7 +1107,7 @@ void ScRowStyles::AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields) sal_Int32 ScRowStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField) { OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table"); - if (!(static_cast<size_t>(nTable) < aTables.size())) + if (static_cast<size_t>(nTable) >= aTables.size()) return -1; if (maCache.hasCache(nTable, nField)) diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index adc713bfbbd0..2fde14330441 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2436,7 +2436,7 @@ void BoundsProvider<IndexType>::Compute( SAL_INFO("sc.lok.header", "BoundsProvider: rBottomNearest: index: " << aSecondNearest.first << ", pos: " << aSecondNearest.second << ", diff: " << nSecondDiff); - bool bReverse = !(std::abs(nFirstDiff) < std::abs(nSecondDiff)); + bool bReverse = (std::abs(nFirstDiff) >= std::abs(nSecondDiff)); if(bReverse) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 78611447b1d2..7bd2074b7342 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1120,7 +1120,7 @@ void ScViewData::ResetOldCursor() SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const { - if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size()))) + if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return -1; return maTabData[nTabIndex]->nCurX; @@ -1128,7 +1128,7 @@ SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const { - if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size()))) + if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return -1; return maTabData[nTabIndex]->nCurY; @@ -1136,7 +1136,7 @@ SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex ) { - if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size()))) + if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return; maTabData[nTabIndex]->nCurX = nNewCurX; @@ -1144,7 +1144,7 @@ void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex ) void ScViewData::SetCurYForTab( SCCOL nNewCurY, SCTAB nTabIndex ) { - if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size()))) + if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) return; maTabData[nTabIndex]->nCurY = nNewCurY; @@ -1853,7 +1853,7 @@ void ScViewData::SetTabNo( SCTAB nNewTab ) ScPositionHelper* ScViewData::GetLOKWidthHelper(SCTAB nTabIndex) { - if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size()))) + if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) { return nullptr; } @@ -1862,7 +1862,7 @@ ScPositionHelper* ScViewData::GetLOKWidthHelper(SCTAB nTabIndex) ScPositionHelper* ScViewData::GetLOKHeightHelper(SCTAB nTabIndex) { - if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size()))) + if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size()))) { return nullptr; } |