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>
This commit is contained in:
Julien Nabet 2021-06-11 15:44:56 +02:00
parent 513b54df70
commit b49fce18d0
8 changed files with 43 additions and 51 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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]) } );
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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,

View File

@ -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,