From 8e2fe1bb107c263cd3a0b04c14fc0267b3df2380 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 3 Dec 2021 11:06:33 +0200 Subject: loplugin:stringliteraldefine in dbaccess Change-Id: Ic7c2d23747d56432037f145b7ce9a5b6cf3724cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126283 Tested-by: Jenkins Reviewed-by: Noel Grandin --- dbaccess/source/ui/browser/dbloader.cxx | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'dbaccess/source') diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 3530bf7a6acd..67645e92e611 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -113,22 +113,17 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU m_xListener = rListener; m_aArgs = rArgs; - static const struct ServiceNameToImplName + static constexpr struct ServiceNameToImplName { - const char* pAsciiServiceName; + rtl::OUStringConstExpr sServiceName; const char* pAsciiImplementationName; - ServiceNameToImplName( const char* _pService, const char* _pImpl ) - :pAsciiServiceName( _pService ) - ,pAsciiImplementationName( _pImpl ) - { - } } aImplementations[] = { - ServiceNameToImplName( URL_COMPONENT_FORMGRIDVIEW, "org.openoffice.comp.dbu.OFormGridView" ), - ServiceNameToImplName( URL_COMPONENT_DATASOURCEBROWSER, "org.openoffice.comp.dbu.ODatasourceBrowser" ), - ServiceNameToImplName( URL_COMPONENT_QUERYDESIGN, "org.openoffice.comp.dbu.OQueryDesign" ), - ServiceNameToImplName( URL_COMPONENT_TABLEDESIGN, "org.openoffice.comp.dbu.OTableDesign" ), - ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN, "org.openoffice.comp.dbu.ORelationDesign" ), - ServiceNameToImplName( URL_COMPONENT_VIEWDESIGN, "org.openoffice.comp.dbu.OViewDesign" ) + { URL_COMPONENT_FORMGRIDVIEW, "org.openoffice.comp.dbu.OFormGridView" }, + { URL_COMPONENT_DATASOURCEBROWSER, "org.openoffice.comp.dbu.ODatasourceBrowser" }, + { URL_COMPONENT_QUERYDESIGN, "org.openoffice.comp.dbu.OQueryDesign" }, + { URL_COMPONENT_TABLEDESIGN, "org.openoffice.comp.dbu.OTableDesign" }, + { URL_COMPONENT_RELATIONDESIGN, "org.openoffice.comp.dbu.ORelationDesign" }, + { URL_COMPONENT_VIEWDESIGN, "org.openoffice.comp.dbu.OViewDesign" } }; INetURLObject aParser( rURL ); @@ -137,7 +132,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU const OUString sComponentURL( aParser.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ) ); for (const ServiceNameToImplName& aImplementation : aImplementations) { - if ( sComponentURL.equalsAscii( aImplementation.pAsciiServiceName ) ) + if ( sComponentURL == aImplementation.sServiceName ) { xController.set( m_xContext->getServiceManager()-> createInstanceWithContext( OUString::createFromAscii( aImplementation.pAsciiImplementationName ), m_xContext), UNO_QUERY_THROW ); -- cgit v1.2.3