connectivity/source/commontools/dbtools2.cxx         |    7 -----
 dbaccess/source/core/api/FilteredContainer.cxx       |    2 -
 dbaccess/source/core/api/RowSet.cxx                  |    2 -
 dbaccess/source/core/dataaccess/databasedocument.cxx |    2 -
 dbaccess/source/core/dataaccess/datasource.cxx       |    2 -
 dbaccess/source/filter/xml/xmlDatabase.cxx           |    6 ++--
 dbaccess/source/filter/xml/xmlExport.cxx             |    6 ++--
 include/connectivity/dbtools.hxx                     |   10 +------
 reportdesign/inc/ReportDefinition.hxx                |    6 ++--
 reportdesign/source/core/api/ReportDefinition.cxx    |   26 ++++++++-----------
 10 files changed, 26 insertions(+), 43 deletions(-)

New commits:
commit f93e0514c5c859c9c027787ec757a90602b9cc48
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon May 19 17:07:07 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon May 19 23:32:22 2025 +0200

    connectivity: Drop dbtools::getDataSourceSetting taking const char*
    
    Switch all callers to use the other variant that
    takes const OUString&, which the now dropped variant
    was also calling internally.
    
    Change-Id: If7d2861dc570744444f25b8124cc04781d7772d6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185536
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/connectivity/source/commontools/dbtools2.cxx 
b/connectivity/source/commontools/dbtools2.cxx
index 6526de5d3ce0..1da346c2630b 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -625,13 +625,6 @@ bool getDataSourceSetting( const Reference< XInterface >& 
_xChild, const OUStrin
     return bIsPresent;
 }
 
-bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const 
char* _pAsciiSettingsName,
-    Any& /* [out] */ _rSettingsValue )
-{
-    OUString sAsciiSettingsName = 
OUString::createFromAscii(_pAsciiSettingsName);
-    return getDataSourceSetting( _rxDataSource, 
sAsciiSettingsName,_rSettingsValue );
-}
-
 bool isDataSourcePropertyEnabled(const Reference<XInterface>& _xProp, const 
OUString& _sProperty, bool _bDefault)
 {
     bool bEnabled = _bDefault;
diff --git a/dbaccess/source/core/api/FilteredContainer.cxx 
b/dbaccess/source/core/api/FilteredContainer.cxx
index 0c4592b000bc..7936be564af9 100644
--- a/dbaccess/source/core/api/FilteredContainer.cxx
+++ b/dbaccess/source/core/api/FilteredContainer.cxx
@@ -408,7 +408,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& 
_rTableFilter, std::
 
         // obtain the data source we belong to, and the TableTypeFilterMode 
setting
         Any aFilterModeSetting;
-        if ( getDataSourceSetting( getDataSource( Reference< XInterface 
>(m_rParent) ), "TableTypeFilterMode", aFilterModeSetting ) )
+        if 
(getDataSourceSetting(getDataSource(Reference<XInterface>(m_rParent)), 
u"TableTypeFilterMode"_ustr, aFilterModeSetting))
         {
             OSL_VERIFY( aFilterModeSetting >>= nFilterMode );
         }
diff --git a/dbaccess/source/core/api/RowSet.cxx 
b/dbaccess/source/core/api/RowSet.cxx
index 774b13495cc3..4f1dd11fcf5b 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1553,7 +1553,7 @@ void ORowSet::setStatementResultSetType( const Reference< 
XPropertySet >& _rxSta
     // #i15113#
     bool bRespectDriverRST = false;
     Any aSetting;
-    if ( getDataSourceSetting( ::dbaccess::getDataSource( m_xActiveConnection 
), "RespectDriverResultSetType", aSetting ) )
+    if (getDataSourceSetting(::dbaccess::getDataSource(m_xActiveConnection), 
u"RespectDriverResultSetType"_ustr, aSetting))
     {
         OSL_VERIFY( aSetting >>= bRespectDriverRST );
     }
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx 
b/dbaccess/source/core/dataaccess/databasedocument.cxx
index dcacb7355bda..f0ba617914b3 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1421,7 +1421,7 @@ Reference< XNameAccess > 
ODatabaseDocument::impl_getDocumentContainer_throw( ODa
     {
         Any aValue;
         css::uno::Reference< css::uno::XInterface > xMy(*this);
-        if ( dbtools::getDataSourceSetting(xMy,bFormsContainer ? "Forms" : 
"Reports",aValue) )
+        if (dbtools::getDataSourceSetting(xMy, bFormsContainer ? u"Forms"_ustr 
: u"Reports"_ustr, aValue))
         {
             OUString sSupportService;
             aValue >>= sSupportService;
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx 
b/dbaccess/source/core/dataaccess/datasource.cxx
index 1095bf006b22..ca2872fbc99c 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -1173,7 +1173,7 @@ Reference< XNameAccess > SAL_CALL 
ODatabaseSource::getQueryDefinitions( )
     {
         Any aValue;
         css::uno::Reference< css::uno::XInterface > xMy(*this);
-        if ( dbtools::getDataSourceSetting(xMy,"CommandDefinitions",aValue) )
+        if (dbtools::getDataSourceSetting(xMy, u"CommandDefinitions"_ustr, 
aValue))
         {
             OUString sSupportService;
             aValue >>= sSupportService;
diff --git a/dbaccess/source/filter/xml/xmlDatabase.cxx 
b/dbaccess/source/filter/xml/xmlDatabase.cxx
index 2f629caff37e..3c56a58f8d67 100644
--- a/dbaccess/source/filter/xml/xmlDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlDatabase.cxx
@@ -66,7 +66,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
OXMLDatabase::createFa
                 GetOwnImport().GetProgressBarHelper()->Increment( 
PROGRESS_BAR_STEP );
                 Any aValue;
                 OUString sService;
-                
dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"Forms",aValue);
+                dbtools::getDataSourceSetting(GetOwnImport().getDataSource(), 
u"Forms"_ustr, aValue);
                 aValue >>= sService;
                 if ( sService.isEmpty() )
                 {
@@ -81,7 +81,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
OXMLDatabase::createFa
                 GetOwnImport().GetProgressBarHelper()->Increment( 
PROGRESS_BAR_STEP );
                 Any aValue;
                 OUString sService;
-                
dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"Reports",aValue);
+                dbtools::getDataSourceSetting(GetOwnImport().getDataSource(), 
u"Reports"_ustr, aValue);
                 aValue >>= sService;
                 if ( sService.isEmpty() )
                 {
@@ -96,7 +96,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
OXMLDatabase::createFa
                 GetOwnImport().GetProgressBarHelper()->Increment( 
PROGRESS_BAR_STEP );
                 Any aValue;
                 OUString sService;
-                
dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"CommandDefinitions",aValue);
+                dbtools::getDataSourceSetting(GetOwnImport().getDataSource(), 
u"CommandDefinitions"_ustr, aValue);
                 aValue >>= sService;
                 if ( sService.isEmpty() )
                 {
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx 
b/dbaccess/source/filter/xml/xmlExport.cxx
index 740605cac13a..a62f34a24820 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -965,7 +965,7 @@ void ODBExport::exportForms()
 {
     Any aValue;
     OUString sService;
-    dbtools::getDataSourceSetting(getDataSource(),"Forms",aValue);
+    dbtools::getDataSourceSetting(getDataSource(), u"Forms"_ustr, aValue);
     aValue >>= sService;
     if ( !sService.isEmpty() )
         return;
@@ -986,7 +986,7 @@ void ODBExport::exportReports()
 {
     Any aValue;
     OUString sService;
-    dbtools::getDataSourceSetting(getDataSource(),"Reports",aValue);
+    dbtools::getDataSourceSetting(getDataSource(), u"Reports"_ustr, aValue);
     aValue >>= sService;
     if ( !sService.isEmpty() )
         return;
@@ -1007,7 +1007,7 @@ void ODBExport::exportQueries(bool _bExportContext)
 {
     Any aValue;
     OUString sService;
-    dbtools::getDataSourceSetting(getDataSource(),"CommandDefinitions",aValue);
+    dbtools::getDataSourceSetting(getDataSource(), u"CommandDefinitions"_ustr, 
aValue);
     aValue >>= sService;
     if ( !sService.isEmpty() )
         return;
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx
index 17f329ad3302..6fbb0eb0c4d0 100644
--- a/include/connectivity/dbtools.hxx
+++ b/include/connectivity/dbtools.hxx
@@ -340,8 +340,8 @@ namespace dbtools
 
         @param _rxDataSource
             a data source component
-        @param _pAsciiSettingsName
-            the ASCII name of the setting to obtain
+        @param _sSettingsName
+            the name of the setting to obtain
         @param _rSettingsValue
             the value of the setting, upon successful return
 
@@ -351,12 +351,6 @@ namespace dbtools
             <TRUE/> otherwise
     */
     OOO_DLLPUBLIC_DBTOOLS
-    bool    getDataSourceSetting(
-        const css::uno::Reference< css::uno::XInterface >& _rxDataSource,
-        const char* _pAsciiSettingsName,
-        css::uno::Any& /* [out] */ _rSettingsValue
-    );
-    OOO_DLLPUBLIC_DBTOOLS
     bool    getDataSourceSetting(
         const css::uno::Reference< css::uno::XInterface >& _rxDataSource,
         const OUString& _sSettingsName,
commit d0b9e6473d1e0546eee5404806b0eb0d6e7193d1
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon May 19 15:44:58 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon May 19 23:32:15 2025 +0200

    reportdesign: Switch some params to const OUString&
    
    ... instead of passing const char* and converting to
    OUString in the implementations.
    
    Change-Id: Id6acc44eab8ae41add442ed76621cf95b6b901d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185532
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/reportdesign/inc/ReportDefinition.hxx 
b/reportdesign/inc/ReportDefinition.hxx
index 722200a30acc..01c132289b9f 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -131,8 +131,8 @@ namespace reportdesign
         bool WriteThroughComponent(
             /// the component we export
             const css::uno::Reference< css::lang::XComponent> & xComponent,
-            const char* pStreamName,        /// the stream name
-            const char* pServiceName,       /// service name of the component
+            const OUString& rStreamName, /// the stream name
+            const OUString& rServiceName, /// service name of the component
             /// the argument (XInitialization)
             const css::uno::Sequence< css::uno::Any> & rArguments,
             /// output descriptor
@@ -144,7 +144,7 @@ namespace reportdesign
         bool WriteThroughComponent(
             const css::uno::Reference< css::io::XOutputStream> & xOutputStream,
             const css::uno::Reference< css::lang::XComponent> & xComponent,
-            const char* pServiceName,
+            const OUString& rServiceName,
             const css::uno::Sequence< css::uno::Any> & rArguments,
             const css::uno::Sequence< css::beans::PropertyValue> & rMediaDesc);
 
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx 
b/reportdesign/source/core/api/ReportDefinition.cxx
index e997b73b84dd..28b8f18d5da2 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1346,19 +1346,19 @@ void SAL_CALL OReportDefinition::storeToStorage( const 
uno::Reference< embed::XS
     // Try to write to settings.xml, meta.xml, and styles.xml; only really 
care about success of
     // write to content.xml (keeping logic of commit 
94ccba3eebc83b58e74e18f0e028c6a995ce6aa6)
     xInfoSet->setPropertyValue(u"StreamName"_ustr, 
uno::Any(u"settings.xml"_ustr));
-    WriteThroughComponent(xCom, "settings.xml", 
"com.sun.star.comp.report.XMLSettingsExporter",
+    WriteThroughComponent(xCom, u"settings.xml"_ustr, 
u"com.sun.star.comp.report.XMLSettingsExporter"_ustr,
                           aDelegatorArguments, aProps, _xStorageToSaveTo);
 
     xInfoSet->setPropertyValue(u"StreamName"_ustr, uno::Any(u"meta.xml"_ustr));
-    WriteThroughComponent(xCom, "meta.xml", 
"com.sun.star.comp.report.XMLMetaExporter",
+    WriteThroughComponent(xCom, u"meta.xml"_ustr, 
u"com.sun.star.comp.report.XMLMetaExporter"_ustr,
                           aDelegatorArguments, aProps, _xStorageToSaveTo);
 
     xInfoSet->setPropertyValue(u"StreamName"_ustr, 
uno::Any(u"styles.xml"_ustr));
-    WriteThroughComponent(xCom, "styles.xml", 
"com.sun.star.comp.report.XMLStylesExporter",
+    WriteThroughComponent(xCom, u"styles.xml"_ustr, 
u"com.sun.star.comp.report.XMLStylesExporter"_ustr,
                           aDelegatorArguments, aProps, _xStorageToSaveTo);
 
     xInfoSet->setPropertyValue(u"StreamName"_ustr, 
uno::Any(u"content.xml"_ustr));
-    bool bOk = WriteThroughComponent(xCom, "content.xml", 
"com.sun.star.comp.report.ExportFilter",
+    bool bOk = WriteThroughComponent(xCom, u"content.xml"_ustr, 
u"com.sun.star.comp.report.ExportFilter"_ustr,
                                      aDelegatorArguments, aProps, 
_xStorageToSaveTo);
 
     uno::Any aImage;
@@ -1448,18 +1448,15 @@ void SAL_CALL 
OReportDefinition::removeStorageChangeListener( const uno::Referen
 
 bool OReportDefinition::WriteThroughComponent(
     const uno::Reference<lang::XComponent> & xComponent,
-    const char* pStreamName,
-    const char* pServiceName,
+    const OUString& rStreamName,
+    const OUString& rServiceName,
     const uno::Sequence<uno::Any> & rArguments,
     const uno::Sequence<beans::PropertyValue> & rMediaDesc,
     const uno::Reference<embed::XStorage>& _xStorageToSaveTo)
 {
-    OSL_ENSURE( nullptr != pStreamName, "Need stream name!" );
-    OSL_ENSURE( nullptr != pServiceName, "Need service name!" );
-
     // open stream
-    OUString sStreamName = OUString::createFromAscii( pStreamName );
-    uno::Reference<io::XStream> xStream = 
_xStorageToSaveTo->openStreamElement( 
sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+    uno::Reference<io::XStream> xStream = 
_xStorageToSaveTo->openStreamElement(rStreamName,
+                                                                               
embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE);
     if ( !xStream.is() )
         return false;
     uno::Reference<io::XOutputStream> xOutputStream = 
xStream->getOutputStream();
@@ -1487,7 +1484,7 @@ bool OReportDefinition::WriteThroughComponent(
     // write the stuff
     bool bRet = WriteThroughComponent(
         xOutputStream, xComponent,
-        pServiceName, rArguments, rMediaDesc );
+        rServiceName, rArguments, rMediaDesc);
     // finally, commit stream.
     return bRet;
 }
@@ -1495,13 +1492,12 @@ bool OReportDefinition::WriteThroughComponent(
 bool OReportDefinition::WriteThroughComponent(
     const uno::Reference<io::XOutputStream> & xOutputStream,
     const uno::Reference<lang::XComponent> & xComponent,
-    const char* pServiceName,
+    const OUString& rServiceName,
     const uno::Sequence<uno::Any> & rArguments,
     const uno::Sequence<beans::PropertyValue> & rMediaDesc)
 {
     OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" );
     OSL_ENSURE( xComponent.is(), "Need component!" );
-    OSL_ENSURE( nullptr != pServiceName, "Need component name!" );
 
     // get component
     uno::Reference< xml::sax::XWriter > xSaxWriter(
@@ -1519,7 +1515,7 @@ bool OReportDefinition::WriteThroughComponent(
     // get filter component
     uno::Reference< document::XExporter > xExporter(
         
m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-            OUString::createFromAscii(pServiceName), 
aArgs,m_aProps->m_xContext), uno::UNO_QUERY);
+            rServiceName, aArgs, m_aProps->m_xContext), uno::UNO_QUERY);
     OSL_ENSURE( xExporter.is(),
             "can't instantiate export filter component" );
     if( !xExporter.is() )

Reply via email to