[Libreoffice-commits] core.git: dbaccess/source editeng/source extensions/source filter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 06:34:22 UTC 2018


 dbaccess/source/filter/xml/xmlDataSourceSetting.cxx  |   21 +++----
 dbaccess/source/filter/xml/xmlservices.cxx           |    9 +--
 dbaccess/source/ui/misc/dsmeta.cxx                   |   18 +++---
 dbaccess/source/ui/misc/uiservices.cxx               |    9 +--
 editeng/source/misc/svxacorr.cxx                     |   11 +--
 extensions/source/bibliography/bibconfig.cxx         |   23 +++----
 extensions/source/dbpilots/dbpservices.cxx           |    9 +--
 extensions/source/propctrlr/pcrservices.cxx          |    9 +--
 filter/source/graphicfilter/ipict/ipict.cxx          |   14 ++--
 filter/source/msfilter/msvbahelper.cxx               |    9 +--
 filter/source/msfilter/util.cxx                      |   37 +++++-------
 filter/source/xsltdialog/xmlfiltercommon.hxx         |    2 
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx |   56 +++++++------------
 filter/source/xsltdialog/xmlfiltertabpagebasic.cxx   |   14 ++--
 14 files changed, 116 insertions(+), 125 deletions(-)

New commits:
commit 2e6a38b7f007b36719f5fc002cb4363dec45e0d4
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 21 11:47:47 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 22 07:33:56 2018 +0100

    improve function-local statics in dbaccess..filter
    
    Change-Id: I64939ad4b6c53696e33300114db384abfe73f13f
    Reviewed-on: https://gerrit.libreoffice.org/63702
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
index 107cbe700390..e5defb425a0e 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx
@@ -70,18 +70,19 @@ OXMLDataSourceSetting::OXMLDataSourceSetting( ODBFilter& rImport
             case XML_TOK_DATA_SOURCE_SETTING_TYPE:
                 {
                     // needs to be translated into a css::uno::Type
-                    static std::map< OUString, css::uno::Type > s_aTypeNameMap;
-                    if (s_aTypeNameMap.empty())
+                    static std::map< OUString, css::uno::Type > s_aTypeNameMap = [&]()
                     {
-                        s_aTypeNameMap[GetXMLToken( XML_BOOLEAN)]   = cppu::UnoType<bool>::get();
+                        std::map< OUString, css::uno::Type > tmp;
+                        tmp[GetXMLToken( XML_BOOLEAN)]   = cppu::UnoType<bool>::get();
                         // Not a copy paste error, see comment xmloff/source/forms/propertyimport.cxx lines 244-248
-                        s_aTypeNameMap[GetXMLToken( XML_FLOAT)]     = ::cppu::UnoType<double>::get();
-                        s_aTypeNameMap[GetXMLToken( XML_DOUBLE)]    = ::cppu::UnoType<double>::get();
-                        s_aTypeNameMap[GetXMLToken( XML_STRING)]    = ::cppu::UnoType<OUString>::get();
-                        s_aTypeNameMap[GetXMLToken( XML_INT)]       = ::cppu::UnoType<sal_Int32>::get();
-                        s_aTypeNameMap[GetXMLToken( XML_SHORT)]     = ::cppu::UnoType<sal_Int16>::get();
-                        s_aTypeNameMap[GetXMLToken( XML_VOID)]      = cppu::UnoType<void>::get();
-                    }
+                        tmp[GetXMLToken( XML_FLOAT)]     = ::cppu::UnoType<double>::get();
+                        tmp[GetXMLToken( XML_DOUBLE)]    = ::cppu::UnoType<double>::get();
+                        tmp[GetXMLToken( XML_STRING)]    = ::cppu::UnoType<OUString>::get();
+                        tmp[GetXMLToken( XML_INT)]       = ::cppu::UnoType<sal_Int32>::get();
+                        tmp[GetXMLToken( XML_SHORT)]     = ::cppu::UnoType<sal_Int16>::get();
+                        tmp[GetXMLToken( XML_VOID)]      = cppu::UnoType<void>::get();
+                        return tmp;
+                    }();
 
                     const std::map< OUString, css::uno::Type >::const_iterator aTypePos = s_aTypeNameMap.find(sValue);
                     OSL_ENSURE(s_aTypeNameMap.end() != aTypePos, "OXMLDataSourceSetting::OXMLDataSourceSetting: invalid type!");
diff --git a/dbaccess/source/filter/xml/xmlservices.cxx b/dbaccess/source/filter/xml/xmlservices.cxx
index 3e52d0ac4fca..5db99d191ab8 100644
--- a/dbaccess/source/filter/xml/xmlservices.cxx
+++ b/dbaccess/source/filter/xml/xmlservices.cxx
@@ -20,6 +20,7 @@
 #include <cppuhelper/factory.hxx>
 #include <flt_reghelper.hxx>
 #include "xmlservices.hxx"
+#include <mutex>
 
 using namespace ::dbaxml;
 using namespace ::com::sun::star::uno;
@@ -30,8 +31,8 @@ extern "C" {
 
 static void createRegistryInfo_dbaxml()
 {
-    static bool bInit = false;
-    if (!bInit)
+    static std::once_flag aInit;
+    std::call_once(aInit, [&]()
     {
         createRegistryInfo_DBTypeDetection();
         createRegistryInfo_ODBFilter();
@@ -39,8 +40,8 @@ static void createRegistryInfo_dbaxml()
         createRegistryInfo_OSettingsExport();
         createRegistryInfo_OFullExport();
         createRegistryInfo_DBContentLoader2();
-        bInit = true;
-    }
+        return true;
+    });
 }
 
 }
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 4d2246bb21c0..82ccab986fd6 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -87,9 +87,9 @@ namespace dbaui
     static const FeatureSet& lcl_getFeatureSet( const OUString& _rURL )
     {
         typedef std::map< OUString, FeatureSet > FeatureSets;
-        static FeatureSets s_aFeatureSets;
-        if ( s_aFeatureSets.empty() )
+        static FeatureSets s_aFeatureSets = [&]()
         {
+            FeatureSets tmp;
             ::connectivity::DriversConfig aDriverConfig( ::comphelper::getProcessComponentContext() );
             const uno::Sequence< OUString > aPatterns = aDriverConfig.getURLs();
             for ( auto const & pattern : aPatterns )
@@ -105,9 +105,10 @@ namespace dbaui
                     ++pFeatureMapping;
                 }
 
-                s_aFeatureSets[ pattern ] = aCurrentSet;
+                tmp[ pattern ] = aCurrentSet;
             }
-        }
+            return tmp;
+        }();
 
         OSL_ENSURE( s_aFeatureSets.find( _rURL ) != s_aFeatureSets.end(), "invalid URL/pattern!" );
         return s_aFeatureSets[ _rURL ];
@@ -115,9 +116,9 @@ namespace dbaui
 
     static AuthenticationMode getAuthenticationMode( const OUString& _sURL )
     {
-        static std::map< OUString, FeatureSupport > s_aSupport;
-        if ( s_aSupport.empty() )
+        static std::map< OUString, FeatureSupport > s_aSupport = [&]()
         {
+            std::map< OUString, FeatureSupport > tmp;
             ::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessComponentContext());
             const uno::Sequence< OUString > aURLs = aDriverConfig.getURLs();
             const OUString* pIter = aURLs.getConstArray();
@@ -135,9 +136,10 @@ namespace dbaui
                     else if ( sAuth == "Password" )
                         aInit = FeatureSupport(AuthPwd);
                 }
-                s_aSupport.insert(std::make_pair(*pIter,aInit));
+                tmp.insert(std::make_pair(*pIter,aInit));
             }
-        }
+            return tmp;
+        }();
         OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
         return s_aSupport[ _sURL ].eAuthentication;
     }
diff --git a/dbaccess/source/ui/misc/uiservices.cxx b/dbaccess/source/ui/misc/uiservices.cxx
index a3d6c8db83e8..c6cdcb2a24f0 100644
--- a/dbaccess/source/ui/misc/uiservices.cxx
+++ b/dbaccess/source/ui/misc/uiservices.cxx
@@ -20,6 +20,7 @@
 #include <cppuhelper/factory.hxx>
 #include <dbu_reghelper.hxx>
 #include <uiservices.hxx>
+#include <mutex>
 
 using namespace ::dbaui;
 using namespace ::com::sun::star::uno;
@@ -30,8 +31,8 @@ extern "C" {
 
 static void createRegistryInfo_DBU()
 {
-    static bool bInit = false;
-    if (!bInit)
+    static std::once_flag aInit;
+    std::call_once(aInit, [&]()
     {
         createRegistryInfo_OTableFilterDialog();
         createRegistryInfo_ODataSourcePropertyDialog();
@@ -57,8 +58,8 @@ static void createRegistryInfo_DBU()
         createRegistryInfo_CopyTableWizard();
         createRegistryInfo_OTextConnectionSettingsDialog();
         createRegistryInfo_LimitBoxController();
-        bInit = true;
-    }
+        return true;
+    });
 }
 
 }
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index e05f20b21992..520003d139f4 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -239,13 +239,12 @@ static TransliterationWrapper& GetIgnoreTranslWrapper()
 }
 static CollatorWrapper& GetCollatorWrapper()
 {
-    static int bIsInit = 0;
-    static CollatorWrapper aCollWrp( ::comphelper::getProcessComponentContext() );
-    if( !bIsInit )
+    static CollatorWrapper aCollWrp = [&]()
     {
-        aCollWrp.loadDefaultCollator( GetAppLang().getLocale(), 0 );
-        bIsInit = 1;
-    }
+        CollatorWrapper tmp( ::comphelper::getProcessComponentContext() );
+        tmp.loadDefaultCollator( GetAppLang().getLocale(), 0 );
+        return tmp;
+    }();
     return aCollWrp;
 }
 
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx
index aa340c391c8f..710b7696c1d1 100644
--- a/extensions/source/bibliography/bibconfig.cxx
+++ b/extensions/source/bibliography/bibconfig.cxx
@@ -40,20 +40,17 @@ const char cDataSourceHistory[] = "DataSourceHistory";
 
 Sequence<OUString> const & BibConfig::GetPropertyNames()
 {
-    static Sequence<OUString> aNames;
-    if(!aNames.getLength())
+    static Sequence<OUString> aNames =
     {
-        aNames.realloc(8);
-        OUString* pNames = aNames.getArray();
-        pNames[0] = "CurrentDataSource/DataSourceName";
-        pNames[1] = "CurrentDataSource/Command";
-        pNames[2] = "CurrentDataSource/CommandType";
-        pNames[3] = "BeamerHeight";
-        pNames[4] = "ViewHeight";
-        pNames[5] = "QueryText";
-        pNames[6] = "QueryField";
-        pNames[7] = "ShowColumnAssignmentWarning";
-    }
+        "CurrentDataSource/DataSourceName",
+        "CurrentDataSource/Command",
+        "CurrentDataSource/CommandType",
+        "BeamerHeight",
+        "ViewHeight",
+        "QueryText",
+        "QueryField",
+        "ShowColumnAssignmentWarning"
+    };
     return aNames;
 }
 
diff --git a/extensions/source/dbpilots/dbpservices.cxx b/extensions/source/dbpilots/dbpservices.cxx
index 054924b5aa04..42779c6d1754 100644
--- a/extensions/source/dbpilots/dbpservices.cxx
+++ b/extensions/source/dbpilots/dbpservices.cxx
@@ -19,6 +19,7 @@
 
 #include <componentmodule.hxx>
 #include "dbpservices.hxx"
+#include <mutex>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -28,14 +29,14 @@ extern "C" {
 
 static void dbp_initializeModule()
 {
-    static bool s_bInit = false;
-    if (!s_bInit)
+    std::once_flag aInit;
+    std::call_once(aInit, [&]()
     {
         createRegistryInfo_OGroupBoxWizard();
         createRegistryInfo_OListComboWizard();
         createRegistryInfo_OGridWizard();
-        s_bInit = true;
-    }
+        return true;
+    });
 }
 
 }
diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx
index eb4368bb7da4..8156ffeb603a 100644
--- a/extensions/source/propctrlr/pcrservices.cxx
+++ b/extensions/source/propctrlr/pcrservices.cxx
@@ -20,6 +20,7 @@
 
 #include "modulepcr.hxx"
 #include "pcrservices.hxx"
+#include <mutex>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -29,8 +30,8 @@ extern "C" {
 
 static void pcr_initializeModule()
 {
-    static bool s_bInit = false;
-    if (!s_bInit)
+    std::once_flag aInit;
+    std::call_once(aInit, [&]()
     {
         createRegistryInfo_OPropertyBrowserController();
         createRegistryInfo_FormController();
@@ -51,8 +52,8 @@ static void pcr_initializeModule()
         createRegistryInfo_StringRepresentation();
         createRegistryInfo_MasterDetailLinkDialog();
         createRegistryInfo_FormGeometryHandler();
-        s_bInit = true;
-    }
+        return true;
+    });
 }
 
 }
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 48e534b83132..afe4236071be 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -303,9 +303,8 @@ static void SetByte(sal_uInt16& nx, sal_uInt16 ny, vcl::bitmap::RawBitmap& rBitm
 
 //=================== methods of PictReader ==============================
 rtl_TextEncoding PictReader::GetTextEncoding (sal_uInt16 fId) {
-  static bool first = true;
-  static rtl_TextEncoding enc = RTL_TEXTENCODING_APPLE_ROMAN;
-  if (first) {
+  static rtl_TextEncoding enc = [&]()
+  {
     rtl_TextEncoding def = osl_getThreadTextEncoding();
     // we keep osl_getThreadTextEncoding only if it is a mac encoding
     switch(def) {
@@ -329,11 +328,12 @@ rtl_TextEncoding PictReader::GetTextEncoding (sal_uInt16 fId) {
     case RTL_TEXTENCODING_APPLE_CHINTRAD:
     case RTL_TEXTENCODING_APPLE_JAPANESE:
     case RTL_TEXTENCODING_APPLE_KOREAN:
-      enc = def; break;
-    default: break;
+      return def; break;
+    default:
+        break;
     }
-    first = false;
-  }
+    return RTL_TEXTENCODING_APPLE_ROMAN;
+  }();
   if (fId == 13) return RTL_TEXTENCODING_ADOBE_DINGBATS; // CHECKME
   if (fId == 23) return RTL_TEXTENCODING_ADOBE_SYMBOL;
   return enc;
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 8e7cfec8267c..2a89ae769cdc 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -689,14 +689,15 @@ KeyCodeEntry const aMSKeyCodesData[] = {
 
 awt::KeyEvent parseKeyEvent( const OUString& Key )
 {
-    static std::map< OUString, sal_uInt16 > s_KeyCodes;
-    if ( s_KeyCodes.empty() )
+    static std::map< OUString, sal_uInt16 > s_KeyCodes = [&]()
     {
+        std::map< OUString, sal_uInt16 > tmp;
         for (KeyCodeEntry const & i : aMSKeyCodesData)
         {
-            s_KeyCodes[ OUString::createFromAscii( i.sName ) ] = i.nCode;
+            tmp[ OUString::createFromAscii( i.sName ) ] = i.nCode;
         }
-    }
+        return tmp;
+    }();
     OUString sKeyCode;
     sal_uInt16 nVclKey = 0;
 
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 2764dfc2fb23..cab2424a2083 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -1167,40 +1167,37 @@ static struct {
     {"textBox", mso_sptTextBox},
 };
 
-typedef std::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap;
-static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = nullptr;
-
 const char* GetOOXMLPresetGeometry( const char* sShapeType )
 {
-    if( pCustomShapeTypeTranslationHashMap == nullptr )
+    typedef std::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap;
+    static CustomShapeTypeTranslationHashMap aCustomShapeTypeTranslationHashMap = [&]()
     {
-        pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap;
+        CustomShapeTypeTranslationHashMap tmp;
         for(const msfilter::util::CustomShapeTypeTranslationTable& i : pCustomShapeTypeTranslationTable)
         {
-            (*pCustomShapeTypeTranslationHashMap)[ i.sOOo ] = i.sMSO;
+            tmp[ i.sOOo ] = i.sMSO;
         }
-    }
+        return tmp;
+    }();
     CustomShapeTypeTranslationHashMap::iterator i(
-        pCustomShapeTypeTranslationHashMap->find(sShapeType));
-    return i == pCustomShapeTypeTranslationHashMap->end() ? "rect" : i->second;
+        aCustomShapeTypeTranslationHashMap.find(sShapeType));
+    return i == aCustomShapeTypeTranslationHashMap.end() ? "rect" : i->second;
 }
 
-typedef std::unordered_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> DMLToVMLTranslationHashMap;
-static DMLToVMLTranslationHashMap* pDMLToVMLMap;
-
 MSO_SPT GETVMLShapeType(const OString& aType)
 {
-    const char* pDML = GetOOXMLPresetGeometry(aType.getStr());
-
-    if (!pDMLToVMLMap)
+    typedef std::unordered_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> DMLToVMLTranslationHashMap;
+    static DMLToVMLTranslationHashMap aDMLToVMLMap = [&]()
     {
-        pDMLToVMLMap = new DMLToVMLTranslationHashMap;
+        DMLToVMLTranslationHashMap tmp;
         for (auto& i : pDMLToVMLTable)
-            (*pDMLToVMLMap)[i.sDML] = i.nVML;
-    }
+            tmp[i.sDML] = i.nVML;
+        return tmp;
+    }();
 
-    DMLToVMLTranslationHashMap::iterator i(pDMLToVMLMap->find(pDML));
-    return i == pDMLToVMLMap->end() ? mso_sptNil : i->second;
+    const char* pDML = GetOOXMLPresetGeometry(aType.getStr());
+    DMLToVMLTranslationHashMap::iterator i(aDMLToVMLMap.find(pDML));
+    return i == aDMLToVMLMap.end() ? mso_sptNil : i->second;
 }
 
 bool HasTextBoxContent(sal_uInt32 nShapeType)
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx
index 3d87a3e6bce3..83ab9f470a5e 100644
--- a/filter/source/xsltdialog/xmlfiltercommon.hxx
+++ b/filter/source/xsltdialog/xmlfiltercommon.hxx
@@ -78,7 +78,7 @@ struct application_info_impl
 };
 
 
-extern std::vector< application_info_impl* >& getApplicationInfos();
+extern std::vector< application_info_impl > const & getApplicationInfos();
 extern OUString getApplicationUIName( const OUString& rServiceName );
 extern const application_info_impl* getApplicationInfo( const OUString& rServiceName );
 OUString XsltResId(const char* pId);
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index f1d82327ca75..88eccc7d2167 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -1186,74 +1186,64 @@ application_info_impl::application_info_impl( const sal_Char * pDocumentService,
 {
 }
 
-std::vector< application_info_impl* >& getApplicationInfos()
+std::vector< application_info_impl > const & getApplicationInfos()
 {
-    static std::vector< application_info_impl* > aInfos;
-
-    if( aInfos.empty() )
+    static std::vector< application_info_impl > const aInfos
     {
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.text.TextDocument",
+        {   "com.sun.star.text.TextDocument",
             STR_APPL_NAME_WRITER,
             "com.sun.star.comp.Writer.XMLImporter",
-            "com.sun.star.comp.Writer.XMLExporter" ) );
+            "com.sun.star.comp.Writer.XMLExporter" },
 
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.sheet.SpreadsheetDocument",
+        {   "com.sun.star.sheet.SpreadsheetDocument",
             STR_APPL_NAME_CALC,
             "com.sun.star.comp.Calc.XMLImporter",
-            "com.sun.star.comp.Calc.XMLExporter" ) );
+            "com.sun.star.comp.Calc.XMLExporter" },
 
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.presentation.PresentationDocument",
+        {  "com.sun.star.presentation.PresentationDocument",
             STR_APPL_NAME_IMPRESS,
             "com.sun.star.comp.Impress.XMLImporter",
-            "com.sun.star.comp.Impress.XMLExporter" ) );
+            "com.sun.star.comp.Impress.XMLExporter" },
 
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.drawing.DrawingDocument",
+        {   "com.sun.star.drawing.DrawingDocument",
             STR_APPL_NAME_DRAW,
             "com.sun.star.comp.Draw.XMLImporter",
-            "com.sun.star.comp.Draw.XMLExporter" ) );
+            "com.sun.star.comp.Draw.XMLExporter" },
 
         // --- oasis file formats...
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.text.TextDocument",
+        {   "com.sun.star.text.TextDocument",
             STR_APPL_NAME_OASIS_WRITER,
             "com.sun.star.comp.Writer.XMLOasisImporter",
-            "com.sun.star.comp.Writer.XMLOasisExporter" ) );
+            "com.sun.star.comp.Writer.XMLOasisExporter" },
 
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.sheet.SpreadsheetDocument",
+        {   "com.sun.star.sheet.SpreadsheetDocument",
             STR_APPL_NAME_OASIS_CALC,
             "com.sun.star.comp.Calc.XMLOasisImporter",
-            "com.sun.star.comp.Calc.XMLOasisExporter" ) );
+            "com.sun.star.comp.Calc.XMLOasisExporter" },
 
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.presentation.PresentationDocument",
+        {   "com.sun.star.presentation.PresentationDocument",
             STR_APPL_NAME_OASIS_IMPRESS,
             "com.sun.star.comp.Impress.XMLOasisImporter",
-            "com.sun.star.comp.Impress.XMLOasisExporter" ) );
+            "com.sun.star.comp.Impress.XMLOasisExporter" },
 
-        aInfos.push_back( new application_info_impl(
-            "com.sun.star.drawing.DrawingDocument",
+        {  "com.sun.star.drawing.DrawingDocument",
             STR_APPL_NAME_OASIS_DRAW,
             "com.sun.star.comp.Draw.XMLOasisImporter",
-            "com.sun.star.comp.Draw.XMLOasisExporter" ) );
-    }
+            "com.sun.star.comp.Draw.XMLOasisExporter" },
+    };
 
     return aInfos;
 }
 
 const application_info_impl* getApplicationInfo( const OUString& rServiceName )
 {
-    std::vector< application_info_impl* >& rInfos = getApplicationInfos();
+    std::vector< application_info_impl > const & rInfos = getApplicationInfos();
     for (auto const& info : rInfos)
     {
-        if( rServiceName == info->maXMLExporter ||
-            rServiceName == info->maXMLImporter)
+        if( rServiceName == info.maXMLExporter ||
+            rServiceName == info.maXMLImporter)
         {
-            return info;
+            return &info;
         }
     }
     return nullptr;
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
index 7b6e519c813f..af2b6148d51f 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
@@ -34,10 +34,10 @@ XMLFilterTabPageBasic::XMLFilterTabPageBasic(weld::Widget* pPage)
 {
     m_xEDDescription->set_size_request(-1, m_xEDDescription->get_height_rows(4));
 
-    std::vector< application_info_impl* >& rInfos = getApplicationInfos();
+    std::vector< application_info_impl > const & rInfos = getApplicationInfos();
     for (auto const& info : rInfos)
     {
-        OUString aEntry( info->maDocumentUIName );
+        OUString aEntry( info.maDocumentUIName );
         m_xCBApplication->append_text( aEntry );
     }
 }
@@ -92,14 +92,14 @@ void XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo )
 
         if( !pInfo->maDocumentService.isEmpty() )
         {
-            std::vector< application_info_impl* >& rInfos = getApplicationInfos();
+            std::vector< application_info_impl > const & rInfos = getApplicationInfos();
             for (auto const& info : rInfos)
             {
-                if( pInfo->maDocumentService == info->maDocumentUIName )
+                if( pInfo->maDocumentService == info.maDocumentUIName )
                 {
-                    pInfo->maDocumentService = info->maDocumentService;
-                    pInfo->maExportService = info->maXMLExporter;
-                    pInfo->maImportService = info->maXMLImporter;
+                    pInfo->maDocumentService = info.maDocumentService;
+                    pInfo->maExportService = info.maXMLExporter;
+                    pInfo->maImportService = info.maXMLImporter;
                     break;
                 }
             }


More information about the Libreoffice-commits mailing list