summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-11 11:29:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-11 13:50:50 +0200
commit7ca4ea54b4d610104df1b88ae5b04c2081a4a429 (patch)
treeca6be37362fcdf1368b087fd3787f17745326801
parent59010ca14ba07f0a1d6f662bb1f8fbad33f3c654 (diff)
clang-tidy modernize-use-emplace in hwpfilter..lotuswordpro
Change-Id: Ic11634ca28396fd156390c511087bae03bd5fb70 Reviewed-on: https://gerrit.libreoffice.org/42156 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--hwpfilter/source/attributes.cxx2
-rw-r--r--i18nlangtag/source/isolang/isolang.cxx6
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx80
-rw-r--r--idlc/source/astinterface.cxx3
-rw-r--r--idlc/source/idlccompile.cxx8
-rw-r--r--idlc/source/options.cxx4
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx9
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx2
-rw-r--r--jvmfwk/source/framework.cxx3
-rw-r--r--libreofficekit/qa/tilebench/tilebench.cxx32
-rw-r--r--lotuswordpro/source/filter/lwpbulletstylemgr.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xftextspan.cxx2
14 files changed, 77 insertions, 80 deletions
diff --git a/hwpfilter/source/attributes.cxx b/hwpfilter/source/attributes.cxx
index a59850e51fca..e8da00ec2592 100644
--- a/hwpfilter/source/attributes.cxx
+++ b/hwpfilter/source/attributes.cxx
@@ -139,7 +139,7 @@ void AttributeListImpl::addAttribute( const OUString &sName ,
const OUString &sType ,
const OUString &sValue )
{
- m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) );
+ m_pImpl->vecAttribute.emplace_back( sName , sType , sValue );
}
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index cee528e5ebde..232f05c652dd 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -1488,17 +1488,17 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
for (const Bcp47CountryEntry* pEntry = aImplBcp47CountryEntries;
pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
- aVec.push_back( LanguagetagMapping( pEntry->getTagString(), pEntry->mnLang));
+ aVec.emplace_back( pEntry->getTagString(), pEntry->mnLang);
}
for (const IsoLanguageScriptCountryEntry* pEntry = aImplIsoLangScriptEntries;
pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
- aVec.push_back( LanguagetagMapping( pEntry->getTagString(), pEntry->mnLang));
+ aVec.emplace_back( pEntry->getTagString(), pEntry->mnLang);
}
for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
- aVec.push_back( LanguagetagMapping( pEntry->getTagString(), pEntry->mnLang));
+ aVec.emplace_back( pEntry->getTagString(), pEntry->mnLang);
}
return aVec;
}
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index eecb7f42985d..684364ff1c81 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -2149,15 +2149,15 @@ LanguageTag & LanguageTag::makeFallback()
if (!aCountry.isEmpty())
{
if (bIncludeFullBcp47)
- aVec.push_back( aLanguage + "-" + aCountry);
+ aVec.emplace_back(aLanguage + "-" + aCountry);
if (aLanguage == "zh")
{
// For zh-HK or zh-MO also list zh-TW, for all other zh-XX also
// list zh-CN.
if (aCountry == "HK" || aCountry == "MO")
- aVec.push_back( aLanguage + "-TW");
+ aVec.emplace_back(aLanguage + "-TW");
else if (aCountry != "CN")
- aVec.push_back( aLanguage + "-CN");
+ aVec.emplace_back(aLanguage + "-CN");
aVec.push_back( aLanguage);
}
else if (aLanguage == "sh")
@@ -2165,11 +2165,11 @@ LanguageTag & LanguageTag::makeFallback()
// Manual list instead of calling
// LanguageTag( "sr-Latn-" + aCountry).getFallbackStrings( true)
// that would also include "sh-*" again.
- aVec.push_back( "sr-Latn-" + aCountry);
- aVec.push_back( "sr-Latn");
- aVec.push_back( "sh"); // legacy with script, before default script with country
- aVec.push_back( "sr-" + aCountry);
- aVec.push_back( "sr");
+ aVec.emplace_back("sr-Latn-" + aCountry);
+ aVec.emplace_back("sr-Latn");
+ aVec.emplace_back("sh"); // legacy with script, before default script with country
+ aVec.emplace_back("sr-" + aCountry);
+ aVec.emplace_back("sr");
}
else if (aLanguage == "ca" && aCountry == "XV")
{
@@ -2181,29 +2181,29 @@ LanguageTag & LanguageTag::makeFallback()
{
if (aCountry == "TR" || aCountry == "SY")
{
- aVec.push_back( "kmr-Latn-" + aCountry);
- aVec.push_back( "kmr-" + aCountry);
- aVec.push_back( "kmr-Latn");
- aVec.push_back( "kmr");
+ aVec.emplace_back("kmr-Latn-" + aCountry);
+ aVec.emplace_back("kmr-" + aCountry);
+ aVec.emplace_back("kmr-Latn");
+ aVec.emplace_back("kmr");
aVec.push_back( aLanguage);
}
else if (aCountry == "IQ" || aCountry == "IR")
{
- aVec.push_back( "ckb-" + aCountry);
- aVec.push_back( "ckb");
+ aVec.emplace_back("ckb-" + aCountry);
+ aVec.emplace_back("ckb");
}
}
else if (aLanguage == "kmr" && (aCountry == "TR" || aCountry == "SY"))
{
- aVec.push_back( "ku-Latn-" + aCountry);
- aVec.push_back( "ku-" + aCountry);
+ aVec.emplace_back("ku-Latn-" + aCountry);
+ aVec.emplace_back("ku-" + aCountry);
aVec.push_back( aLanguage);
- aVec.push_back( "ku");
+ aVec.emplace_back("ku");
}
else if (aLanguage == "ckb" && (aCountry == "IQ" || aCountry == "IR"))
{
- aVec.push_back( "ku-Arab-" + aCountry);
- aVec.push_back( "ku-" + aCountry);
+ aVec.emplace_back("ku-Arab-" + aCountry);
+ aVec.emplace_back("ku-" + aCountry);
aVec.push_back( aLanguage);
// not 'ku' only, that was used for Latin script
}
@@ -2216,14 +2216,14 @@ LanguageTag & LanguageTag::makeFallback()
aVec.push_back( aLanguage);
if (aLanguage == "sh")
{
- aVec.push_back( "sr-Latn");
- aVec.push_back( "sr");
+ aVec.emplace_back("sr-Latn");
+ aVec.emplace_back("sr");
}
else if (aLanguage == "pli")
{
// a special case for Pali dictionary, see fdo#41599
- aVec.push_back( "pi-Latn");
- aVec.push_back( "pi");
+ aVec.emplace_back("pi-Latn");
+ aVec.emplace_back("pi");
}
}
return aVec;
@@ -2237,9 +2237,9 @@ LanguageTag & LanguageTag::makeFallback()
// in fallbacks in a sensible order.
/* TODO: could such things be generalized and automated with liblangtag? */
if (maBcp47 == "en-GB-oed")
- aVec.push_back( "en-GB-oxendict");
+ aVec.emplace_back("en-GB-oxendict");
else if (maBcp47 == "en-GB-oxendict")
- aVec.push_back( "en-GB-oed");
+ aVec.emplace_back("en-GB-oed");
OUString aScript;
OUString aVariants( getVariants());
@@ -2270,17 +2270,17 @@ LanguageTag & LanguageTag::makeFallback()
// sr-Latn-CS => sr-Latn-YU, sh-CS, sh-YU
if (aCountry == "CS")
{
- aVec.push_back( "sr-Latn-YU");
- aVec.push_back( "sh-CS");
- aVec.push_back( "sh-YU");
+ aVec.emplace_back("sr-Latn-YU");
+ aVec.emplace_back("sh-CS");
+ aVec.emplace_back("sh-YU");
}
else
- aVec.push_back( "sh-" + aCountry);
+ aVec.emplace_back("sh-" + aCountry);
}
else if (aLanguage == "pi" && aScript == "Latn")
- aVec.push_back( "pli"); // a special case for Pali dictionary, see fdo#41599
+ aVec.emplace_back("pli"); // a special case for Pali dictionary, see fdo#41599
else if (aLanguage == "krm" && aScript == "Latn" && (aCountry == "TR" || aCountry == "SY"))
- aVec.push_back( "ku-" + aCountry);
+ aVec.emplace_back("ku-" + aCountry);
}
if (!aVariants.isEmpty() && !bHaveLanguageScriptVariant)
{
@@ -2295,12 +2295,12 @@ LanguageTag & LanguageTag::makeFallback()
// 'sh' actually denoted a script, so have it here instead of appended
// at the end as language-only.
if (aLanguage == "sr" && aScript == "Latn")
- aVec.push_back( "sh");
+ aVec.emplace_back("sh");
else if (aLanguage == "ku" && aScript == "Arab")
- aVec.push_back( "ckb");
+ aVec.emplace_back("ckb");
// 'ku' only denoted Latin script
else if (aLanguage == "krm" && aScript == "Latn" && aCountry.isEmpty())
- aVec.push_back( "ku");
+ aVec.emplace_back("ku");
}
bool bHaveLanguageVariant = false;
if (!aCountry.isEmpty())
@@ -2311,7 +2311,7 @@ LanguageTag & LanguageTag::makeFallback()
if (aTmp != maBcp47)
aVec.push_back( aTmp);
if (maBcp47 == "ca-ES-valencia")
- aVec.push_back( "ca-XV");
+ aVec.emplace_back("ca-XV");
// Language with variant but without country before language
// without variant but with country.
// But only if variant is not from a grandfathered tag that
@@ -2348,7 +2348,7 @@ LanguageTag & LanguageTag::makeFallback()
if (!aCountry.isEmpty())
{
if (aLanguage == "sr" && aCountry == "CS")
- aVec.push_back( "sr-YU");
+ aVec.emplace_back("sr-YU");
}
// Original language-only.
@@ -2584,14 +2584,14 @@ LanguageTagImpl::Extraction LanguageTagImpl::simpleExtract( const OUString& rBcp
::std::vector< OUString > aFallbacks( LanguageTag( rReference).getFallbackStrings( false));
if (rReference != "en-US")
{
- aFallbacks.push_back( "en-US");
+ aFallbacks.emplace_back("en-US");
if (rReference != "en")
- aFallbacks.push_back( "en");
+ aFallbacks.emplace_back("en");
}
if (rReference != "x-default")
- aFallbacks.push_back( "x-default");
+ aFallbacks.emplace_back("x-default");
if (rReference != "x-no-translate")
- aFallbacks.push_back( "x-no-translate");
+ aFallbacks.emplace_back("x-no-translate");
/* TODO: the original comphelper::Locale::getFallback() code had
* "x-notranslate" instead of "x-no-translate", but all .xcu files use
* "x-no-translate" and "x-notranslate" apparently was never used anywhere.
diff --git a/idlc/source/astinterface.cxx b/idlc/source/astinterface.cxx
index 8fc4ed0f992c..e8dd63b12b1c 100644
--- a/idlc/source/astinterface.cxx
+++ b/idlc/source/astinterface.cxx
@@ -58,8 +58,7 @@ AstInterface::DoubleDeclarations AstInterface::checkInheritedInterfaceClashes(
void AstInterface::addInheritedInterface(
AstType const * ifc, bool optional, OUString const & documentation)
{
- m_inheritedInterfaces.push_back(
- InheritedInterface(ifc, optional, documentation));
+ m_inheritedInterfaces.emplace_back(ifc, optional, documentation);
if (!optional) {
++m_mandatoryInterfaces;
}
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 03b9a517f9e3..9c53e634300e 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -236,9 +236,9 @@ sal_Int32 compileFile(const OString * pathname)
idlc()->setRealFileName(tmpFile);
::std::vector< OUString> lCppArgs;
- lCppArgs.push_back("-DIDL");
- lCppArgs.push_back("-C");
- lCppArgs.push_back("-zI");
+ lCppArgs.emplace_back("-DIDL");
+ lCppArgs.emplace_back("-C");
+ lCppArgs.emplace_back("-zI");
OStringBuffer cppArgs(256);
Options* pOptions = idlc()->getOptions();
@@ -284,7 +284,7 @@ sal_Int32 compileFile(const OString * pathname)
} while( nIndex != -1 );
}
- lCppArgs.push_back(OUString("-o"));
+ lCppArgs.emplace_back("-o");
cppArgs.append(preprocFile);
lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index be907232ca1b..b183c2bf6889 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -101,14 +101,14 @@ bool Options::checkArgument (std::vector< std::string > & rArgs, char const * ar
}
default:
// "-<option>" ([long] option, w/o param)
- rArgs.push_back(std::string(arg, len));
+ rArgs.emplace_back(arg, len);
break;
}
}
break;
default:
// "<param>"
- rArgs.push_back(std::string(arg, len));
+ rArgs.emplace_back(arg, len);
break;
}
}
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 457c613f7db6..b435aa846669 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -721,7 +721,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
// JNI_CreateJavaVM. This happens when the LD_LIBRARY_PATH does not contain
// all some directories of the Java installation. This is necessary for
// all versions below 1.5.1
- options.push_back(Option("abort", reinterpret_cast<void*>(abort_handler)));
+ options.emplace_back("abort", reinterpret_cast<void*>(abort_handler));
bool hasStackSize = false;
for (int i = 0; i < cOptions; i++)
{
@@ -742,10 +742,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
if (opt.startsWith("-Xss")) {
hasStackSize = true;
}
- options.push_back(Option(opt, arOptions[i].extraInfo));
+ options.emplace_back(opt, arOptions[i].extraInfo);
}
if (addForceInterpreted) {
- options.push_back(Option("-Xint", nullptr));
+ options.emplace_back("-Xint", nullptr);
}
if (!hasStackSize) {
#if defined LINUX && (defined X86 || defined X86_64)
@@ -771,8 +771,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
"jfw", "huge RLIMIT_STACK " << l.rlim_cur << " -> 8192K");
l.rlim_cur = 8192 * 1024;
}
- options.push_back(
- Option("-Xss" + OString::number(l.rlim_cur), nullptr));
+ options.emplace_back("-Xss" + OString::number(l.rlim_cur), nullptr);
} else {
int e = errno;
SAL_WARN("jfw", "getrlimit(RLIMIT_STACK) failed with errno " << e);
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index f01c38c45cf1..798fae528bb6 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -524,7 +524,7 @@ bool getJavaProps(const OUString & exePath,
}
#endif
- props.push_back(std::make_pair(sKey, sVal));
+ props.emplace_back(sKey, sVal);
}
if (rs != FileHandleReader::RESULT_ERROR && !props.empty())
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 4fe4d48ccff3..c03a3cac30e3 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -349,8 +349,7 @@ javaFrameworkError jfw_findAndSelectJRE(std::unique_ptr<JavaInfo> *pInfo)
jfw::VersionInfo versionInfo =
aVendorSettings.getVersionInformation(vendor);
- versionInfos.push_back(
- std::pair<OUString, jfw::VersionInfo>(vendor, versionInfo));
+ versionInfos.emplace_back(vendor, versionInfo);
}
std::vector<rtl::Reference<jfw_plugin::VendorBase>> infos;
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index b4912b1611ef..686523211a3b 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -55,22 +55,22 @@ int main( int argc, char* argv[] )
return 1;
}
- aTimes.push_back(TimeRecord("initialization"));
+ aTimes.emplace_back("initialization");
// coverity[tainted_string] - build time test tool
Office *pOffice = lok_cpp_init(argv[1]);
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
if (argv[2] != nullptr)
{
- aTimes.push_back(TimeRecord("load document"));
+ aTimes.emplace_back("load document");
Document *pDocument(pOffice->documentLoad(argv[2]));
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
- aTimes.push_back(TimeRecord("getparts"));
+ aTimes.emplace_back("getparts");
int nParts = pDocument->getParts();
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
- aTimes.push_back(TimeRecord("get size of parts"));
+ aTimes.emplace_back("get size of parts");
for (int nPart = 0; nPart < nParts; nPart++)
{
char* pName = pDocument->getPartName(nPart);
@@ -80,7 +80,7 @@ int main( int argc, char* argv[] )
fprintf (stderr, " '%s' -> %ld, %ld\n", pName, nWidth, nHeight);
free (pName);
}
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
unsigned char pPixels[256*256*4];
for (int nPart = 0; nPart < nParts; nPart++)
@@ -95,14 +95,14 @@ int main( int argc, char* argv[] )
pDocument->getDocumentSize(&nWidth, &nHeight);
{ // whole document
- aTimes.push_back(TimeRecord("render whole document"));
+ aTimes.emplace_back("render whole document");
pDocument->paintTile(pPixels, 256, 256,
0, 0, nWidth, nHeight); // not square
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
{ // 1:1
- aTimes.push_back(TimeRecord("render sub-region at 1:1"));
+ aTimes.emplace_back("render sub-region at 1:1");
int nTiles = 0;
int nSplit = nWidth / 4;
for (int nX = 0; nX < 4; nX++)
@@ -118,11 +118,11 @@ int main( int argc, char* argv[] )
nTiles, nTilePosX, nTilePosY);
}
}
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
{ // scaled
- aTimes.push_back(TimeRecord("render sub-regions at scale"));
+ aTimes.emplace_back("render sub-regions at scale");
int nTiles = 0;
int nSplit = nWidth / 4;
for (int nX = 0; nX < 4; nX++)
@@ -138,13 +138,13 @@ int main( int argc, char* argv[] )
nTiles, nTilePosX, nTilePosY);
}
}
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
}
- aTimes.push_back(TimeRecord("destroy document"));
+ aTimes.emplace_back("destroy document");
delete pDocument;
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
delete pOffice;
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index 1e6861680e85..38a5f5b92fd2 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -141,7 +141,7 @@ OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOverrid
}
}
- m_vIDsPairList.push_back(std::make_pair(pBulletOver, aIndentID));
+ m_vIDsPairList.emplace_back(pBulletOver, aIndentID);
OUString aStyleName;
LwpFribPtr& rBulletParaFribs = pBulletPara->GetFribs();
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 97b034a32e6c..55db2b3fb73c 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -661,7 +661,7 @@ void LwpGraphicObject::CreateGrafObject()
}
// insert image object into array
- m_vXFDrawObjects.push_back(pImage.get());
+ m_vXFDrawObjects.emplace_back(pImage.get());
}
diff --git a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
index 7608da24307f..e2b1f58bdfa4 100644
--- a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
@@ -70,7 +70,7 @@ XFContentContainer::~XFContentContainer()
void XFContentContainer::Add(XFContent *pContent)
{
- m_aContents.push_back(pContent);
+ m_aContents.emplace_back(pContent);
}
void XFContentContainer::Add(const OUString& text)
diff --git a/lotuswordpro/source/filter/xfilter/xftextspan.cxx b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
index 90f6e32aa569..05427d6dde6d 100644
--- a/lotuswordpro/source/filter/xfilter/xftextspan.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
@@ -86,7 +86,7 @@ enumXFContent XFTextSpan::GetContentType()
void XFTextSpan::Add(XFContent *pContent)
{
- m_aContents.push_back(pContent);
+ m_aContents.emplace_back(pContent);
}
void XFTextSpan::Add(const OUString& text)