diff options
25 files changed, 53 insertions, 22 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index d42f91038a42..46432c764698 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -267,7 +267,9 @@ void MissingPluginInstallerThread::execute() { details.swap(inst.currentDetails_); } std::vector<char *> args; - for (auto const & i: details) { + args.reserve(details.size()); + for (auto const& i : details) + { args.push_back(const_cast<char *>(i.getStr())); } args.push_back(nullptr); diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 326cac3f7d41..5a5755c251ad 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -723,7 +723,8 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData // data with labels std::vector< Reference< chart2::data::XLabeledDataSequence > > aDataVec; const sal_Int32 nCount = (bUseColumns ? m_aInternalData.getColumnCount() : m_aInternalData.getRowCount()); - for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx ) + aDataVec.reserve(nCount); + for (sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx) { aDataVec.push_back( new LabeledDataSequence( @@ -1308,7 +1309,8 @@ vector< vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector( const { vector< vector< uno::Any > > aRet; sal_Int32 nOuterCount = rIn.getLength(); - for( sal_Int32 nN=0; nN<nOuterCount; nN++) + aRet.reserve(nOuterCount); + for (sal_Int32 nN = 0; nN < nOuterCount; nN++) aRet.push_back( lcl_StringToAnyVector( rIn[nN] ) ); return aRet; } diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 80ca2af1c9ce..26c8e7e5c516 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -413,6 +413,7 @@ css::uno::Sequence< OUString > Access::getElementNames() checkLocalizedPropertyAccess(); std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); std::vector<OUString> names; + names.reserve(children.size()); for (auto const& child : children) { names.push_back(child->getNameInternal()); @@ -539,6 +540,7 @@ css::uno::Sequence< css::beans::Property > Access::getProperties() osl::MutexGuard g(*lock_); std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); std::vector< css::beans::Property > properties; + properties.reserve(children.size()); for (auto const& child : children) { properties.push_back(child->asProperty()); diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 6c72fb818e5e..f115faedc701 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -821,6 +821,7 @@ std::vector< OUString > SvxJavaParameterDlg::GetParameters() const { int nCount = m_xAssignedList->n_children(); std::vector< OUString > aParamList; + aParamList.reserve(nCount); for (int i = 0; i < nCount; ++i) aParamList.push_back(m_xAssignedList->get_text(i)); return aParamList; diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index 78957dc927bf..ef2fff811e8c 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -105,7 +105,8 @@ SvxCaptionTabPage::SvxCaptionTabPage(vcl::Window* pParent, const SfxItemSet& rIn ListBox *pLineTypes = get<ListBox>("linetypes"); assert(pLineTypes->GetEntryCount() == 3); std::vector<OUString> aLineTypes; - for (int i = 0; i < 3; ++i) + aLineTypes.reserve(3); + for (int i = 0; i < 3; ++i) aLineTypes.push_back(pLineTypes->GetEntry(i)); get(m_pFT_LENGTHFT, "lengthft"); diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index a1377168abf8..0745116b07ac 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -63,6 +63,7 @@ std::vector< OUString > translateExternalUris( std::vector< OUString > const & input) { std::vector< OUString > t; + t.reserve(input.size()); for (auto const& elem : input) { t.push_back(translateExternalUris(elem)); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 8ceaf58f3a31..c690ae401b2a 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -369,8 +369,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & else if (request >>= depExc) { std::vector< OUString > deps; - for (sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); - ++i) + deps.reserve(depExc.UnsatisfiedDependencies.getLength()); + for (sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i) { deps.push_back( dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]) ); diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 8a1622c44311..0c6a3a36f2ae 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -526,6 +526,7 @@ namespace pcr std::vector< OUString > aReturn; + aReturn.reserve(nElements); for (int i = 0; i < nElements; ++i) { aReturn.push_back(PcrRes(pStringItemsResId[i])); diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index e5f5cc3b80b5..0d931fbc0f66 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -989,7 +989,8 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css: css::uno::Sequence< OUString > lLocales = xCommand->getElementNames(); sal_Int32 nLocales = lLocales.getLength(); ::std::vector< OUString > aLocales; - for ( sal_Int32 j=0; j<nLocales; ++j ) + aLocales.reserve(nLocales); + for (sal_Int32 j = 0; j < nLocales; ++j) aLocales.push_back(lLocales[j]); OUString sLocale; diff --git a/framework/source/fwi/classes/converter.cxx b/framework/source/fwi/classes/converter.cxx index b25f35e797c6..33af820202c9 100644 --- a/framework/source/fwi/classes/converter.cxx +++ b/framework/source/fwi/classes/converter.cxx @@ -45,7 +45,8 @@ std::vector<OUString> Converter::convert_seqOUString2OUStringList( const css::un std::vector<OUString> lDestination; sal_Int32 nCount = lSource.getLength(); - for (sal_Int32 nItem=0; nItem<nCount; ++nItem ) + lDestination.reserve(nCount); + for (sal_Int32 nItem = 0; nItem < nCount; ++nItem) { lDestination.push_back(lSource[nItem]); } diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index e21de4970bec..1bf297d4589e 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -384,7 +384,8 @@ std::vector< LanguageType > sal_Int32 nCount = rLocaleSeq.getLength(); std::vector< LanguageType > aLangs; - for (sal_Int32 i = 0; i < nCount; ++i) + aLangs.reserve(nCount); + for (sal_Int32 i = 0; i < nCount; ++i) { aLangs.push_back( LinguLocaleToLanguage( pLocale[i] ) ); } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 0ceb4de7b766..0647d54c8d1e 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1553,7 +1553,8 @@ ScChart2DataProvider::createDataSource( //reorder labeled sequences according to aSequenceMapping ::std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqVector; - for (auto const & aSeq : aSeqs) + aSeqVector.reserve(aSeqs.size()); + for (auto const& aSeq : aSeqs) { aSeqVector.push_back(aSeq); } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 31d0b52ff2d3..e410959e8c50 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -701,6 +701,7 @@ std::vector<OUString> getCurrentParts(SdXImpressDocument* pDocument) int parts = pDocument->getParts(); std::vector<OUString> result; + result.reserve(parts); for (int i = 0; i < parts; i++) { result.push_back(pDocument->getPartName(i)); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 78dfda2cd53a..7fb8ffe696bb 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1138,7 +1138,9 @@ void SfxDocumentMetaData::init( css::uno::Reference<css::xml::dom::XNodeList> nodes = xPath->selectNodeList(m_xParent, "child::" + name); std::vector<css::uno::Reference<css::xml::dom::XNode> > v; - for (sal_Int32 i = 0; i < nodes->getLength(); ++i) { + v.reserve(nodes->getLength()); + for (sal_Int32 i = 0; i < nodes->getLength(); ++i) + { v.push_back(nodes->item(i)); } m_metaList[name] = v; diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 68db4a793265..86d546462f7a 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -711,7 +711,8 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) m_xContext); const std::vector<OUString> & props = aJvm.getProperties(); std::vector<OUString> options; - for (auto const & i: props) + options.reserve(props.size()); + for (auto const& i : props) { options.push_back(i.startsWith("-") ? i : "-D" + i); } diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index ac520ccc58d3..0c20d6b5d0bc 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -313,7 +313,9 @@ void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue) { osl::MutexGuard guard(registry_->mutex_); std::vector< sal_Int32 > list; - for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.reserve(seqValue.getLength()); + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) + { list.push_back(seqValue[i]); } RegError err = key_.setLongListValue( @@ -613,7 +615,9 @@ void Key::setStringListValue( { osl::MutexGuard guard(registry_->mutex_); std::vector< sal_Unicode * > list; - for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.reserve(seqValue.getLength()); + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) + { list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr())); } RegError err = key_.setUnicodeListValue( diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 28960c0a6731..fe93fbc3d349 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -78,7 +78,8 @@ static std::vector< LanguageType > lcl_LocaleSeqToLangSeq( Sequence< css::lang:: sal_Int32 nCount = rSeq.getLength(); std::vector< LanguageType > aLangs; - for (sal_Int32 i = 0; i < nCount; ++i) + aLangs.reserve(nCount); + for (sal_Int32 i = 0; i < nCount; ++i) { aLangs.push_back( LanguageTag::convertToLanguageType( pLocale[i] ) ); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index bfe91b5268b8..bde1c7236b46 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -595,6 +595,7 @@ namespace // get logic selection getOutlinerView().GetSelectionRectangles(aLogicRects); + aLogicRanges.reserve(aLogicRects.size()); for (const auto& aRect : aLogicRects) { // convert from logic Rectangles to logic Ranges, do not forget to add diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index a61ce3fbc79d..6f68c8611241 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -3111,7 +3111,8 @@ uno::Sequence<uno::Any> SvxShape::getPropertyDefaults( const uno::Sequence<OUString>& aPropertyNames ) { ::std::vector<uno::Any> ret; - for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos ) + ret.reserve(aPropertyNames.getLength()); + for (sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos) ret.push_back( getPropertyDefault( aPropertyNames[pos] ) ); return uno::Sequence<uno::Any>( &ret[0], ret.size() ); } diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index d6eefe4b4cd6..12855877550c 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -94,7 +94,8 @@ void SwChangeDBDlg::FillDBPopup() Sequence< OUString > aDBNames = xDBContext->getElementNames(); const OUString* pDBNames = aDBNames.getConstArray(); sal_Int32 nDBCount = aDBNames.getLength(); - for(sal_Int32 i = 0; i < nDBCount; i++) + aAllDBNames.reserve(nDBCount); + for (sal_Int32 i = 0; i < nDBCount; i++) { aAllDBNames.push_back(pDBNames[i]); } diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 8a6524490692..9cdba0b23534 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -518,8 +518,9 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) ::FillCharStyleListBox(*rCharFormatLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) - aList.push_back( rCharFormatLB->GetEntry(j) ); + aList.reserve(rCharFormatLB->GetEntryCount()); + for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) + aList.push_back(rCharFormatLB->GetEntry(j)); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; FieldUnit eMetric = ::GetDfltMetric(dynamic_cast< const SwWebDocShell *>( pDocShell ) != nullptr); diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index c3eaedb5b7e9..b127062e75bf 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -931,8 +931,9 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) ::FillCharStyleListBox(*rCharFormatLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) - aList.push_back( rCharFormatLB->GetEntry(j) ); + aList.reserve(rCharFormatLB->GetEntryCount()); + for (sal_Int32 j = 0; j < rCharFormatLB->GetEntryCount(); j++) + aList.push_back(rCharFormatLB->GetEntry(j)); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 0ead1d8e76ce..871886b238d0 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -490,7 +490,8 @@ void SvtDynamicMenuOptions_Impl::impl_SortAndExpandPropertyNames( const Sequence lDestination.realloc( (nSourceCount*PROPERTYCOUNT)+nDestinationStep ); // get enough memory for copy operations after nDestination ... // Copy all items to temp. vector to use fast sort operations :-) - for( sal_Int32 nSourceStep=0; nSourceStep<nSourceCount; ++nSourceStep ) + lTemp.reserve(nSourceCount); + for (sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep) lTemp.push_back( lSource[nSourceStep] ); // Sort all entries by number ... diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 4763519a1b46..a2fb4527b709 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -375,6 +375,7 @@ void StyleSheetTable_Impl::SetPropertiesToDefault(const uno::Reference<style::XS uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); uno::Sequence<beans::Property> aProperties = xPropertySetInfo->getProperties(); std::vector<OUString> aPropertyNames; + aPropertyNames.reserve(aProperties.getLength()); for (sal_Int32 i = 0; i < aProperties.getLength(); ++i) { aPropertyNames.push_back(aProperties[i].Name); diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index e338b008eeba..e97733fe2208 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -678,6 +678,7 @@ css::uno::Reference< css::security::XCertificate > DocumentDigitalSignatures::ch auto xCert = chooseCertificatesImpl( aProperties, UserAction::Sign )[0]; std::vector<css::beans::PropertyValue> vec; + vec.reserve(aProperties.size()); for (const auto& pair : aProperties) { vec.emplace_back(comphelper::makePropertyValue(pair.first, pair.second)); |