[Libreoffice-commits] core.git: unotools/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 11 12:58:59 UTC 2021


 unotools/source/config/fltrcfg.cxx         |   19 +++----------------
 unotools/source/i18n/calendarwrapper.cxx   |   10 +++++-----
 unotools/source/i18n/localedatawrapper.cxx |   10 +++++-----
 unotools/source/misc/ZipPackageHelper.cxx  |    5 +----
 unotools/source/ucbhelper/ucbhelper.cxx    |    5 +----
 unotools/source/ucbhelper/ucblockbytes.cxx |    4 +---
 6 files changed, 16 insertions(+), 37 deletions(-)

New commits:
commit 39b8ce7081888b5d5e73ba0b49396b09ca7f3b61
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Fri Jun 11 12:30:29 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Jun 11 14:58:09 2021 +0200

    Simplify Sequences initializations (unotools)
    
    Change-Id: Ibc5deee4b69213310a75c2a74a800d99bc451424
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117047
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index c68ac827ee79..323cfe0c38ed 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -120,12 +120,7 @@ void SvtAppFilterOptions_Impl::Notify( const Sequence< OUString >&  )
 
 void    SvtAppFilterOptions_Impl::Load()
 {
-    Sequence<OUString> aNames(2);
-    OUString* pNames = aNames.getArray();
-    pNames[0] = "Load";
-    pNames[1] = "Save";
-
-    Sequence<Any> aValues = GetProperties(aNames);
+    Sequence<Any> aValues = GetProperties({ "Load", "Save" });
     const Any* pValues = aValues.getConstArray();
 
     if(pValues[0].hasValue())
@@ -165,11 +160,7 @@ void SvtWriterFilterOptions_Impl::ImplCommit()
 {
     SvtAppFilterOptions_Impl::ImplCommit();
 
-    Sequence<OUString> aNames { "Executable" };
-    Sequence<Any> aValues(1);
-    aValues[0] <<= bLoadExecutable;
-
-    PutProperties(aNames, aValues);
+    PutProperties({ "Executable" }, { Any(bLoadExecutable) });
 }
 
 void SvtWriterFilterOptions_Impl::Load()
@@ -215,11 +206,7 @@ void SvtCalcFilterOptions_Impl::ImplCommit()
 {
     SvtAppFilterOptions_Impl::ImplCommit();
 
-    Sequence<OUString> aNames { "Executable" };
-    Sequence<Any> aValues(1);
-    aValues[0] <<= bLoadExecutable;
-
-    PutProperties(aNames, aValues);
+    PutProperties({ "Executable" }, { Any(bLoadExecutable) });
 }
 
 void SvtCalcFilterOptions_Impl::Load()
diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx
index 5f4a1669bccf..7f0cc753a2c5 100644
--- a/unotools/source/i18n/calendarwrapper.cxx
+++ b/unotools/source/i18n/calendarwrapper.cxx
@@ -78,7 +78,7 @@ css::uno::Sequence< OUString > CalendarWrapper::getAllCalendars( const css::lang
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getAllCalendars" );
     }
 
-    return css::uno::Sequence< OUString > (0);
+    return {};
 }
 
 OUString CalendarWrapper::getUniqueID() const
@@ -247,7 +247,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getMonths() cons
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getMonths" );
     }
-    return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+    return {};
 }
 
 css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getDays() const
@@ -261,7 +261,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getDays() const
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getDays" );
     }
-    return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+    return {};
 }
 
 OUString CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const
@@ -321,7 +321,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getGenitiveMonth
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getGenitiveMonths" );
     }
-    return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+    return {};
 }
 
 css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getPartitiveMonths() const
@@ -335,7 +335,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getPartitiveMont
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getPartitiveMonths" );
     }
-    return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+    return {};
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 39e01f563392..2bb6769c51ed 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -169,7 +169,7 @@ void LocaleDataWrapper::loadData()
     catch (const Exception&)
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getDateAcceptancePatterns" );
-        aDateAcceptancePatterns = css::uno::Sequence< OUString >(0);
+        aDateAcceptancePatterns = {};
     }
 
 
@@ -182,7 +182,7 @@ void LocaleDataWrapper::loadData()
     catch ( const Exception& )
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getReservedWord" );
-        aReservedWordSeq = css::uno::Sequence< OUString >(0);
+        aReservedWordSeq = {};
     }
     for (int i=0; i < css::i18n::reservedWords::COUNT; ++i)
         aReservedWord[i] = aReservedWordSeq[i];
@@ -248,7 +248,7 @@ css::uno::Sequence< css::i18n::Currency2 > LocaleDataWrapper::getAllCurrencies()
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getAllCurrencies" );
     }
-    return css::uno::Sequence< css::i18n::Currency2 >(0);
+    return {};
 }
 
 css::uno::Sequence< css::i18n::FormatElement > LocaleDataWrapper::getAllFormats() const
@@ -261,7 +261,7 @@ css::uno::Sequence< css::i18n::FormatElement > LocaleDataWrapper::getAllFormats(
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getAllFormats" );
     }
-    return css::uno::Sequence< css::i18n::FormatElement >(0);
+    return {};
 }
 
 css::i18n::ForbiddenCharacters LocaleDataWrapper::getForbiddenCharacters() const
@@ -1557,7 +1557,7 @@ css::uno::Sequence< css::i18n::Calendar2 > LocaleDataWrapper::getAllCalendars()
     {
         TOOLS_WARN_EXCEPTION( "unotools.i18n", "getAllCalendars" );
     }
-    return css::uno::Sequence< css::i18n::Calendar2 >(0);
+    return {};
 }
 
 // --- XLocaleData4 ----------------------------------------------------------
diff --git a/unotools/source/misc/ZipPackageHelper.cxx b/unotools/source/misc/ZipPackageHelper.cxx
index d690e301540c..f543843890d2 100644
--- a/unotools/source/misc/ZipPackageHelper.cxx
+++ b/unotools/source/misc/ZipPackageHelper.cxx
@@ -102,10 +102,7 @@ Reference< XInterface > ZipPackageHelper::addFolder( Reference< XInterface > con
     if ( rName == ".." || rName == "." )
         throw lang::IllegalArgumentException();
 
-    Sequence< Any > aArgs(1);
-    aArgs[0] <<= true;
-
-    Reference< XInterface > xFolder( mxFactory->createInstanceWithArguments(aArgs) );
+    Reference< XInterface > xFolder( mxFactory->createInstanceWithArguments({ Any(true) } ));
     Reference< XNamed > xNamed( xFolder, UNO_QUERY );
     Reference< XChild > xChild( xFolder, UNO_QUERY );
 
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index 993cf8c8908f..f91fac4e921b 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -227,10 +227,7 @@ bool utl::UCBContentHelper::MakeFolder(
                 {
                     continue;
                 }
-                css::uno::Sequence<OUString> keys { "Title" };
-                css::uno::Sequence<css::uno::Any> values(1);
-                values[0] <<= title;
-                if (parent.insertNewContent(rInfo.Type, keys, values, result))
+                if (parent.insertNewContent(rInfo.Type, { "Title" }, { css::uno::Any(title) }, result))
                 {
                     return true;
                 }
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index a02652290b6a..d3e090cae679 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -740,13 +740,11 @@ static bool UCBOpenContentSync(
                     request <<= aExcep;
                     rtl::Reference<ucbhelper::InteractionRequest> xIR =
                         new ucbhelper::InteractionRequest(request);
-                    Sequence<Reference<XInteractionContinuation> > aSeq(2);
                     rtl::Reference<ucbhelper::InteractionRetry> retryP =
                         new ucbhelper::InteractionRetry(xIR.get());
-                    aSeq[0] = retryP;
                     rtl::Reference<ucbhelper::InteractionAbort> abortP =
                         new ucbhelper::InteractionAbort(xIR.get());
-                    aSeq[1] = abortP;
+                    Sequence<Reference<XInteractionContinuation> > aSeq { retryP, abortP };
 
                     xIR->setContinuations(aSeq);
                     xInteract->handle(xIR);


More information about the Libreoffice-commits mailing list