[Libreoffice-commits] .: binfilter/bf_sc binfilter/bf_svtools binfilter/bf_xmloff
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Fri Apr 22 02:52:06 PDT 2011
binfilter/bf_sc/source/filter/xml/sc_XMLStylesExportHelper.cxx | 2 -
binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx | 8 ++--
binfilter/bf_sc/source/filter/xml/sc_xmlstyli.cxx | 2 -
binfilter/bf_svtools/source/items1/svt_stylepool.cxx | 2 -
binfilter/bf_svtools/source/uno/svt_unoimap.cxx | 2 -
binfilter/bf_xmloff/source/chart/xmloff_SchXMLExport.cxx | 20 +++++-----
binfilter/bf_xmloff/source/style/xmloff_xmlexppr.cxx | 2 -
binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx | 8 ++--
binfilter/bf_xmloff/source/text/xmloff_txtparae.cxx | 8 ++--
9 files changed, 27 insertions(+), 27 deletions(-)
New commits:
commit 5275e01aa9e6e4778d4bb772133e7cbe340f117d
Author: Kayo Hamid <kayo.hamid at gekkolinux.com.br>
Date: Fri Apr 22 11:31:08 2011 +0200
cppcheck inefficient checking for emptiness
From cppcheck: Using xxxx.empty() instead of xxxx.size() can be faster.
xxxx.size() can take linear time but xxxx.empty() is guaranteed to take
constant time
diff --git a/binfilter/bf_sc/source/filter/xml/sc_XMLStylesExportHelper.cxx b/binfilter/bf_sc/source/filter/xml/sc_XMLStylesExportHelper.cxx
index ef6d3b3..6557973 100644
--- a/binfilter/bf_sc/source/filter/xml/sc_XMLStylesExportHelper.cxx
+++ b/binfilter/bf_sc/source/filter/xml/sc_XMLStylesExportHelper.cxx
@@ -344,7 +344,7 @@ void ScMyValidationsContainer::WriteMessage(ScXMLExport& rExport,
void ScMyValidationsContainer::WriteValidations(ScXMLExport& rExport)
{
- if (aValidationVec.size())
+ if (!aValidationVec.empty())
{
SvXMLElementExport aElemVs(rExport, XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATIONS, sal_True, sal_True);
ScMyValidationVec::iterator aItr = aValidationVec.begin();
diff --git a/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx b/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx
index 18a89df..62fa91b 100644
--- a/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx
+++ b/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx
@@ -1501,7 +1501,7 @@ void ScXMLExport::_ExportAutoStyles()
if (xTableProperties.is())
{
std::vector<XMLPropertyState> xPropStates = xTableStylesExportPropertySetMapper->Filter(xTableProperties);
- if(xPropStates.size())
+ if(!xPropStates.empty())
{
::rtl::OUString sParent;
::rtl::OUString sName;
@@ -1587,7 +1587,7 @@ void ScXMLExport::_ExportAutoStyles()
}
if (sStyleName.getLength())
{
- if (xPropStates.size())
+ if (!xPropStates.empty())
{
sal_Int32 nIndex;
::rtl::OUString sName;
@@ -1674,7 +1674,7 @@ void ScXMLExport::_ExportAutoStyles()
if (xColumnProperties.is())
{
std::vector<XMLPropertyState> xPropStates = xColumnStylesExportPropertySetMapper->Filter(xColumnProperties);
- if(xPropStates.size())
+ if(!xPropStates.empty())
{
std::vector< XMLPropertyState >::iterator aItr = xPropStates.begin();
while (aItr != xPropStates.end())
@@ -1739,7 +1739,7 @@ void ScXMLExport::_ExportAutoStyles()
if(xRowProperties.is())
{
std::vector<XMLPropertyState> xPropStates = xRowStylesExportPropertySetMapper->Filter(xRowProperties);
- if(xPropStates.size())
+ if(!xPropStates.empty())
{
::rtl::OUString sParent;
::rtl::OUString sName;
diff --git a/binfilter/bf_sc/source/filter/xml/sc_xmlstyli.cxx b/binfilter/bf_sc/source/filter/xml/sc_xmlstyli.cxx
index ec3f438..405f4f2 100644
--- a/binfilter/bf_sc/source/filter/xml/sc_xmlstyli.cxx
+++ b/binfilter/bf_sc/source/filter/xml/sc_xmlstyli.cxx
@@ -554,7 +554,7 @@ void XMLTableStyleContext::FillPropertySet(
AddProperty(CTF_SC_NUMBERFORMAT, aNumberFormat);
}
}
- if (!bConditionalFormatCreated && (aMaps.size() > 0))
+ if (!bConditionalFormatCreated && (!aMaps.empty()))
{
aConditionalFormat = rPropSet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)));
std::vector<ScXMLMapContent>::iterator aItr = aMaps.begin();
diff --git a/binfilter/bf_svtools/source/items1/svt_stylepool.cxx b/binfilter/bf_svtools/source/items1/svt_stylepool.cxx
index 83e4ea3..5ff3979 100644
--- a/binfilter/bf_svtools/source/items1/svt_stylepool.cxx
+++ b/binfilter/bf_svtools/source/items1/svt_stylepool.cxx
@@ -57,7 +57,7 @@ namespace binfilter
Node( const SfxPoolItem& rItem, Node* pParent ) : // child node Ctor
pItem( rItem.Clone() ), pUpper( pParent ){}
~Node();
- bool hasItemSet() const { return 0 < aItemSet.size(); }
+ bool hasItemSet() const { return 0 < !aItemSet.empty(); }
const StylePool::SfxItemSet_Pointer_t getItemSet() const { return aItemSet[aItemSet.size()-1]; }
void setItemSet( const SfxItemSet& rSet ){ aItemSet.push_back( StylePool::SfxItemSet_Pointer_t( rSet.Clone() ) ); }
Node* findChildNode( const SfxPoolItem& rItem );
diff --git a/binfilter/bf_svtools/source/uno/svt_unoimap.cxx b/binfilter/bf_svtools/source/uno/svt_unoimap.cxx
index 86d462c..bc7a70d 100644
--- a/binfilter/bf_svtools/source/uno/svt_unoimap.cxx
+++ b/binfilter/bf_svtools/source/uno/svt_unoimap.cxx
@@ -733,7 +733,7 @@ Type SAL_CALL SvUnoImageMap::getElementType( ) throw(RuntimeException)
sal_Bool SAL_CALL SvUnoImageMap::hasElements( ) throw(RuntimeException)
{
- return maObjectList.size() != 0;
+ return (!maObjectList.empty());
}
// XSerivceInfo
diff --git a/binfilter/bf_xmloff/source/chart/xmloff_SchXMLExport.cxx b/binfilter/bf_xmloff/source/chart/xmloff_SchXMLExport.cxx
index 1342aaa..d2933f4 100644
--- a/binfilter/bf_xmloff/source/chart/xmloff_SchXMLExport.cxx
+++ b/binfilter/bf_xmloff/source/chart/xmloff_SchXMLExport.cxx
@@ -1138,7 +1138,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
// write style name
// AddAutoStyleAttribute( aPropertyStates ); // can't be used here because we need the name
- if( aPropertyStates.size())
+ if( !aPropertyStates.empty())
{
DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
if( maAutoStyleNameQueue.empty())
@@ -1273,7 +1273,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
{
aPropertyStates = mxExpPropMapper->Filter( xStatProp );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
{
// write element
if( bExportContent )
@@ -1303,7 +1303,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
{
aPropertyStates = mxExpPropMapper->Filter( xStatProp );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
{
// write element
if( bExportContent )
@@ -1377,7 +1377,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
if( xPropSet.is())
{
aPropertyStates = mxExpPropMapper->Filter( xPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
{
// write data-point with style
DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
@@ -1469,7 +1469,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
if( xPropSet.is())
{
aPropertyStates = mxExpPropMapper->Filter( xPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
CollectAutoStyle( aPropertyStates );
}
}
@@ -1495,7 +1495,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
aPropertyStates.clear();
aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
{
if( bExportContent )
{
@@ -1517,7 +1517,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
aPropertyStates.clear();
aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
{
if( bExportContent )
{
@@ -1539,7 +1539,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
aPropertyStates.clear();
aPropertyStates = mxExpPropMapper->Filter( xStockPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.empty() )
{
if( bExportContent )
{
@@ -1571,7 +1571,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
{
aPropertyStates = mxExpPropMapper->Filter( xWallPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.size() )
{
// write element
if( bExportContent )
@@ -1599,7 +1599,7 @@ void SchXMLExportHelper::exportPlotArea( uno::Reference< chart::XDiagram > xDiag
{
aPropertyStates = mxExpPropMapper->Filter( xFloorPropSet );
- if( aPropertyStates.size() > 0 )
+ if( !aPropertyStates.size() )
{
// write element
if( bExportContent )
diff --git a/binfilter/bf_xmloff/source/style/xmloff_xmlexppr.cxx b/binfilter/bf_xmloff/source/style/xmloff_xmlexppr.cxx
index 893dfc7..8baea30 100644
--- a/binfilter/bf_xmloff/source/style/xmloff_xmlexppr.cxx
+++ b/binfilter/bf_xmloff/source/style/xmloff_xmlexppr.cxx
@@ -618,7 +618,7 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
}
// Call centext-filter
- if( aPropStateArray.size() > 0 )
+ if( !aPropStateArray.empty() )
ContextFilter( aPropStateArray, xPropSet );
// Have to do if we change from a vector to a list or something like that
diff --git a/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx b/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx
index 97d37ce..6bcce1a 100644
--- a/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx
+++ b/binfilter/bf_xmloff/source/text/xmloff_txtflde.cxx
@@ -1841,7 +1841,7 @@ void XMLTextFieldExport::ExportFieldDeclarations(
// now process fields:
// variable field masters:
- if (aVarName.size() > 0)
+ if (!aVarName.empty())
{
SvXMLElementExport aElem( GetExport(),
XML_NAMESPACE_TEXT,
@@ -1900,7 +1900,7 @@ void XMLTextFieldExport::ExportFieldDeclarations(
// else: no declarations element
// sequence field masters:
- if (aSeqName.size() > 0)
+ if (!aSeqName.empty())
{
SvXMLElementExport aElem( GetExport(),
XML_NAMESPACE_TEXT,
@@ -1942,7 +1942,7 @@ void XMLTextFieldExport::ExportFieldDeclarations(
// else: no declarations element
// user field field masters:
- if (aUserName.size() > 0)
+ if (!aUserName.empty())
{
SvXMLElementExport aElem( GetExport(),
XML_NAMESPACE_TEXT,
@@ -1991,7 +1991,7 @@ void XMLTextFieldExport::ExportFieldDeclarations(
// else: no declarations element
// DDE field field masters:
- if (aDdeName.size() > 0)
+ if (!aDdeName.empty())
{
SvXMLElementExport aElem( GetExport(),
XML_NAMESPACE_TEXT,
diff --git a/binfilter/bf_xmloff/source/text/xmloff_txtparae.cxx b/binfilter/bf_xmloff/source/text/xmloff_txtparae.cxx
index eb422ea..c91390b 100644
--- a/binfilter/bf_xmloff/source/text/xmloff_txtparae.cxx
+++ b/binfilter/bf_xmloff/source/text/xmloff_txtparae.cxx
@@ -199,7 +199,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
}
}
- if( xPropStates.size() > 0L )
+ if( !xPropStates.empty() )
{
Reference< XPropertySetInfo > xPropSetInfo =
rPropSet->getPropertySetInfo();
@@ -324,7 +324,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
}
}
- if( xPropStates.size() > 0L )
+ if( !xPropStates.empty() )
{
OUString sParent, sCondParent;
Any aAny;
@@ -379,7 +379,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
}
break;
}
- if( xPropStates.size() > 0 )
+ if( !xPropStates.empty() )
{
GetAutoStylePool().Add( nFamily, sParent, xPropStates );
if( sCondParent.getLength() && sParent != sCondParent )
@@ -425,7 +425,7 @@ OUString XMLTextParagraphExport::Find(
}
}
- if( xPropStates.size() > 0L )
+ if( !xPropStates.empty() )
sName = GetAutoStylePool().Find( nFamily, sName, xPropStates );
return sName;
More information about the Libreoffice-commits
mailing list