diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-19 08:12:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-19 10:02:39 +0200 |
commit | 2c1b7e8d6a7fa22cb91919238418816671c3a497 (patch) | |
tree | 6f356017d24dffcd25261295ab25a21b738dc835 /sc | |
parent | ad18bb24d51e4f735085d50c496d28bd637dbb0b (diff) |
clang-tidy readability-container-size-empty
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422
Reviewed-on: https://gerrit.libreoffice.org/61967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptabres.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/markdata.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/opencl/op_statistical.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/excimp8.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xepivotxml.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xistyle.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/oox/formulaparser.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLExportIterator.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/conflictsdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/datafdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaaxes.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 2 |
21 files changed, 33 insertions, 33 deletions
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 3449e6bf2eab..5d7a7a4aebfb 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -858,7 +858,7 @@ void ScDPOutput::CalcSizes() // calculate output positions and sizes long nPageSize = 0; // use page fields! - if ( bDoFilter || pPageFields.size() ) + if ( bDoFilter || !pPageFields.empty() ) { nPageSize += pPageFields.size() + 1; // plus one empty row if ( bDoFilter ) diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 4ad5530a21b9..d6b8a49f0c60 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -3501,7 +3501,7 @@ ScDPResultMember* ScDPResultDimension::GetMember(long n) ScDPResultDimension* ScDPResultDimension::GetFirstChildDimension() const { - if ( maMemberArray.size() > 0 ) + if ( !maMemberArray.empty() ) return maMemberArray[0]->GetChildDimension(); else return nullptr; diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx index 0fe000d9a50c..10e7fdc48d34 100644 --- a/sc/source/core/data/markdata.cxx +++ b/sc/source/core/data/markdata.cxx @@ -198,7 +198,7 @@ SCTAB ScMarkData::GetSelectCount() const SCTAB ScMarkData::GetFirstSelected() const { - if (maTabMarked.size() > 0) + if (!maTabMarked.empty()) return (*maTabMarked.begin()); OSL_FAIL("GetFirstSelected: nothing selected"); @@ -207,7 +207,7 @@ SCTAB ScMarkData::GetFirstSelected() const SCTAB ScMarkData::GetLastSelected() const { - if (maTabMarked.size() > 0) + if (!maTabMarked.empty()) return (*maTabMarked.rbegin()); OSL_FAIL("GetLastSelected: nothing selected"); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index f65787120aaf..55751228d691 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2138,7 +2138,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) } } - if (aRowVector.size() > 0) + if (!aRowVector.empty()) { // generate global total SCROW nGlobalStartRow = aRowVector[0].nSubStartRow; diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 79d27e5ef5e7..62f35865c7c7 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -223,7 +223,7 @@ void OpZTest::GenSlidingWindowFunction(std::stringstream &ss, ss << " double arg = 0.0;\n"; ss << " double sigma = 0.0;\n"; ss << " double mu = 0.0;\n"; - if(vSubArguments.size() == 1 || vSubArguments.size() == 0) + if(vSubArguments.size() == 1 || vSubArguments.empty()) { ss << " return DBL_MAX;\n"; ss << "}\n"; diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index b09e5f7f3977..89250fa68ed2 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -438,7 +438,7 @@ void ImportExcel8::PostDocLoad() ImportExcel::PostDocLoad(); // check scenarios; Attention: This increases the table count of the document!! - if( !pD->IsClipboard() && maScenList.aEntries.size() ) + if( !pD->IsClipboard() && !maScenList.aEntries.empty() ) { pD->UpdateChartListenerCollection(); // references in charts must be updated diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 431074fbce50..bb2dc847d75f 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -303,7 +303,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr // 1 - (Default) at least one text value, or can also contain a mix of other data types and blank values, // or blank values only // 0 - the field does not have a mix of text and other values - if (!(isContainsString || (aDPTypes.size() > 1) || (isContainsBlank && aDPTypesWithoutBlank.size() == 0))) + if (!(isContainsString || (aDPTypes.size() > 1) || (isContainsBlank && aDPTypesWithoutBlank.empty()))) pAttList->add(XML_containsSemiMixedTypes, ToPsz10(false)); if (!isContainsNonDate) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 14fa8478d0f5..174ed4bf298b 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -106,7 +106,7 @@ public: } virtual sal_Bool SAL_CALL hasElements() override { - return (maColor.size() > 0); + return (!maColor.empty()); } private: diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 7eda5c9dae14..9ea3af92cb3b 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1355,7 +1355,7 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo ) pImage->aSize = pDefaultDev->LogicToPixel( pGraphic->GetPrefSize(), pGraphic->GetPrefMapMode() ); } - if (mxActEntry->maImageList.size() > 0) + if (!mxActEntry->maImageList.empty()) { long nWidth = 0; for (std::unique_ptr<ScHTMLImage> & pI : mxActEntry->maImageList) @@ -1564,7 +1564,7 @@ void ScHTMLLayoutParser::ProcToken( HtmlImportInfo* pInfo ) break; case HtmlTokenId::PARABREAK_OFF: { // We continue vertically after an image - if (mxActEntry->maImageList.size() > 0) + if (!mxActEntry->maImageList.empty()) mxActEntry->maImageList.back()->nDir = nVertical; } break; diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index babfb61395b8..91bddc80ec76 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -394,15 +394,15 @@ FormulaBuffer::SheetItem FormulaBuffer::getSheetItem( SCTAB nTab ) return aItem; } - if( maCellFormulas[ nTab ].size() > 0 ) + if( !maCellFormulas[ nTab ].empty() ) aItem.mpCellFormulas = &maCellFormulas[ nTab ]; - if( maCellArrayFormulas[ nTab ].size() > 0 ) + if( !maCellArrayFormulas[ nTab ].empty() ) aItem.mpArrayFormulas = &maCellArrayFormulas[ nTab ]; - if( maCellFormulaValues[ nTab ].size() > 0 ) + if( !maCellFormulaValues[ nTab ].empty() ) aItem.mpCellFormulaValues = &maCellFormulaValues[ nTab ]; - if( maSharedFormulas[ nTab ].size() > 0 ) + if( !maSharedFormulas[ nTab ].empty() ) aItem.mpSharedFormulaEntries = &maSharedFormulas[ nTab ]; - if( maSharedFormulaIds[ nTab ].size() > 0 ) + if( !maSharedFormulaIds[ nTab ].empty() ) aItem.mpSharedFormulaIDs = &maSharedFormulaIds[ nTab ]; return aItem; diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index 888f0465a53d..765881c3ec7b 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -696,7 +696,7 @@ size_t FormulaParserImpl::insertWhiteSpaceTokens( const WhiteSpaceVec* pSpaces, size_t FormulaParserImpl::getOperandSize( size_t nOpIndex ) const { - OSL_ENSURE( (nOpIndex < 1) && (1 <= maOperandSizeStack.size()), + OSL_ENSURE( (nOpIndex < 1) && (!maOperandSizeStack.empty()), "FormulaParserImpl::getOperandSize - invalid parameters" ); return maOperandSizeStack[ maOperandSizeStack.size() - 1 + nOpIndex ]; } @@ -753,7 +753,7 @@ bool FormulaParserImpl::pushParenthesesOperandToken( const WhiteSpaceVec* pClosi bool FormulaParserImpl::pushUnaryPreOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces ) { - bool bOk = maOperandSizeStack.size() >= 1; + bool bOk = !maOperandSizeStack.empty(); if( bOk ) { size_t nOpSize = popOperandSize(); @@ -766,7 +766,7 @@ bool FormulaParserImpl::pushUnaryPreOperatorToken( sal_Int32 nOpCode, const Whit bool FormulaParserImpl::pushUnaryPostOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces ) { - bool bOk = maOperandSizeStack.size() >= 1; + bool bOk = !maOperandSizeStack.empty(); if( bOk ) { size_t nOpSize = popOperandSize(); @@ -793,7 +793,7 @@ bool FormulaParserImpl::pushBinaryOperatorToken( sal_Int32 nOpCode, const WhiteS bool FormulaParserImpl::pushParenthesesOperatorToken( const WhiteSpaceVec* pOpeningSpaces, const WhiteSpaceVec* pClosingSpaces ) { - bool bOk = maOperandSizeStack.size() >= 1; + bool bOk = !maOperandSizeStack.empty(); if( bOk ) { size_t nOpSize = popOperandSize(); diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx index 58f1b693a804..71940997d613 100644 --- a/sc/source/filter/xml/XMLExportIterator.cxx +++ b/sc/source/filter/xml/XMLExportIterator.cxx @@ -444,7 +444,7 @@ void ScMyDetectiveObjContainer::SetCellData( ScMyCell& rMyCell ) rMyCell.aDetectiveObjVec.push_back( *aItr ); aItr = aDetectiveObjList.erase( aItr ); } - rMyCell.bHasDetectiveObj = (rMyCell.aDetectiveObjVec.size() != 0); + rMyCell.bHasDetectiveObj = (!rMyCell.aDetectiveObjVec.empty()); } void ScMyDetectiveObjContainer::SkipTable(SCTAB nSkip) @@ -503,7 +503,7 @@ void ScMyDetectiveOpContainer::SetCellData( ScMyCell& rMyCell ) rMyCell.aDetectiveOpVec.push_back( *aItr ); aItr = aDetectiveOpList.erase( aItr ); } - rMyCell.bHasDetectiveOp = (rMyCell.aDetectiveOpVec.size() != 0); + rMyCell.bHasDetectiveOp = (!rMyCell.aDetectiveOpVec.empty()); } void ScMyDetectiveOpContainer::SkipTable(SCTAB nSkip) diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index bf68d4a48b59..a8b61cdfd93f 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -964,7 +964,7 @@ void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos) // core implementation void ScXMLTableRowCellContext::SetDetectiveObj( const ScAddress& rPosition ) { - if( cellExists(rPosition) && pDetectiveObjVec && pDetectiveObjVec->size() ) + if( cellExists(rPosition) && pDetectiveObjVec && !pDetectiveObjVec->empty() ) { LockSolarMutex(); ScDetectiveFunc aDetFunc( rXMLImport.GetDocument(), rPosition.Tab() ); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 0112c308d71d..7d143a7faec0 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -4562,7 +4562,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList(nTab); if(pCondFormatList) { - if(pCondFormatList && !pCondFormatList->size()) + if(pCondFormatList && pCondFormatList->empty()) return; SvXMLElementExport aElementCondFormats(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, true, true); diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 6a2a8b436674..bcccb1af82bb 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1535,7 +1535,7 @@ void ScTabStops::AddTabStop( vcl::Window* pWin ) void ScTabStops::SetTabStop( vcl::Window* pWin ) { - if ( !maControls.size() ) + if ( maControls.empty() ) return; ControlToPosMap::const_iterator aIter = maControlToPos.find( pWin ); if ( aIter == maControlToPos.end() ) @@ -1554,7 +1554,7 @@ void ScTabStops::SetTabStop( vcl::Window* pWin ) void ScTabStops::CycleFocus( bool bReverse ) { - if (!maControls.size()) + if (maControls.empty()) return; if ( mnCurTabStop < maControls.size() ) { diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 6cdc2c35dc4e..2968ea7f53c0 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1167,7 +1167,7 @@ static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLa rLang = LanguageType( 0 ); rDateConvert = false; - if (aTokens.size() > 0) + if (!aTokens.empty()) rLang = static_cast<LanguageType>(aTokens[0].toInt32()); if (aTokens.size() > 1) rDateConvert = static_cast<bool>(aTokens[1].toInt32()); diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index af8de51f271f..ee8104724c02 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -215,7 +215,7 @@ bool ScConflictsFinder::Find() pOwnAction = pOwnAction->GetNext(); } - if ( aOwnActions.size() ) + if ( !aOwnActions.empty() ) { ScConflictsListEntry* pEntry = GetEntry( pSharedAction->GetActionNumber(), aOwnActions ); for ( auto& aOwnAction : aOwnActions ) diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx index 5dbe9b07d987..6bfd7c78ed41 100644 --- a/sc/source/ui/miscdlgs/datafdlg.cxx +++ b/sc/source/ui/miscdlgs/datafdlg.cxx @@ -379,7 +379,7 @@ void ScDataFormDlg::SetButtonState() m_pBtnPrev->Enable(); m_pBtnRestore->Enable( false ); - if ( maEdits.size()>=1 && maEdits[0] != nullptr ) + if ( !maEdits.empty() && maEdits[0] != nullptr ) maEdits[0]->GrabFocus(); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index bf4ad3870802..919533227a82 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -9395,7 +9395,7 @@ struct ScUniqueFormatsOrder bool operator()( const ScRangeList& rList1, const ScRangeList& rList2 ) const { // all range lists have at least one entry - OSL_ENSURE( rList1.size() > 0 && rList2.size() > 0, "ScUniqueFormatsOrder: empty list" ); + OSL_ENSURE( !rList1.empty() && !rList2.empty(), "ScUniqueFormatsOrder: empty list" ); // compare start positions using ScAddress comparison operator return ( rList1[ 0 ].aStart < rList2[ 0 ].aStart ); @@ -9479,7 +9479,7 @@ uno::Type SAL_CALL ScUniqueCellFormatsObj::getElementType() sal_Bool SAL_CALL ScUniqueCellFormatsObj::hasElements() { SolarMutexGuard aGuard; - return ( aRangeLists.size() != 0 ); + return ( !aRangeLists.empty() ); } // XEnumerationAccess diff --git a/sc/source/ui/vba/vbaaxes.cxx b/sc/source/ui/vba/vbaaxes.cxx index 1f1ee3b2a9de..09c8195d0bd3 100644 --- a/sc/source/ui/vba/vbaaxes.cxx +++ b/sc/source/ui/vba/vbaaxes.cxx @@ -141,7 +141,7 @@ public: } virtual sal_Bool SAL_CALL hasElements( ) override { - return ( mCoordinates.size() > 0 ); + return ( !mCoordinates.empty() ); } }; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index cda4214c4d36..bc36ed2d959a 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -1228,7 +1228,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) const SfxPoolItem* pItem = pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_CONDITIONAL ); const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - if ( !pCondFormatItem->GetCondFormatData().size() ) + if ( pCondFormatItem->GetCondFormatData().empty() ) rSet.DisableItem( nWhich ); else if ( pCondFormatItem->GetCondFormatData().size() == 1 ) rSet.DisableItem( SID_OPENDLG_CURRENTCONDFRMT_MANAGER ); |