Simplify Sequences initializations (i*->p*)

Change-Id: I6bf0eaa2233de2487d90a2f9ae7de263b4ddf1bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116865
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2021-06-08 21:39:34 +02:00
parent 07a09195ad
commit 7af40a4455
9 changed files with 44 additions and 87 deletions

View File

@@ -784,8 +784,7 @@ LocaleDataImpl::getAllCalendars2( const Locale& rLocale )
return calendarsSeq;
}
else {
Sequence< Calendar2 > seq1(0);
return seq1;
return {};
}
}
@@ -828,8 +827,7 @@ LocaleDataImpl::getAllCurrencies2( const Locale& rLocale )
return seq;
}
else {
Sequence< Currency2 > seq1(0);
return seq1;
return {};
}
}
@@ -910,8 +908,7 @@ LocaleDataImpl::getDateAcceptancePatterns( const Locale& rLocale )
}
else
{
Sequence< OUString > seq(0);
return seq;
return {};
}
}
@@ -954,8 +951,7 @@ LocaleDataImpl::getCollatorImplementations( const Locale& rLocale )
return seq;
}
else {
Sequence< Implementation > seq1(0);
return seq1;
return {};
}
}
@@ -974,8 +970,7 @@ LocaleDataImpl::getCollationOptions( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
}
@@ -994,8 +989,7 @@ LocaleDataImpl::getSearchOptions( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
}
@@ -1023,8 +1017,7 @@ LocaleDataImpl::getIndexAlgorithm( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
}
@@ -1108,8 +1101,7 @@ LocaleDataImpl::getUnicodeScripts( const Locale& rLocale )
return seq;
}
else {
Sequence< UnicodeScript > seq1(0);
return seq1;
return {};
}
}
@@ -1128,8 +1120,7 @@ LocaleDataImpl::getFollowPageWords( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
}
@@ -1150,8 +1141,7 @@ LocaleDataImpl::getTransliterations( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
@@ -1229,8 +1219,7 @@ LocaleDataImpl::getBreakIteratorRules( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
}
@@ -1251,8 +1240,7 @@ LocaleDataImpl::getReservedWord( const Locale& rLocale )
return seq;
}
else {
Sequence< OUString > seq1(0);
return seq1;
return {};
}
}
@@ -1427,8 +1415,7 @@ LocaleDataImpl::getOutlineNumberingLevels( const lang::Locale& rLocale )
return aRet;
}
else {
Sequence< Reference<container::XIndexAccess> > seq1(0);
return seq1;
return {};
}
}

View File

@@ -66,10 +66,7 @@ transliteration_Ignore::transliterateRange( const OUString& str1, const OUString
if (str1.isEmpty() || str2.isEmpty())
throw RuntimeException();
Sequence< OUString > r(2);
r[0] = str1.copy(0, 1);
r[1] = str2.copy(0, 1);
return r;
return { str1.copy(0, 1), str2.copy(0, 1) };
}
@@ -103,18 +100,9 @@ transliteration_Ignore::transliterateRange( const OUString& str1, const OUString
OUString s22 = t2.transliterate( str2, 0, 1, offset );
if ( (s11 == s21) && (s12 == s22) ) {
Sequence< OUString > r(2);
r[0] = s11;
r[1] = s12;
return r;
return { s11, s12 };
}
Sequence< OUString > r(4);
r[0] = s11;
r[1] = s12;
r[2] = s21;
r[3] = s22;
return r;
return { s11, s12, s21, s22 };
}
OUString

View File

@@ -60,10 +60,7 @@ sal_Bool SAL_CALL Transliteration_body::equals(
Sequence< OUString > SAL_CALL
Transliteration_body::transliterateRange( const OUString& str1, const OUString& str2 )
{
Sequence< OUString > ostr(2);
ostr[0] = str1;
ostr[1] = str2;
return ostr;
return { str1, str2 };
}
static MappingType lcl_getMappingTypeForToggleCase( MappingType nMappingType, sal_Unicode cChar )

View File

@@ -73,17 +73,9 @@ Transliteration_caseignore::transliterateRange( const OUString& str1, const OUSt
OUString u2 = l2u->transliterateString2String(str2, 0, str2.getLength());
if ((l1 == u1) && (l2 == u2)) {
Sequence< OUString > r(2);
r[0] = l1;
r[1] = l2;
return r;
return { l1, l2 };
} else {
Sequence< OUString > r(4);
r[0] = l1;
r[1] = l2;
r[2] = u1;
r[3] = u2;
return r;
return { l1, l2, u1, u2 };
}
}

View File

@@ -1151,8 +1151,6 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
{
::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
uno::Sequence< OUString > aRes(1);
OUString aImplName; // there is only one grammar checker per language
LanguageType nLang = LinguLocaleToLanguage( rLocale );
GCImplNames_t::const_iterator aIt( m_aGCImplNamesByLang.find( nLang ) );
@@ -1160,11 +1158,8 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
aImplName = aIt->second;
if (!aImplName.isEmpty())
aRes[0] = aImplName;
else
aRes.realloc(0);
return aRes;
return { aImplName };
return {};
}

View File

@@ -476,8 +476,7 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
// Reset TabStops - these would be auto calculated by Impress
TabStop aTabStop;
aTabStop.Position = 0;
Sequence< TabStop > aSeq(1);
aSeq[0] = aTabStop;
Sequence< TabStop > aSeq { aTabStop };
aPropSet.setProperty( PROP_ParaTabStops, aSeq );
}
}

View File

@@ -3546,16 +3546,15 @@ bool DrawingML::WriteCustomGeometry(
if ( !aSegments.hasElements() )
{
aSegments = uno::Sequence<drawing::EnhancedCustomShapeSegment>(4);
aSegments[0].Count = 1;
aSegments[0].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
aSegments[1].Count = static_cast<sal_Int16>(std::min( aPairs.getLength() - 1, sal_Int32(32767) ));
aSegments[1].Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
aSegments[2].Count = 0;
aSegments[2].Command = drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
aSegments[3].Count = 0;
aSegments[3].Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
}
aSegments = uno::Sequence<drawing::EnhancedCustomShapeSegment>
{
{ drawing::EnhancedCustomShapeSegmentCommand::MOVETO, 1 },
{ drawing::EnhancedCustomShapeSegmentCommand::LINETO,
static_cast<sal_Int16>(std::min( aPairs.getLength() - 1, sal_Int32(32767) )) },
{ drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH, 0 },
{ drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH, 0 }
};
};
int nExpectedPairCount = std::accumulate(std::cbegin(aSegments), std::cend(aSegments), 0,
[](const int nSum, const drawing::EnhancedCustomShapeSegment& rSegment) { return nSum + rSegment.Count; });

View File

@@ -302,10 +302,12 @@ namespace oox::ppt {
sal_Int32 nA = aString.getToken(0, ',', index).toInt32();
sal_Int32 nB = aString.getToken(0, ',', index).toInt32();
sal_Int32 nC = aString.getToken(0, ',', index).toInt32();
css::uno::Sequence<double> aHSL(3);
aHSL[0] = nA * 360.0 / 255.0;
aHSL[1] = nB / 255.0;
aHSL[2] = nC / 255.0;
css::uno::Sequence<double> aHSL
{
nA * 360.0 / 255.0,
nB / 255.0,
nC / 255.0
};
rValue <<= aHSL;
bRet = true;
}

View File

@@ -1090,16 +1090,14 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno:
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
// Add default entries, the count must be updated manually when appending.
uno::Sequence< beans::StringPair > aDefaultsSequence(4);
// Add at least the standard default entries.
aDefaultsSequence[0].First = "xml";
aDefaultsSequence[0].Second= "application/xml";
aDefaultsSequence[1].First = "rels";
aDefaultsSequence[1].Second= "application/vnd.openxmlformats-package.relationships+xml";
aDefaultsSequence[2].First = "png";
aDefaultsSequence[2].Second= "image/png";
aDefaultsSequence[3].First = "jpeg";
aDefaultsSequence[3].Second= "image/jpeg";
uno::Sequence< beans::StringPair > aDefaultsSequence
{
{ "xml", "application/xml" },
{ "rels", "application/vnd.openxmlformats-package.relationships+xml" },
{ "png", "image/png" },
{ "jpeg", "image/jpeg" }
};
uno::Sequence< beans::StringPair > aOverridesSequence(aManList.size());
sal_Int32 nOverSeqLength = 0;