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; utils::KeyStopLerp maKeyStops;
static std::vector<double> getTestVector() static std::vector<double> getTestVector() { return { 0.1, 0.5, 0.9 }; }
{
std::vector<double> aStops(3);
aStops[0] = 0.1;
aStops[1] = 0.5;
aStops[2] = 0.9;
return aStops;
}
public: public:
KeyStopLerpTest() KeyStopLerpTest()

View File

@@ -56,9 +56,7 @@ struct lcl_NumberedStringGenerator
} }
vector< uno::Any > operator()() vector< uno::Any > operator()()
{ {
vector< uno::Any > aRet(1); return { uno::Any(m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter ))) };
aRet[0] <<= m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::number( ++m_nCounter ));
return aRet;
} }
private: private:
OUString m_aStub; OUString m_aStub;

View File

@@ -369,9 +369,7 @@ InternalDataProvider::InternalDataProvider(
aNewCategories.reserve( nLength ); aNewCategories.reserve( nLength );
for( sal_Int32 nN=0; nN<nLength; nN++) for( sal_Int32 nN=0; nN<nLength; nN++)
{ {
vector< uno::Any > aVector(1); aNewCategories.push_back( { uno::Any(aSimplecategories[nN]) } );
aVector[0] <<= aSimplecategories[nN];
aNewCategories.push_back( aVector );
} }
} }
} }

View File

@@ -1251,9 +1251,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getSchemas( )
std::vector< std::vector<Any> > vec; std::vector< std::vector<Any> > vec;
while( rs->next() ) while( rs->next() )
{ {
std::vector<Any> row(1); vec.push_back( { Any(xRow->getString(1)) } );
row[0] <<= xRow->getString(1);
vec.push_back( row );
} }
// sort public first, sort internal schemas last, sort rest in alphabetic order // 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. // Merge into one span.
// The original two spans are ordered from top to bottom. // The original two spans are ordered from top to bottom.
std::vector<SCROW> aRows(2); std::vector<SCROW> aRows { std::min( rNewSharedRows[0], nTopRow), std::max( rNewSharedRows[3], nBotRow) };
aRows[0] = std::min( rNewSharedRows[0], nTopRow);
aRows[1] = std::max( rNewSharedRows[3], nBotRow);
rNewSharedRows.swap( aRows); rNewSharedRows.swap( aRows);
} }
else else

View File

@@ -22,6 +22,7 @@
#include <utility> #include <utility>
#include <filter/msfilter/util.hxx> #include <filter/msfilter/util.hxx>
#include <o3tl/safeint.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/random.h> #include <rtl/random.h>
@@ -490,26 +491,29 @@ void XclExpBiff8Encrypter::GetDocId( sal_uInt8 pnDocId[16] ) const
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData ) void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData )
{ {
vector<sal_uInt8> aByte(1); vector<sal_uInt8> aByte { nData };
aByte[0] = nData;
EncryptBytes(rStrm, aByte); EncryptBytes(rStrm, aByte);
} }
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16 nData ) void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16 nData )
{ {
::std::vector<sal_uInt8> pnBytes(2); ::std::vector<sal_uInt8> pnBytes
pnBytes[0] = nData & 0xFF; {
pnBytes[1] = (nData >> 8) & 0xFF; o3tl::narrowing<sal_uInt8>(nData & 0xFF),
o3tl::narrowing<sal_uInt8>((nData >> 8) & 0xFF)
};
EncryptBytes(rStrm, pnBytes); EncryptBytes(rStrm, pnBytes);
} }
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData ) void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData )
{ {
::std::vector<sal_uInt8> pnBytes(4); ::std::vector<sal_uInt8> pnBytes
pnBytes[0] = nData & 0xFF; {
pnBytes[1] = (nData >> 8) & 0xFF; o3tl::narrowing<sal_uInt8>(nData & 0xFF),
pnBytes[2] = (nData >> 16) & 0xFF; o3tl::narrowing<sal_uInt8>((nData >> 8) & 0xFF),
pnBytes[3] = (nData >> 24) & 0xFF; o3tl::narrowing<sal_uInt8>((nData >> 16) & 0xFF),
o3tl::narrowing<sal_uInt8>((nData >> 24) & 0xFF)
};
EncryptBytes(rStrm, pnBytes); EncryptBytes(rStrm, pnBytes);
} }

View File

@@ -663,13 +663,15 @@ void PresenterScreen::ProcessLayout (
"Layout"), "Layout"),
UNO_QUERY_THROW); UNO_QUERY_THROW);
::std::vector<OUString> aProperties (6); ::std::vector<OUString> aProperties
aProperties[0] = "PaneURL"; {
aProperties[1] = "ViewURL"; "PaneURL",
aProperties[2] = "RelativeX"; "ViewURL",
aProperties[3] = "RelativeY"; "RelativeX",
aProperties[4] = "RelativeWidth"; "RelativeY",
aProperties[5] = "RelativeHeight"; "RelativeWidth",
"RelativeHeight"
};
PresenterConfigurationAccess::ForAll( PresenterConfigurationAccess::ForAll(
xList, xList,
aProperties, aProperties,
@@ -692,11 +694,13 @@ void PresenterScreen::ProcessViewDescriptions (
rConfiguration.GetConfigurationNode("Presenter/Views"), rConfiguration.GetConfigurationNode("Presenter/Views"),
UNO_QUERY_THROW); UNO_QUERY_THROW);
::std::vector<OUString> aProperties (4); ::std::vector<OUString> aProperties
aProperties[0] = "ViewURL"; {
aProperties[1] = "Title"; "ViewURL",
aProperties[2] = "AccessibleTitle"; "Title",
aProperties[3] = "IsOpaque"; "AccessibleTitle",
"IsOpaque"
};
PresenterConfigurationAccess::ForAll( PresenterConfigurationAccess::ForAll(
xViewDescriptionsNode, xViewDescriptionsNode,
aProperties, aProperties,

View File

@@ -52,12 +52,13 @@ public:
vector<sal_Int32> ToVector() vector<sal_Int32> ToVector()
{ {
vector<sal_Int32> aSequence (4); return
aSequence[0] = mnLeft == mnInvalidValue ? 0 : mnLeft; {
aSequence[1] = mnTop == mnInvalidValue ? 0 : mnTop; mnLeft == mnInvalidValue ? 0 : mnLeft,
aSequence[2] = mnRight == mnInvalidValue ? 0 : mnRight; mnTop == mnInvalidValue ? 0 : mnTop,
aSequence[3] = mnBottom == mnInvalidValue ? 0 : mnBottom; mnRight == mnInvalidValue ? 0 : mnRight,
return aSequence; mnBottom == mnInvalidValue ? 0 : mnBottom
};
}; };
void Merge (const BorderSize& rBorderSize) void Merge (const BorderSize& rBorderSize)
@@ -1034,9 +1035,7 @@ void StyleAssociationContainer::Read (
if (!xStyleAssociationList.is()) if (!xStyleAssociationList.is())
return; return;
::std::vector<OUString> aProperties (2); ::std::vector<OUString> aProperties { "ResourceURL", "StyleName" };
aProperties[0] = "ResourceURL";
aProperties[1] = "StyleName";
PresenterConfigurationAccess::ForAll( PresenterConfigurationAccess::ForAll(
xStyleAssociationList, xStyleAssociationList,
aProperties, aProperties,