From 22da27d9ddcdacaef21d667b0777052b7e817b9a Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Sat, 21 Jan 2012 19:57:19 +0100 Subject: Improve checking for emptiness --- animations/source/animcore/animcore.cxx | 2 +- basegfx/inc/basegfx/curve/b2dbeziertools.hxx | 2 +- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 10 +++++----- basegfx/source/polygon/b2dpolygontriangulator.cxx | 2 +- basegfx/source/polygon/b2dtrapezoid.cxx | 2 +- basegfx/source/raster/rasterconvert3d.cxx | 4 ++-- connectivity/source/drivers/mozab/MPreparedStatement.cxx | 2 +- cui/source/dialogs/SpellDialog.cxx | 4 ++-- cui/source/dialogs/cuigaldlg.cxx | 4 ++-- drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx | 6 +++--- drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx | 2 +- drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx | 2 +- drawinglayer/source/primitive3d/sdrprimitive3d.cxx | 2 +- drawinglayer/source/processor2d/canvasprocessor.cxx | 2 +- drawinglayer/source/processor2d/vclhelpergradient.cxx | 6 +++--- drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 +- svtools/bmpmaker/bmpcore.cxx | 2 +- svtools/source/filter/wmf/winmtf.cxx | 2 +- svx/source/engine3d/helperhittest3d.cxx | 2 +- sw/source/core/docnode/ndtbl.cxx | 2 +- sw/source/core/unocore/unoportenum.cxx | 4 ++-- 21 files changed, 33 insertions(+), 33 deletions(-) diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 9a837f60bc70..e85b80642d7c 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -1178,7 +1178,7 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeExce { xNewNode = new AnimationNode( *this ); - if( maChildren.size() ) + if( !maChildren.empty() ) { Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY ); if( xContainer.is() ) diff --git a/basegfx/inc/basegfx/curve/b2dbeziertools.hxx b/basegfx/inc/basegfx/curve/b2dbeziertools.hxx index 2279cb9a8f24..821cc33c723f 100644 --- a/basegfx/inc/basegfx/curve/b2dbeziertools.hxx +++ b/basegfx/inc/basegfx/curve/b2dbeziertools.hxx @@ -54,7 +54,7 @@ namespace basegfx public: B2DCubicBezierHelper(const B2DCubicBezier& rBase, sal_uInt32 nDivisions = 9); - double getLength() const { if(maLengthArray.size()) return maLengthArray[maLengthArray.size() - 1]; else return 0.0; } + double getLength() const { if(!maLengthArray.empty()) return maLengthArray[maLengthArray.size() - 1]; else return 0.0; } double distanceToRelative(double fDistance) const; }; } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 011ecff8ad10..d4d075bfc9bf 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -437,7 +437,7 @@ namespace basegfx // #i76891# using findCuts recursively is not sufficient here findCutsAndTouchesAndCommonForBezier(aTempPolygonA, aTempPolygonEdge, aTempPointVectorA, aTempPointVectorEdge); - if(aTempPointVectorA.size()) + if(!aTempPointVectorA.empty()) { // adapt tempVector entries to segment adaptAndTransferCutsWithBezierSegment(aTempPointVectorA, aTempPolygonA, nIndA, rTempPointsA); @@ -479,13 +479,13 @@ namespace basegfx // #i76891# using findCuts recursively is not sufficient here findCutsAndTouchesAndCommonForBezier(aTempPolygonA, aTempPolygonB, aTempPointVectorA, aTempPointVectorB); - if(aTempPointVectorA.size()) + if(!aTempPointVectorA.empty()) { // adapt tempVector entries to segment adaptAndTransferCutsWithBezierSegment(aTempPointVectorA, aTempPolygonA, nIndA, rTempPointsA); } - if(aTempPointVectorB.size()) + if(!aTempPointVectorB.empty()) { // adapt tempVector entries to segment adaptAndTransferCutsWithBezierSegment(aTempPointVectorB, aTempPolygonB, nIndB, rTempPointsB); @@ -518,7 +518,7 @@ namespace basegfx rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findCuts(aTempPolygon, aTempPointVector); - if(aTempPointVector.size()) + if(!aTempPointVector.empty()) { // adapt tempVector entries to segment adaptAndTransferCutsWithBezierSegment(aTempPointVector, aTempPolygon, nInd, rTempPoints); @@ -715,7 +715,7 @@ namespace basegfx rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findTouches(aTempPolygon, rPointPolygon, aTempPointVector); - if(aTempPointVector.size()) + if(!aTempPointVector.empty()) { // adapt tempVector entries to segment adaptAndTransferCutsWithBezierSegment(aTempPointVector, aTempPolygon, nInd, rTempPoints); diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index 66666e55a563..121211d2501b 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -261,7 +261,7 @@ namespace basegfx } } - if(maStartEntries.size()) + if(!maStartEntries.empty()) { // sort initial list ::std::sort(maStartEntries.begin(), maStartEntries.end()); diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index 8c43bfecda9d..fc2a43ba81da 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -550,7 +550,7 @@ namespace basegfx } } - if(maTrDeEdgeEntries.size()) + if(!maTrDeEdgeEntries.empty()) { // single and initial sort of traversing edges maTrDeEdgeEntries.sort(); diff --git a/basegfx/source/raster/rasterconvert3d.cxx b/basegfx/source/raster/rasterconvert3d.cxx index 3ff9486d37ac..9c9c8e01b4b3 100644 --- a/basegfx/source/raster/rasterconvert3d.cxx +++ b/basegfx/source/raster/rasterconvert3d.cxx @@ -66,7 +66,7 @@ namespace basegfx void RasterConverter3D::rasterconvertB3DArea(sal_Int32 nStartLine, sal_Int32 nStopLine) { - if(maLineEntries.size()) + if(!maLineEntries.empty()) { OSL_ENSURE(nStopLine >= nStartLine, "nStopLine is bigger than nStartLine (!)"); @@ -317,7 +317,7 @@ namespace basegfx } } - if(maLineEntries.size()) + if(!maLineEntries.empty()) { rasterconvertB3DArea(nStartLine, nStopLine); } diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index 2aa2dddb9750..e21ec2f803df 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -486,7 +486,7 @@ void OPreparedStatement::describeParameter() { ::std::vector< OSQLParseNode*> aParseNodes; scanParameter(m_pParseTree,aParseNodes); - if(aParseNodes.size()) + if(!aParseNodes.empty()) { m_xParamColumns = new OSQLColumns(); const OSQLTables& xTabs = m_pSQLIterator->getTables(); diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 2f66b410919e..a336a4b89658 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1181,7 +1181,7 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck) if(!bUseSavedSentence) m_aSavedSentence = aSentence; bool bHasReplaced = false; - while(aSentence.size()) + while(!aSentence.empty()) { //apply all changes that are already part of the "ChangeAllList" //returns true if the list still contains errors after the changes have been applied @@ -1195,7 +1195,7 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck) break; } - if(aSentence.size()) + if(!aSentence.empty()) { SpellPortions::iterator aStart = aSentence.begin(); rtl::OUString sText; diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 47d3ba82d1a5..ba841629ec99 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -1217,7 +1217,7 @@ IMPL_LINK( TPGalleryThemeProperties, SelectFoundHdl, void *, EMPTYARG ) else aCbxPreview.Disable(); - if( aFoundList.size() ) + if( !aFoundList.empty() ) aBtnTakeAll.Enable(); else aBtnTakeAll.Disable(); @@ -1258,7 +1258,7 @@ IMPL_LINK( TPGalleryThemeProperties, PreviewTimerHdl, void *, EMPTYARG ) IMPL_LINK( TPGalleryThemeProperties, EndSearchProgressHdl, SearchProgress *, EMPTYARG ) { - if( aFoundList.size() ) + if( !aFoundList.empty() ) { aLbxFound.SelectEntryPos( 0 ); aBtnTakeAll.Enable(); diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index b2f1bb5aab2e..25afcfe365ce 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -128,7 +128,7 @@ namespace drawinglayer Primitive2DSequence aRetval(rColors.size() ? rMatrices.size() + 1 : rMatrices.size()); // create solid fill with start color - if(rColors.size()) + if(!rColors.empty()) { // create primitive const Primitive2DReference xRef( @@ -175,7 +175,7 @@ namespace drawinglayer aRetval.realloc(nEntryCount); - if(rColors.size()) + if(!rColors.empty()) { basegfx::B2DRange aOuterPolyRange(aOuterPoly.getB2DRange()); aOuterPolyRange.expand(getObjectRange()); @@ -193,7 +193,7 @@ namespace drawinglayer aCombinedPolyPoly = basegfx::B2DPolyPolygon(aInnerPoly); } - if(rColors.size()) + if(!rColors.empty()) { aRetval[nIndex] = Primitive2DReference(new PolyPolygonColorPrimitive2D( aCombinedPolyPoly, rColors[rColors.size() - 1])); diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index 0b6447c4101b..8b676cdef929 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer // get slices const Slice3DVector& rSliceVector = getSlices(); - if(rSliceVector.size()) + if(!rSliceVector.empty()) { sal_uInt32 a; diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index cc9cb8bc43ea..1639308f4d9c 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer // get slices const Slice3DVector& rSliceVector = getSlices(); - if(rSliceVector.size()) + if(!rSliceVector.empty()) { const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0)); const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI)); diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index b2a098cc8ad8..e4ee45f2a8cb 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -64,7 +64,7 @@ namespace drawinglayer { basegfx::B3DRange aRetval; - if(rSlices.size()) + if(!rSlices.empty()) { for(sal_uInt32 a(0L); a < rSlices.size(); a++) { diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index e916b293da9f..6dcdd99cb813 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -539,7 +539,7 @@ namespace drawinglayer aStrokeAttribute.MiterLimit = 15.0; // degrees; maybe here (15.0 * F_PI180) is needed, not clear in the documentation const ::std::vector< double >& rDotDashArray = rStrokeAttribute.getDotDashArray(); - if(rDotDashArray.size()) + if(!rDotDashArray.empty()) { aStrokeAttribute.DashArray = uno::Sequence< double >(&rDotDashArray[0], rDotDashArray.size()); } diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx index 7564f000acbd..da7995a79c45 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.cxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -140,7 +140,7 @@ namespace drawinglayer } // draw last poly in last color - if(rColors.size()) + if(!rColors.empty()) { const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); rOutDev.SetFillColor(Color(aFillColor)); @@ -179,7 +179,7 @@ namespace drawinglayer } // draw last poly in last color - if(rColors.size()) + if(!rColors.empty()) { const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); rOutDev.SetFillColor(Color(aFillColor)); @@ -265,7 +265,7 @@ namespace drawinglayer } // paint them with mask using the XOR method - if(aMatrices.size()) + if(!aMatrices.empty()) { if(bSimple) { diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index d27826bd388b..c554eb818cb2 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -277,7 +277,7 @@ namespace drawinglayer nLen = nChars; } - if(aTransformedDXArray.size()) + if(!aTransformedDXArray.empty()) { mpOutputDevice->DrawTextArray( aStartPoint, diff --git a/svtools/bmpmaker/bmpcore.cxx b/svtools/bmpmaker/bmpcore.cxx index fd438ce980cb..5209a923d160 100644 --- a/svtools/bmpmaker/bmpcore.cxx +++ b/svtools/bmpmaker/bmpcore.cxx @@ -91,7 +91,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, if( pCollectStm ) pCollectStm->Seek( STREAM_SEEK_TO_END ); - if( rInDirs.size() ) + if( !rInDirs.empty() ) { ByteString aLine; String aInfo, aPrefix, aName( rName ), aString; diff --git a/svtools/source/filter/wmf/winmtf.cxx b/svtools/source/filter/wmf/winmtf.cxx index 3ae1dff17dc3..090886e82678 100644 --- a/svtools/source/filter/wmf/winmtf.cxx +++ b/svtools/source/filter/wmf/winmtf.cxx @@ -2178,7 +2178,7 @@ void WinMtfOutput::Push() // !! to be able to access the o void WinMtfOutput::Pop() { // Die aktuellen Daten vom Stack holen - if( vSaveStack.size() ) + if( !vSaveStack.empty() ) { // Die aktuelle Daten auf dem Stack sichern SaveStructPtr pSave( vSaveStack.back() ); diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 1a6e41ccbeba..c83cae99556e 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -279,7 +279,7 @@ bool checkHitSingle3DObject( ::std::vector< basegfx::B3DPoint > aHitsWithObject; getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject, true); - if(aHitsWithObject.size()) + if(!aHitsWithObject.empty()) { return true; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index f759441830c1..0817150b20f8 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2933,7 +2933,7 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox ) const SwTableBox* pRet = 0; sal_uInt16 n; - if( aPosArr.size() ) + if( !aPosArr.empty() ) { for( n = 0; n < aPosArr.size(); ++n ) if( aPosArr[ n ] == nWidth ) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 33697fc8bce8..fdfe3c698b1f 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -1020,7 +1020,7 @@ lcl_GetNextIndex( SwSoftPageBreakList const & rBreakArr ) { sal_Int32 nRet = -1; - if(rBkmArr.size()) + if(!rBkmArr.empty()) { SwXBookmarkPortion_ImplSharedPtr pPtr = (*rBkmArr.begin()); nRet = pPtr->getIndex(); @@ -1032,7 +1032,7 @@ lcl_GetNextIndex( if(nRet < 0 || nTmp < nRet) nRet = nTmp; } - if(rBreakArr.size()) + if(!rBreakArr.empty()) { if(nRet < 0 || *rBreakArr.begin() < static_cast(nRet)) nRet = *rBreakArr.begin(); -- cgit v1.2.3