[Libreoffice-commits] core.git: writerfilter/source writerperfect/source xmlhelp/source xmlreader/source xmlscript/source xmlsecurity/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Sep 14 09:52:07 UTC 2017


 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |    4 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx        |   10 ++++----
 writerfilter/source/dmapper/NumberingManager.cxx         |   12 +++-------
 writerfilter/source/dmapper/StyleSheetTable.cxx          |    2 -
 writerperfect/source/common/WPXSvInputStream.cxx         |    6 ++---
 xmlhelp/source/cxxhelp/provider/databases.cxx            |    6 ++---
 xmlreader/source/xmlreader.cxx                           |   16 +++++--------
 xmlscript/source/xmldlg_imexp/xmldlg_import.cxx          |    2 -
 xmlsecurity/source/dialogs/resourcemanager.cxx           |    4 +--
 xmlsecurity/source/helper/xmlsignaturehelper.cxx         |   18 +++++++--------
 10 files changed, 37 insertions(+), 43 deletions(-)

New commits:
commit b0de7bc428aaf914a836da3c33b123e4195e603e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Aug 31 12:05:39 2017 +0200

    clang-tidy modernize-use-emplace in various
    
    Change-Id: Id1bbd3f380c17beeaab11f7140d4df1304c3d0d8
    Reviewed-on: https://gerrit.libreoffice.org/41750
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index a00548c84b56..98faa97b635d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1152,7 +1152,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab
             sal_Int32 nTableWidth = 0;
             m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth);
             if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1 && !m_rDMapper_Impl.IsInHeaderFooter())
-                m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth));
+                m_rDMapper_Impl.m_aPendingFloatingTables.emplace_back(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth);
             else
             {
                 // m_xText points to the body text, get the current xText from m_rDMapper_Impl, in case e.g. we would be in a header.
@@ -1183,7 +1183,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab
 void DomainMapperTableHandler::startRow(const TablePropertyMapPtr& pProps)
 {
     m_aRowProperties.push_back( pProps );
-    m_aCellProperties.push_back( PropertyMapVector1() );
+    m_aCellProperties.emplace_back( );
 
 #ifdef DEBUG_WRITERFILTER
     TagLogger::getInstance().startElement("table.row");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2cd7f7fff6c2..1b777821b8b3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -600,7 +600,7 @@ void DomainMapper_Impl::InitTabStopFromStyle( const uno::Sequence< style::TabSto
     OSL_ENSURE(m_aCurrentTabStops.empty(), "tab stops already initialized");
     for( sal_Int32 nTab = 0; nTab < rInitTabStops.getLength(); ++nTab)
     {
-        m_aCurrentTabStops.push_back( DeletableTabStop(rInitTabStops[nTab]) );
+        m_aCurrentTabStops.emplace_back(rInitTabStops[nTab] );
     }
 }
 
@@ -5227,13 +5227,13 @@ void DomainMapper_Impl::ApplySettingsTable()
                 std::vector<beans::PropertyValue> aViewProps;
                 if (m_pSettingsTable->GetZoomFactor())
                 {
-                    aViewProps.push_back(beans::PropertyValue("ZoomFactor", -1, uno::makeAny(m_pSettingsTable->GetZoomFactor()), beans::PropertyState_DIRECT_VALUE));
-                    aViewProps.push_back(beans::PropertyValue("VisibleBottom", -1, uno::makeAny(sal_Int32(0)), beans::PropertyState_DIRECT_VALUE));
-                    aViewProps.push_back(beans::PropertyValue("ZoomType", -1, uno::makeAny(sal_Int16(0)), beans::PropertyState_DIRECT_VALUE));
+                    aViewProps.emplace_back("ZoomFactor", -1, uno::makeAny(m_pSettingsTable->GetZoomFactor()), beans::PropertyState_DIRECT_VALUE);
+                    aViewProps.emplace_back("VisibleBottom", -1, uno::makeAny(sal_Int32(0)), beans::PropertyState_DIRECT_VALUE);
+                    aViewProps.emplace_back("ZoomType", -1, uno::makeAny(sal_Int16(0)), beans::PropertyState_DIRECT_VALUE);
                 }
                 if (m_pSettingsTable->GetView())
                 {
-                    aViewProps.push_back(beans::PropertyValue("ShowOnlineLayout", -1, uno::makeAny(m_pSettingsTable->GetView() == NS_ooxml::LN_Value_doc_ST_View_web), beans::PropertyState_DIRECT_VALUE));
+                    aViewProps.emplace_back("ShowOnlineLayout", -1, uno::makeAny(m_pSettingsTable->GetView() == NS_ooxml::LN_Value_doc_ST_View_web), beans::PropertyState_DIRECT_VALUE);
                 }
                 uno::Reference<container::XIndexContainer> xBox = document::IndexedPropertyValues::create(m_xComponentContext);
                 xBox->insertByIndex(sal_Int32(0), uno::makeAny(comphelper::containerToSequence(aViewProps)));
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 47f5dae1999b..5da02b0004d4 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -217,11 +217,11 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( )
             beans::PropertyValue* aGrabIter = vGrabVals.begin();
             for(; aGrabIter!=vGrabVals.end(); ++aGrabIter) {
                 if(!IgnoreForCharStyle(aGrabIter->Name))
-                    rProperties.push_back(beans::PropertyValue(aGrabIter->Name, 0, aGrabIter->Value, beans::PropertyState_DIRECT_VALUE));
+                    rProperties.emplace_back(aGrabIter->Name, 0, aGrabIter->Value, beans::PropertyState_DIRECT_VALUE);
             }
         }
         else
-            rProperties.push_back(beans::PropertyValue(aValIter->Name, 0, aValIter->Value, beans::PropertyState_DIRECT_VALUE));
+            rProperties.emplace_back(aValIter->Name, 0, aValIter->Value, beans::PropertyState_DIRECT_VALUE);
     }
 
     return comphelper::containerToSequence(rProperties);
@@ -303,16 +303,12 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetLevelProperties( )
     for(PropertyIds const & rReadId : aReadIds) {
         boost::optional<PropertyMap::Property> aProp = getProperty(rReadId);
         if (aProp)
-            aNumberingProperties.push_back(
-                    beans::PropertyValue( getPropertyName(aProp->first), 0, aProp->second, beans::PropertyState_DIRECT_VALUE )
-                    );
+            aNumberingProperties.emplace_back( getPropertyName(aProp->first), 0, aProp->second, beans::PropertyState_DIRECT_VALUE );
     }
 
     boost::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME);
     if(aPropFont && !isOutlineNumbering())
-        aNumberingProperties.push_back(
-                beans::PropertyValue( getPropertyName(PROP_BULLET_FONT_NAME), 0, aPropFont->second, beans::PropertyState_DIRECT_VALUE )
-                );
+        aNumberingProperties.emplace_back( getPropertyName(PROP_BULLET_FONT_NAME), 0, aPropFont->second, beans::PropertyState_DIRECT_VALUE );
 
     return comphelper::containerToSequence(aNumberingProperties);
 }
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index cc63585dc9dc..9e5d80735c47 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1591,7 +1591,7 @@ OUString StyleSheetTable::getOrCreateCharStyle( PropertyValueVector_t& rCharProp
             ++aCharPropIter;
         }
         xCharStyles->insertByName( sListLabel, uno::makeAny( xStyle) );
-        m_pImpl->m_aListCharStylePropertyVector.push_back( ListCharStylePropertyMap_t( sListLabel, rCharProperties ));
+        m_pImpl->m_aListCharStylePropertyVector.emplace_back( sListLabel, rCharProperties );
     }
     catch( const uno::Exception& )
     {
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index f70b4548267a..7e848a26f70a 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -232,8 +232,8 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage> &rStorage, const rt
             // librevenge::RVNGOLEStream ignores the first character when is a control code, so ...
             if (!rvngName.isEmpty() && rvngName.toChar()<32)
                 rvngName=rvngName.copy(1);
-            maStreams.push_back(OLEStreamData(rtl::OUStringToOString(concatPath(rPath, baseName), RTL_TEXTENCODING_UTF8),
-                                              rtl::OUStringToOString(concatPath(rPath, rvngName), RTL_TEXTENCODING_UTF8)));
+            maStreams.emplace_back(rtl::OUStringToOString(concatPath(rPath, baseName), RTL_TEXTENCODING_UTF8),
+                                              rtl::OUStringToOString(concatPath(rPath, rvngName), RTL_TEXTENCODING_UTF8));
             maNameMap[concatPath(rPath, rvngName)] = maStreams.size() - 1;
         }
         else if (aIt->IsStorage())
@@ -379,7 +379,7 @@ void ZipStorageImpl::traverse(const Reference<container::XNameAccess> &rxContain
     {
         if (!lNames[n].endsWith("/")) // skip dirs
         {
-            maStreams.push_back(ZipStreamData(rtl::OUStringToOString(lNames[n], RTL_TEXTENCODING_UTF8)));
+            maStreams.emplace_back(rtl::OUStringToOString(lNames[n], RTL_TEXTENCODING_UTF8));
             maNameMap[lNames[n]] = maStreams.size() - 1;
         }
     }
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 1c263ec7c306..4546d3b950de 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -621,7 +621,7 @@ void KeywordInfo::KeywordElement::init( Databases const *pDatabases,helpdatafile
         else
         {
             id.push_back( ids.copy( k, idx-k ) );
-            anchor.push_back( OUString() );
+            anchor.emplace_back( );
         }
     }
 
@@ -768,10 +768,10 @@ KeywordInfo* Databases::getKeyword( const OUString& Database,
                         if( !bBelongsToDatabase )
                             continue;
 
-                        aVector.push_back( KeywordInfo::KeywordElement( this,
+                        aVector.emplace_back( this,
                                                                         pHdf,
                                                                         keyword,
-                                                                        doclist ) );
+                                                                        doclist );
                     }
                     aHdf.stopIteration();
 
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
index 1c6bc45bb339..d6fe61f8363f 100644
--- a/xmlreader/source/xmlreader.cxx
+++ b/xmlreader/source/xmlreader.cxx
@@ -86,8 +86,8 @@ XmlReader::XmlReader(OUString const & fileUrl)
         throw css::uno::RuntimeException(
             "cannot mmap " + fileUrl_ + " (" + OUString::number(e) + ")" );
     }
-    namespaceIris_.push_back(Span("http://www.w3.org/XML/1998/namespace"));
-    namespaces_.push_back(NamespaceData(Span("xml"), NAMESPACE_XML));
+    namespaceIris_.emplace_back("http://www.w3.org/XML/1998/namespace");
+    namespaces_.emplace_back(Span("xml"), NAMESPACE_XML);
     pos_ = static_cast< char * >(fileAddress_);
     end_ = pos_ + fileSize_;
     state_ = State::Content;
@@ -120,7 +120,7 @@ int XmlReader::registerNamespaceIri(Span const & iri) {
         // those files during migration would fail without this hack that can be
         // removed once migration is no longer relevant (see
         // configmgr::Components::parseModificationLayer):
-        namespaces_.push_back(NamespaceData(Span("xsi"), id));
+        namespaces_.emplace_back(Span("xsi"), id);
     }
     return id;
 }
@@ -646,15 +646,13 @@ XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
                    Span(attrNameBegin, attrNameColon - attrNameBegin).equals(
                        "xmlns"))
         {
-            namespaces_.push_back(
-                NamespaceData(
+            namespaces_.emplace_back(
                     Span(attrNameColon + 1, attrNameEnd - (attrNameColon + 1)),
-                    scanNamespaceIri(valueBegin, valueEnd)));
+                    scanNamespaceIri(valueBegin, valueEnd));
         } else {
-            attributes_.push_back(
-                AttributeData(
+            attributes_.emplace_back(
                     attrNameBegin, attrNameEnd, attrNameColon, valueBegin,
-                    valueEnd));
+                    valueEnd);
         }
     }
     if (!hasDefaultNs && !elements_.empty()) {
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index 30fa4dbcaa9d..3b5927673fdf 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -66,7 +66,7 @@ namespace xmlscript
 
 void EventElement::endElement()
 {
-    static_cast< ControlElement * >( m_xParent.get() )->_events.push_back( this );
+    static_cast< ControlElement * >( m_xParent.get() )->_events.emplace_back(this );
 }
 
 ControlElement::ControlElement(
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx
index 4df58e9868d1..f5a3411e9e76 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -262,7 +262,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
                 if (!bInValue)
                 {
                     OSL_ASSERT(!sType.isEmpty());
-                    retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
+                    retVal.emplace_back(sType, sbufValue.makeStringAndClear());
                     sType.clear();
                     //The next char is the start of the new type
                     nTypeNameStart = i + 1;
@@ -288,7 +288,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
         if (!sbufValue.isEmpty())
         {
             OSL_ASSERT(!sType.isEmpty());
-            retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
+            retVal.emplace_back(sType, sbufValue.makeStringAndClear());
         }
         return retVal;
     }
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index f4f61e0fc945..db29cd9a4bcd 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -432,9 +432,9 @@ void XMLSignatureHelper::EnsureSignaturesRelation(const css::uno::Reference<css:
     {
         // No, and have to add one.
         std::vector<beans::StringPair> aRelation;
-        aRelation.push_back(beans::StringPair("Id", "rId" + OUString::number(++nCount)));
-        aRelation.push_back(beans::StringPair("Type", OOXML_SIGNATURE_ORIGIN));
-        aRelation.push_back(beans::StringPair("Target", "_xmlsignatures/origin.sigs"));
+        aRelation.emplace_back("Id", "rId" + OUString::number(++nCount));
+        aRelation.emplace_back("Type", OOXML_SIGNATURE_ORIGIN);
+        aRelation.emplace_back("Target", "_xmlsignatures/origin.sigs");
         aRelationsInfo.push_back(comphelper::containerToSequence(aRelation));
     }
     else if (bHaveRelation && !bAdd)
@@ -479,9 +479,9 @@ void XMLSignatureHelper::ExportSignatureRelations(const css::uno::Reference<css:
     for (int i = 0; i < nSignatureCount; ++i)
     {
         std::vector<beans::StringPair> aRelation;
-        aRelation.push_back(beans::StringPair("Id", "rId" + OUString::number(i + 1)));
-        aRelation.push_back(beans::StringPair("Type", OOXML_SIGNATURE_SIGNATURE));
-        aRelation.push_back(beans::StringPair("Target", "sig" + OUString::number(i + 1) + ".xml"));
+        aRelation.emplace_back("Id", "rId" + OUString::number(i + 1));
+        aRelation.emplace_back("Type", OOXML_SIGNATURE_SIGNATURE);
+        aRelation.emplace_back("Target", "sig" + OUString::number(i + 1) + ".xml");
         aRelations.push_back(comphelper::containerToSequence(aRelation));
     }
     comphelper::OFOPXMLHelper::WriteRelationsInfoSequence(xRelStream, comphelper::containerToSequence(aRelations), mxCtx);
@@ -508,14 +508,14 @@ void XMLSignatureHelper::ExportSignatureContentTypes(const css::uno::Reference<c
         return rPair.First == "rels";
     });
     if (it == rDefaults.end())
-        aDefaults.push_back(beans::StringPair("rels", "application/vnd.openxmlformats-package.relationships+xml"));
+        aDefaults.emplace_back("rels", "application/vnd.openxmlformats-package.relationships+xml");
 
     it = std::find_if(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair)
     {
         return rPair.First == "sigs";
     });
     if (it == rDefaults.end())
-        aDefaults.push_back(beans::StringPair("sigs", "application/vnd.openxmlformats-package.digital-signature-origin"));
+        aDefaults.emplace_back("sigs", "application/vnd.openxmlformats-package.digital-signature-origin");
     rDefaults = comphelper::containerToSequence(aDefaults);
 
     // Remove existing signature overrides.
@@ -528,7 +528,7 @@ void XMLSignatureHelper::ExportSignatureContentTypes(const css::uno::Reference<c
 
     // Add our signature overrides.
     for (int i = 1; i <= nSignatureCount; ++i)
-        aOverrides.push_back(beans::StringPair("/_xmlsignatures/sig" + OUString::number(i) + ".xml", "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml"));
+        aOverrides.emplace_back("/_xmlsignatures/sig" + OUString::number(i) + ".xml", "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml");
 
     rOverrides = comphelper::containerToSequence(aOverrides);
     uno::Reference<io::XOutputStream> xOutputStream = xStream->getOutputStream();


More information about the Libreoffice-commits mailing list