summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-08 21:39:34 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-06-09 10:49:26 +0200
commit7af40a445551a07c6918f835da20ca461a6bd4ee (patch)
tree3f6816c85dd0e4008dc022e6e0a37079d7590881
parent07a09195adc65722207390e355a202100bc608ff (diff)
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>
-rw-r--r--i18npool/source/localedata/localedata.cxx39
-rw-r--r--i18npool/source/transliteration/transliteration_Ignore.cxx18
-rw-r--r--i18npool/source/transliteration/transliteration_body.cxx5
-rw-r--r--i18npool/source/transliteration/transliteration_caseignore.cxx12
-rw-r--r--linguistic/source/gciterator.cxx9
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx3
-rw-r--r--oox/source/export/drawingml.cxx19
-rw-r--r--oox/source/ppt/pptfilterhelpers.cxx10
-rw-r--r--package/source/zippackage/ZipPackage.cxx16
9 files changed, 44 insertions, 87 deletions
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 0f3b03a2689a..33da5647adc3 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -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 {};
}
}
diff --git a/i18npool/source/transliteration/transliteration_Ignore.cxx b/i18npool/source/transliteration/transliteration_Ignore.cxx
index 946e2979b0da..c3faeb11ed0f 100644
--- a/i18npool/source/transliteration/transliteration_Ignore.cxx
+++ b/i18npool/source/transliteration/transliteration_Ignore.cxx
@@ -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
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index f873c33374ce..f77fdea155e5 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -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 )
diff --git a/i18npool/source/transliteration/transliteration_caseignore.cxx b/i18npool/source/transliteration/transliteration_caseignore.cxx
index 61db2286e714..dcd7b3b94be7 100644
--- a/i18npool/source/transliteration/transliteration_caseignore.cxx
+++ b/i18npool/source/transliteration/transliteration_caseignore.cxx
@@ -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 };
}
}
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 692fa31353cb..70257b32d96c 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -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 {};
}
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 197f0e51f28a..70f1ac0c937b 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -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 );
}
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 4d2212b2d50f..385af08d590b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -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; });
diff --git a/oox/source/ppt/pptfilterhelpers.cxx b/oox/source/ppt/pptfilterhelpers.cxx
index 295628adc712..23aae31c2212 100644
--- a/oox/source/ppt/pptfilterhelpers.cxx
+++ b/oox/source/ppt/pptfilterhelpers.cxx
@@ -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;
}
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index c31697f24184..6afba83a49e5 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -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;