summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-11 15:44:56 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-06-11 18:12:48 +0200
commitb49fce18d0b05a8b5f462ba9bf6c84f0bb107d93 (patch)
tree5467d582e25cba593d89f22835fe0f8f2f697c12
parent513b54df70b5b9cde8d6ca2304378949256eea1d (diff)
Simplify vector initializations
Change-Id: Icf8972be204799e9b3b3824ab18d8584911fe1c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117061 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--basegfx/test/basegfxtools.cxx9
-rw-r--r--chart2/source/tools/InternalData.cxx4
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx4
-rw-r--r--sc/source/core/data/column3.cxx4
-rw-r--r--sc/source/filter/excel/xestream.cxx24
-rw-r--r--sdext/source/presenter/PresenterScreen.cxx28
-rw-r--r--sdext/source/presenter/PresenterTheme.cxx17
8 files changed, 43 insertions, 51 deletions
diff --git a/basegfx/test/basegfxtools.cxx b/basegfx/test/basegfxtools.cxx
index a768357c13a5..9c6075919333 100644
--- a/basegfx/test/basegfxtools.cxx
+++ b/basegfx/test/basegfxtools.cxx
@@ -32,14 +32,7 @@ class KeyStopLerpTest : public CppUnit::TestFixture
{
utils::KeyStopLerp maKeyStops;
- static std::vector<double> getTestVector()
- {
- std::vector<double> aStops(3);
- aStops[0] = 0.1;
- aStops[1] = 0.5;
- aStops[2] = 0.9;
- return aStops;
- }
+ static std::vector<double> getTestVector() { return { 0.1, 0.5, 0.9 }; }
public:
KeyStopLerpTest()
diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx
index c5f9490f01f7..35c615fe2873 100644
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -56,9 +56,7 @@ struct lcl_NumberedStringGenerator
}
vector< uno::Any > operator()()
{
- vector< uno::Any > aRet(1);
- aRet[0] <<= m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter ));
- return aRet;
+ return { uno::Any(m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter ))) };
}
private:
OUString m_aStub;
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 9595cf2375d7..e9beeb6d1d41 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -369,9 +369,7 @@ InternalDataProvider::InternalDataProvider(
aNewCategories.reserve( nLength );
for( sal_Int32 nN=0; nN<nLength; nN++)
{
- vector< uno::Any > aVector(1);
- aVector[0] <<= aSimplecategories[nN];
- aNewCategories.push_back( aVector );
+ aNewCategories.push_back( { uno::Any(aSimplecategories[nN]) } );
}
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 07e0e85815c1..8f2021608830 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -1251,9 +1251,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getSchemas( )
std::vector< std::vector<Any> > vec;
while( rs->next() )
{
- std::vector<Any> row(1);
- row[0] <<= xRow->getString(1);
- vec.push_back( row );
+ vec.push_back( { Any(xRow->getString(1)) } );
}
// sort public first, sort internal schemas last, sort rest in alphabetic order
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 365cba4d8489..73a2ed613548 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -723,9 +723,7 @@ void ScColumn::AttachNewFormulaCells( const sc::CellStoreType::position_type& aP
{
// Merge into one span.
// The original two spans are ordered from top to bottom.
- std::vector<SCROW> aRows(2);
- aRows[0] = std::min( rNewSharedRows[0], nTopRow);
- aRows[1] = std::max( rNewSharedRows[3], nBotRow);
+ std::vector<SCROW> aRows { std::min( rNewSharedRows[0], nTopRow), std::max( rNewSharedRows[3], nBotRow) };
rNewSharedRows.swap( aRows);
}
else
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 6c79d99469f1..ac63d34414b5 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -22,6 +22,7 @@
#include <utility>
#include <filter/msfilter/util.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/random.h>
@@ -490,26 +491,29 @@ void XclExpBiff8Encrypter::GetDocId( sal_uInt8 pnDocId[16] ) const
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData )
{
- vector<sal_uInt8> aByte(1);
- aByte[0] = nData;
+ vector<sal_uInt8> aByte { nData };
EncryptBytes(rStrm, aByte);
}
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16 nData )
{
- ::std::vector<sal_uInt8> pnBytes(2);
- pnBytes[0] = nData & 0xFF;
- pnBytes[1] = (nData >> 8) & 0xFF;
+ ::std::vector<sal_uInt8> pnBytes
+ {
+ o3tl::narrowing<sal_uInt8>(nData & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 8) & 0xFF)
+ };
EncryptBytes(rStrm, pnBytes);
}
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData )
{
- ::std::vector<sal_uInt8> pnBytes(4);
- pnBytes[0] = nData & 0xFF;
- pnBytes[1] = (nData >> 8) & 0xFF;
- pnBytes[2] = (nData >> 16) & 0xFF;
- pnBytes[3] = (nData >> 24) & 0xFF;
+ ::std::vector<sal_uInt8> pnBytes
+ {
+ o3tl::narrowing<sal_uInt8>(nData & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 8) & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 16) & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 24) & 0xFF)
+ };
EncryptBytes(rStrm, pnBytes);
}
diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx
index 30f1864e8aed..c624adcdf614 100644
--- a/sdext/source/presenter/PresenterScreen.cxx
+++ b/sdext/source/presenter/PresenterScreen.cxx
@@ -663,13 +663,15 @@ void PresenterScreen::ProcessLayout (
"Layout"),
UNO_QUERY_THROW);
- ::std::vector<OUString> aProperties (6);
- aProperties[0] = "PaneURL";
- aProperties[1] = "ViewURL";
- aProperties[2] = "RelativeX";
- aProperties[3] = "RelativeY";
- aProperties[4] = "RelativeWidth";
- aProperties[5] = "RelativeHeight";
+ ::std::vector<OUString> aProperties
+ {
+ "PaneURL",
+ "ViewURL",
+ "RelativeX",
+ "RelativeY",
+ "RelativeWidth",
+ "RelativeHeight"
+ };
PresenterConfigurationAccess::ForAll(
xList,
aProperties,
@@ -692,11 +694,13 @@ void PresenterScreen::ProcessViewDescriptions (
rConfiguration.GetConfigurationNode("Presenter/Views"),
UNO_QUERY_THROW);
- ::std::vector<OUString> aProperties (4);
- aProperties[0] = "ViewURL";
- aProperties[1] = "Title";
- aProperties[2] = "AccessibleTitle";
- aProperties[3] = "IsOpaque";
+ ::std::vector<OUString> aProperties
+ {
+ "ViewURL",
+ "Title",
+ "AccessibleTitle",
+ "IsOpaque"
+ };
PresenterConfigurationAccess::ForAll(
xViewDescriptionsNode,
aProperties,
diff --git a/sdext/source/presenter/PresenterTheme.cxx b/sdext/source/presenter/PresenterTheme.cxx
index 52c2d875d4ef..bf911dd970c4 100644
--- a/sdext/source/presenter/PresenterTheme.cxx
+++ b/sdext/source/presenter/PresenterTheme.cxx
@@ -52,12 +52,13 @@ public:
vector<sal_Int32> ToVector()
{
- vector<sal_Int32> aSequence (4);
- aSequence[0] = mnLeft == mnInvalidValue ? 0 : mnLeft;
- aSequence[1] = mnTop == mnInvalidValue ? 0 : mnTop;
- aSequence[2] = mnRight == mnInvalidValue ? 0 : mnRight;
- aSequence[3] = mnBottom == mnInvalidValue ? 0 : mnBottom;
- return aSequence;
+ return
+ {
+ mnLeft == mnInvalidValue ? 0 : mnLeft,
+ mnTop == mnInvalidValue ? 0 : mnTop,
+ mnRight == mnInvalidValue ? 0 : mnRight,
+ mnBottom == mnInvalidValue ? 0 : mnBottom
+ };
};
void Merge (const BorderSize& rBorderSize)
@@ -1034,9 +1035,7 @@ void StyleAssociationContainer::Read (
if (!xStyleAssociationList.is())
return;
- ::std::vector<OUString> aProperties (2);
- aProperties[0] = "ResourceURL";
- aProperties[1] = "StyleName";
+ ::std::vector<OUString> aProperties { "ResourceURL", "StyleName" };
PresenterConfigurationAccess::ForAll(
xStyleAssociationList,
aProperties,