diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-08 16:55:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-11 08:40:57 +0200 |
commit | 4c09f8e087cae598efbb78759110c03ed10e3a3a (patch) | |
tree | 963bf5ef462eacc2195ffb23d22c6e7e5fd0d627 /comphelper | |
parent | 58edb05341494dfaa3d3ce33505b97961d5f2ea9 (diff) |
clang-tidy modernize-use-emplace in c*
Change-Id: I419d1f67ba301050d05981db2a3d6178878684a9
Reviewed-on: https://gerrit.libreoffice.org/42110
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/container/interfacecontainer2.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/asyncnotification.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/backupfilehelper.cxx | 26 | ||||
-rw-r--r-- | comphelper/source/misc/configurationhelper.cxx | 4 | ||||
-rw-r--r-- | comphelper/source/misc/profilezone.cxx | 3 | ||||
-rw-r--r-- | comphelper/source/misc/servicedecl.cxx | 4 | ||||
-rw-r--r-- | comphelper/source/misc/syntaxhighlight.cxx | 5 | ||||
-rw-r--r-- | comphelper/source/xml/attributelist.cxx | 2 |
8 files changed, 22 insertions, 26 deletions
diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx index 90f4e01b476e..678ba70083f8 100644 --- a/comphelper/source/container/interfacecontainer2.cxx +++ b/comphelper/source/container/interfacecontainer2.cxx @@ -149,7 +149,7 @@ std::vector< Reference<XInterface> > OInterfaceContainerHelper2::getElements() c rVec = *aData.pAsVector; else if( aData.pAsInterface ) { - rVec.push_back( Reference<XInterface>( aData.pAsInterface ) ); + rVec.emplace_back( aData.pAsInterface ); } return rVec; } diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx index 88489ec65e3a..ec305e4bdfce 100644 --- a/comphelper/source/misc/asyncnotification.cxx +++ b/comphelper/source/misc/asyncnotification.cxx @@ -124,7 +124,7 @@ namespace comphelper ::osl::MutexGuard aGuard( m_xImpl->aMutex ); // remember this event - m_xImpl->aEvents.push_back( ProcessableEvent( _rEvent, _xProcessor ) ); + m_xImpl->aEvents.emplace_back( _rEvent, _xProcessor ); // awake the thread m_xImpl->aPendingActions.set(); diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index abc8579a542b..a6a4e5ec9e8e 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -608,7 +608,7 @@ namespace if (xPackage.is()) { - maEntries.push_back(ExtensionInfoEntry(xPackage)); + maEntries.emplace_back(xPackage); } } } @@ -642,10 +642,9 @@ namespace } const bool bEnabled(aAttrRevoked.isEmpty() || !aAttrRevoked.toBoolean()); - maEntries.push_back( - ExtensionInfoEntry( + maEntries.emplace_back( OUStringToOString(aAttrUrl, RTL_TEXTENCODING_ASCII_US), - bEnabled)); + bEnabled); } } else @@ -1607,12 +1606,11 @@ namespace // create a file entry for a new file. Offset is set automatically // to 0 to mark the entry as new file entry - maPackedFileEntryVector.push_back( - PackedFileEntry( + maPackedFileEntryVector.emplace_back( static_cast< sal_uInt32 >(nFileSize), nCrc32, rFileCandidate, - bCompress)); + bCompress); mbChanged = true; } @@ -2066,12 +2064,12 @@ namespace comphelper if (aDirNames.empty()) { - aDirNames.push_back("config"); // UI config stuff - aDirNames.push_back("registry"); // most of the registry stuff - aDirNames.push_back("psprint"); // not really needed, can be abandoned - aDirNames.push_back("store"); // not really needed, can be abandoned - aDirNames.push_back("temp"); // not really needed, can be abandoned - aDirNames.push_back("pack"); // own backup dir + aDirNames.emplace_back("config"); // UI config stuff + aDirNames.emplace_back("registry"); // most of the registry stuff + aDirNames.emplace_back("psprint"); // not really needed, can be abandoned + aDirNames.emplace_back("store"); // not really needed, can be abandoned + aDirNames.emplace_back("temp"); // not really needed, can be abandoned + aDirNames.emplace_back("pack"); // own backup dir } return aDirNames; @@ -2083,7 +2081,7 @@ namespace comphelper if (aFileNames.empty()) { - aFileNames.push_back("registrymodifications.xcu"); // personal registry stuff + aFileNames.emplace_back("registrymodifications.xcu"); // personal registry stuff } return aFileNames; diff --git a/comphelper/source/misc/configurationhelper.cxx b/comphelper/source/misc/configurationhelper.cxx index f15651f0db0b..59e3248f8b6b 100644 --- a/comphelper/source/misc/configurationhelper.cxx +++ b/comphelper/source/misc/configurationhelper.cxx @@ -43,14 +43,14 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons // set root path aParam.Name = "nodepath"; aParam.Value <<= sPackage; - lParams.push_back(css::uno::Any(aParam)); + lParams.emplace_back(aParam); // enable all locales mode if (eMode & EConfigurationModes::AllLocales) { aParam.Name = "locale"; aParam.Value <<= OUString("*"); - lParams.push_back(css::uno::Any(aParam)); + lParams.emplace_back(aParam); } // open it diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx index 44a1be0f44a8..f2e1c07b061f 100644 --- a/comphelper/source/misc/profilezone.cxx +++ b/comphelper/source/misc/profilezone.cxx @@ -49,8 +49,7 @@ long long addRecording(const char * aProfileId, long long aCreateTime) if (!aProfileId) aProfileId = "(null)"; OUString aString(aProfileId, strlen(aProfileId), RTL_TEXTENCODING_UTF8); - g_aRecording.push_back( - OUString::number(osl_getThreadIdentifier(nullptr)) + " " + + g_aRecording.emplace_back(OUString::number(osl_getThreadIdentifier(nullptr)) + " " + OUString::number(aTime/1000000.0) + " " + aString + ": " + (aCreateTime == 0 ? OUString("start") : OUString("stop")) + (aCreateTime != 0 ? (" " + OUString::number((aTime - aCreateTime)/1000.0) + " ms") : OUString("")) diff --git a/comphelper/source/misc/servicedecl.cxx b/comphelper/source/misc/servicedecl.cxx index 787c3fefcb39..063587401434 100644 --- a/comphelper/source/misc/servicedecl.cxx +++ b/comphelper/source/misc/servicedecl.cxx @@ -118,8 +118,8 @@ uno::Sequence<OUString> ServiceDecl::getSupportedServiceNames() const sal_Int32 nIndex = 0; do { OString const token( str.getToken( 0, cDelim, nIndex ) ); - vec.push_back( OUString( token.getStr(), token.getLength(), - RTL_TEXTENCODING_ASCII_US ) ); + vec.emplace_back( token.getStr(), token.getLength(), + RTL_TEXTENCODING_ASCII_US ); } while (nIndex >= 0); diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 3eafb4bd9391..0557a3f95b4a 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -680,9 +680,8 @@ void SyntaxHighlighter::Tokenizer::getHighlightPortions(const OUString& rLine, // Loop over all the tokens while( getNextToken( pos, eType, pStartPos, pEndPos ) ) { - portions.push_back( - HighlightPortion( - pStartPos - rLine.getStr(), pEndPos - rLine.getStr(), eType)); + portions.emplace_back( + pStartPos - rLine.getStr(), pEndPos - rLine.getStr(), eType); } } diff --git a/comphelper/source/xml/attributelist.cxx b/comphelper/source/xml/attributelist.cxx index cf02d5c9bbf7..a3a22134220a 100644 --- a/comphelper/source/xml/attributelist.cxx +++ b/comphelper/source/xml/attributelist.cxx @@ -118,7 +118,7 @@ AttributeList::~AttributeList() void AttributeList::AddAttribute(const OUString &sName, const OUString &sType, const OUString &sValue) { - m_pImpl->vecAttribute.push_back( TagAttribute_Impl(sName, sType, sValue) ); + m_pImpl->vecAttribute.emplace_back(sName, sType, sValue ); } void AttributeList::Clear() |