[Libreoffice-commits] core.git: 2 commits - unoxml/source vcl/qt5 vcl/source vcl/unx

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 18 08:18:32 UTC 2019


 unoxml/source/dom/documentbuilder.cxx      |   15 ++-------------
 unoxml/source/dom/saxbuilder.cxx           |   15 ++-------------
 unoxml/source/xpath/xpathapi.cxx           |   15 ++-------------
 vcl/qt5/Qt5DragAndDrop.cxx                 |    6 ++----
 vcl/qt5/Qt5FilePicker.cxx                  |    7 ++-----
 vcl/source/components/dtranscomp.cxx       |    4 ++--
 vcl/source/uitest/uno/uiobject_uno.cxx     |    4 +---
 vcl/source/uitest/uno/uitest_uno.cxx       |    4 +---
 vcl/unx/generic/dtrans/X11_service.cxx     |    9 +++------
 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx |    7 ++-----
 vcl/unx/kf5/KF5FilePicker.cxx              |    8 ++------
 11 files changed, 21 insertions(+), 73 deletions(-)

New commits:
commit b49f189d9bfb0b5dca5ac259e6f56b49c2d0d08f
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun Aug 18 09:29:27 2019 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Sun Aug 18 10:17:36 2019 +0200

    tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctor
    
    in vcl
    
    Change-Id: Ibd66e5ed9064612b73d08fac179ee46dc5b0a4b6
    Reviewed-on: https://gerrit.libreoffice.org/77656
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/qt5/Qt5DragAndDrop.cxx b/vcl/qt5/Qt5DragAndDrop.cxx
index 2b674e5a8e4f..ea26d5aaeb6f 100644
--- a/vcl/qt5/Qt5DragAndDrop.cxx
+++ b/vcl/qt5/Qt5DragAndDrop.cxx
@@ -120,8 +120,7 @@ sal_Bool SAL_CALL Qt5DragSource::supportsService(OUString const& ServiceName)
 
 css::uno::Sequence<OUString> SAL_CALL Qt5DragSource::getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.Qt5DragSource" };
-    return aRet;
+    return { "com.sun.star.datatransfer.dnd.Qt5DragSource" };
 }
 
 Qt5DropTarget::Qt5DropTarget()
@@ -144,8 +143,7 @@ sal_Bool SAL_CALL Qt5DropTarget::supportsService(OUString const& ServiceName)
 
 css::uno::Sequence<OUString> SAL_CALL Qt5DropTarget::getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet{ "com.sun.star.datatransfer.dnd.Qt5DropTarget" };
-    return aRet;
+    return { "com.sun.star.datatransfer.dnd.Qt5DropTarget" };
 }
 
 Qt5DropTarget::~Qt5DropTarget()
diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index 602ee21569ee..1573f95dd6b5 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -70,11 +70,8 @@ namespace
 {
 uno::Sequence<OUString> FilePicker_getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet(3);
-    aRet[0] = "com.sun.star.ui.dialogs.FilePicker";
-    aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker";
-    aRet[2] = "com.sun.star.ui.dialogs.Qt5FilePicker";
-    return aRet;
+    return { "com.sun.star.ui.dialogs.FilePicker", "com.sun.star.ui.dialogs.SystemFilePicker",
+             "com.sun.star.ui.dialogs.Qt5FilePicker" };
 }
 }
 
diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx
index 2952eff97012..0b2245bbd2f0 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -405,9 +405,9 @@ void GenericDropTarget::setDefaultActions( sal_Int8)
 Sequence< OUString > DropTarget_getSupportedServiceNames()
 {
 #if defined MACOSX
-    return Sequence< OUString > {  "com.sun.star.datatransfer.dnd.OleDropTarget" };
+    return {  "com.sun.star.datatransfer.dnd.OleDropTarget" };
 #elif defined UNX
-    return Sequence< OUString > { "com.sun.star.datatransfer.dnd.X11DropTarget" };
+    return { "com.sun.star.datatransfer.dnd.X11DropTarget" };
 #else
     return GenericDropTarget::getSupportedServiceNames_static();
 #endif
diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx
index 714f16a72dbc..5eaef4db584a 100644
--- a/vcl/source/uitest/uno/uiobject_uno.cxx
+++ b/vcl/source/uitest/uno/uiobject_uno.cxx
@@ -197,9 +197,7 @@ sal_Bool UIObjectUnoObj::supportsService(OUString const & ServiceName)
 
 css::uno::Sequence<OUString> UIObjectUnoObj::getSupportedServiceNames()
 {
-    css::uno::Sequence<OUString> aServiceNames(1);
-    aServiceNames[0] = "com.sun.star.ui.test.UIObject";
-    return aServiceNames;
+    return { "com.sun.star.ui.test.UIObject" };
 }
 
 OUString SAL_CALL UIObjectUnoObj::getHierarchy()
diff --git a/vcl/source/uitest/uno/uitest_uno.cxx b/vcl/source/uitest/uno/uitest_uno.cxx
index 354b30585c69..8ae3b7e284a1 100644
--- a/vcl/source/uitest/uno/uitest_uno.cxx
+++ b/vcl/source/uitest/uno/uitest_uno.cxx
@@ -107,9 +107,7 @@ sal_Bool UITestUnoObj::supportsService(OUString const & ServiceName)
 
 css::uno::Sequence<OUString> UITestUnoObj::getSupportedServiceNames()
 {
-    css::uno::Sequence<OUString> aServiceNames(1);
-    aServiceNames[0] = "com.sun.star.ui.test.UITest";
-    return aServiceNames;
+    return { "com.sun.star.ui.test.UITest" };
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx
index 8020b677017f..dc08d85e6099 100644
--- a/vcl/unx/generic/dtrans/X11_service.cxx
+++ b/vcl/unx/generic/dtrans/X11_service.cxx
@@ -37,20 +37,17 @@ using namespace x11;
 
 Sequence< OUString > x11::X11Clipboard_getSupportedServiceNames()
 {
-    Sequence< OUString > aRet { "com.sun.star.datatransfer.clipboard.SystemClipboard" };
-    return aRet;
+    return { "com.sun.star.datatransfer.clipboard.SystemClipboard" };
 }
 
 Sequence< OUString > x11::Xdnd_getSupportedServiceNames()
 {
-    Sequence< OUString > aRet { "com.sun.star.datatransfer.dnd.X11DragSource" };
-    return aRet;
+    return { "com.sun.star.datatransfer.dnd.X11DragSource" };
 }
 
 Sequence< OUString > x11::Xdnd_dropTarget_getSupportedServiceNames()
 {
-    Sequence< OUString > aRet { "com.sun.star.datatransfer.dnd.X11DropTarget" };
-    return aRet;
+    return { "com.sun.star.datatransfer.dnd.X11DropTarget" };
 }
 
 css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequence< Any >& arguments )
diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx
index 8fbd2fc5385b..68c31d9561ad 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx
@@ -60,11 +60,8 @@ namespace
 {
 uno::Sequence<OUString> FilePicker_getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet(3);
-    aRet[0] = "com.sun.star.ui.dialogs.FilePicker";
-    aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker";
-    aRet[2] = "com.sun.star.ui.dialogs.Gtk3KDE5FilePicker";
-    return aRet;
+    return { "com.sun.star.ui.dialogs.FilePicker", "com.sun.star.ui.dialogs.SystemFilePicker",
+             "com.sun.star.ui.dialogs.Gtk3KDE5FilePicker" };
 }
 }
 
diff --git a/vcl/unx/kf5/KF5FilePicker.cxx b/vcl/unx/kf5/KF5FilePicker.cxx
index 451824a12f13..b269c893c60f 100644
--- a/vcl/unx/kf5/KF5FilePicker.cxx
+++ b/vcl/unx/kf5/KF5FilePicker.cxx
@@ -38,12 +38,8 @@ namespace
 {
 uno::Sequence<OUString> FilePicker_getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet(4);
-    aRet[0] = "com.sun.star.ui.dialogs.FilePicker";
-    aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker";
-    aRet[2] = "com.sun.star.ui.dialogs.KF5FilePicker";
-    aRet[3] = "com.sun.star.ui.dialogs.KF5FolderPicker";
-    return aRet;
+    return { "com.sun.star.ui.dialogs.FilePicker", "com.sun.star.ui.dialogs.SystemFilePicker",
+             "com.sun.star.ui.dialogs.KF5FilePicker", "com.sun.star.ui.dialogs.KF5FolderPicker" };
 }
 }
 
commit a8df5fbaa478fd7f01b2f04a82b4eb63d0dbcc15
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun Aug 18 09:18:01 2019 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Sun Aug 18 10:17:29 2019 +0200

    Simplify code in unoxml about initializations
    
    Change-Id: I7bc1d82d70f26b1cb7289b87a52e1f59fb740817
    Reviewed-on: https://gerrit.libreoffice.org/77655
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx
index 3b5082ae8774..5a03cf0bcf2d 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -102,24 +102,13 @@ namespace DOM
         return static_cast< XDocumentBuilder* >(new CDocumentBuilder);
     }
 
-    static const char aImplementationName[] = "com.sun.star.comp.xml.dom.DocumentBuilder";
-    static const char* aSupportedServiceNames[] = {
-        "com.sun.star.xml.dom.DocumentBuilder",
-        nullptr
-    };
-
     OUString CDocumentBuilder::_getImplementationName()
     {
-        return aImplementationName;
+        return "com.sun.star.comp.xml.dom.DocumentBuilder";
     }
     Sequence<OUString> CDocumentBuilder::_getSupportedServiceNames()
     {
-        Sequence<OUString> aSequence;
-        for (int i=0; aSupportedServiceNames[i]!=nullptr; i++) {
-            aSequence.realloc(i+1);
-            aSequence[i] = OUString::createFromAscii(aSupportedServiceNames[i]);
-        }
-        return aSequence;
+        return { "com.sun.star.xml.dom.DocumentBuilder" };
     }
 
     Sequence< OUString > SAL_CALL CDocumentBuilder::getSupportedServiceNames()
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index 00db5396da64..688ec9c215cc 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -38,12 +38,6 @@ namespace DOM
         return static_cast< XSAXDocumentBuilder* >(new CSAXDocumentBuilder(rSMgr));
     }
 
-    static const char aImplementationName[] = "com.sun.star.comp.xml.dom.SAXDocumentBuilder";
-    static const char* aSupportedServiceNames[] = {
-        "com.sun.star.xml.dom.SAXDocumentBuilder",
-        nullptr
-    };
-
     CSAXDocumentBuilder::CSAXDocumentBuilder(const Reference< XMultiServiceFactory >& mgr)
         : m_aServiceManager(mgr)
         , m_aState( SAXDocumentBuilderState_READY)
@@ -51,16 +45,11 @@ namespace DOM
 
     OUString CSAXDocumentBuilder::_getImplementationName()
     {
-        return aImplementationName;
+        return "com.sun.star.comp.xml.dom.SAXDocumentBuilder";
     }
     Sequence<OUString> CSAXDocumentBuilder::_getSupportedServiceNames()
     {
-        Sequence<OUString> aSequence;
-        for (int i=0; aSupportedServiceNames[i]!=nullptr; i++) {
-            aSequence.realloc(i+1);
-            aSequence[i] = OUString::createFromAscii(aSupportedServiceNames[i]);
-        }
-        return aSequence;
+        return { "com.sun.star.xml.dom.SAXDocumentBuilder" };
     }
 
     Sequence< OUString > SAL_CALL CSAXDocumentBuilder::getSupportedServiceNames()
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index 334cd19f18cd..491be8cab0b7 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -59,25 +59,14 @@ namespace XPath
     {
     }
 
-    static const char aImplementationName[] = "com.sun.star.comp.xml.xpath.XPathAPI";
-    static const char* aSupportedServiceNames[] = {
-        "com.sun.star.xml.xpath.XPathAPI",
-        nullptr
-    };
-
     OUString CXPathAPI::_getImplementationName()
     {
-        return aImplementationName;
+        return "com.sun.star.comp.xml.xpath.XPathAPI";
     }
 
     Sequence<OUString> CXPathAPI::_getSupportedServiceNames()
     {
-        Sequence<OUString> aSequence;
-        for (int i=0; aSupportedServiceNames[i]!=nullptr; i++) {
-            aSequence.realloc(i+1);
-            aSequence[i] = OUString::createFromAscii(aSupportedServiceNames[i]);
-        }
-        return aSequence;
+        return { "com.sun.star.xml.xpath.XPathAPI" };
     }
 
     Sequence< OUString > SAL_CALL CXPathAPI::getSupportedServiceNames()


More information about the Libreoffice-commits mailing list