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

View File

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

View File

@@ -60,10 +60,7 @@ sal_Bool SAL_CALL Transliteration_body::equals(
Sequence< OUString > SAL_CALL Sequence< OUString > SAL_CALL
Transliteration_body::transliterateRange( const OUString& str1, const OUString& str2 ) Transliteration_body::transliterateRange( const OUString& str1, const OUString& str2 )
{ {
Sequence< OUString > ostr(2); return { str1, str2 };
ostr[0] = str1;
ostr[1] = str2;
return ostr;
} }
static MappingType lcl_getMappingTypeForToggleCase( MappingType nMappingType, sal_Unicode cChar ) 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()); OUString u2 = l2u->transliterateString2String(str2, 0, str2.getLength());
if ((l1 == u1) && (l2 == u2)) { if ((l1 == u1) && (l2 == u2)) {
Sequence< OUString > r(2); return { l1, l2 };
r[0] = l1;
r[1] = l2;
return r;
} else { } else {
Sequence< OUString > r(4); return { l1, l2, u1, u2 };
r[0] = l1;
r[1] = l2;
r[2] = u1;
r[3] = u2;
return r;
} }
} }

View File

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

View File

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

View File

@@ -3546,16 +3546,15 @@ bool DrawingML::WriteCustomGeometry(
if ( !aSegments.hasElements() ) if ( !aSegments.hasElements() )
{ {
aSegments = uno::Sequence<drawing::EnhancedCustomShapeSegment>(4); aSegments = uno::Sequence<drawing::EnhancedCustomShapeSegment>
aSegments[0].Count = 1; {
aSegments[0].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO; { drawing::EnhancedCustomShapeSegmentCommand::MOVETO, 1 },
aSegments[1].Count = static_cast<sal_Int16>(std::min( aPairs.getLength() - 1, sal_Int32(32767) )); { drawing::EnhancedCustomShapeSegmentCommand::LINETO,
aSegments[1].Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; static_cast<sal_Int16>(std::min( aPairs.getLength() - 1, sal_Int32(32767) )) },
aSegments[2].Count = 0; { drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH, 0 },
aSegments[2].Command = drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH; { drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH, 0 }
aSegments[3].Count = 0; };
aSegments[3].Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH; };
}
int nExpectedPairCount = std::accumulate(std::cbegin(aSegments), std::cend(aSegments), 0, int nExpectedPairCount = std::accumulate(std::cbegin(aSegments), std::cend(aSegments), 0,
[](const int nSum, const drawing::EnhancedCustomShapeSegment& rSegment) { return nSum + rSegment.Count; }); [](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 nA = aString.getToken(0, ',', index).toInt32();
sal_Int32 nB = aString.getToken(0, ',', index).toInt32(); sal_Int32 nB = aString.getToken(0, ',', index).toInt32();
sal_Int32 nC = aString.getToken(0, ',', index).toInt32(); sal_Int32 nC = aString.getToken(0, ',', index).toInt32();
css::uno::Sequence<double> aHSL(3); css::uno::Sequence<double> aHSL
aHSL[0] = nA * 360.0 / 255.0; {
aHSL[1] = nB / 255.0; nA * 360.0 / 255.0,
aHSL[2] = nC / 255.0; nB / 255.0,
nC / 255.0
};
rValue <<= aHSL; rValue <<= aHSL;
bRet = true; bRet = true;
} }

View File

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