summaryrefslogtreecommitdiff
path: root/desktop/source/deployment/registry
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 16:10:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 20:46:19 +0200
commitbc66bf4608557d757555aef1f46abf8a15c3538b (patch)
tree92d1f64c49ad464c26cb33b0044fdf54efa7cdf5 /desktop/source/deployment/registry
parentd72f963c0de0c2e48f1dc999cd8687e13a1f676f (diff)
loplugin:flatten in desktop
Change-Id: I1ab39e041025692cac06eb6602787f16a3a9cb0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92198 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source/deployment/registry')
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx255
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx80
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx23
-rw-r--r--desktop/source/deployment/registry/help/dp_help.cxx28
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx40
5 files changed, 214 insertions, 212 deletions
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 997eb4106c8b..cdc840762068 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -723,117 +723,117 @@ void BackendImpl::unorc_verify_init(
if (transientMode())
return;
const ::osl::MutexGuard guard( getMutex() );
- if (! m_unorc_inited)
+ if ( m_unorc_inited)
+ return;
+
+ // common rc:
+ ::ucbhelper::Content ucb_content;
+ if (create_ucb_content(
+ &ucb_content,
+ makeURL( getCachePath(), "unorc" ),
+ xCmdEnv, false /* no throw */ ))
{
- // common rc:
- ::ucbhelper::Content ucb_content;
- if (create_ucb_content(
- &ucb_content,
- makeURL( getCachePath(), "unorc" ),
- xCmdEnv, false /* no throw */ ))
+ OUString line;
+ if (readLine( &line, "UNO_JAVA_CLASSPATH=", ucb_content,
+ RTL_TEXTENCODING_UTF8 ))
{
- OUString line;
- if (readLine( &line, "UNO_JAVA_CLASSPATH=", ucb_content,
- RTL_TEXTENCODING_UTF8 ))
- {
- sal_Int32 index = sizeof ("UNO_JAVA_CLASSPATH=") - 1;
- do {
- OUString token( line.getToken( 0, ' ', index ).trim() );
- if (!token.isEmpty())
+ sal_Int32 index = sizeof ("UNO_JAVA_CLASSPATH=") - 1;
+ do {
+ OUString token( line.getToken( 0, ' ', index ).trim() );
+ if (!token.isEmpty())
+ {
+ if (create_ucb_content(
+ nullptr, expandUnoRcTerm(token), xCmdEnv,
+ false /* no throw */ ))
{
- if (create_ucb_content(
- nullptr, expandUnoRcTerm(token), xCmdEnv,
- false /* no throw */ ))
- {
- //The jar file may not exist anymore if a shared or bundled
- //extension was removed, but it can still be in the unorc
- //After running XExtensionManager::synchronize, the unorc is
- //cleaned up
- m_jar_typelibs.push_back( token );
- }
+ //The jar file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the unorc
+ //After running XExtensionManager::synchronize, the unorc is
+ //cleaned up
+ m_jar_typelibs.push_back( token );
}
}
- while (index >= 0);
}
- if (readLine( &line, "UNO_TYPES=", ucb_content,
- RTL_TEXTENCODING_UTF8 )) {
- sal_Int32 index = sizeof ("UNO_TYPES=") - 1;
- do {
- OUString token( line.getToken( 0, ' ', index ).trim() );
- if (!token.isEmpty())
+ while (index >= 0);
+ }
+ if (readLine( &line, "UNO_TYPES=", ucb_content,
+ RTL_TEXTENCODING_UTF8 )) {
+ sal_Int32 index = sizeof ("UNO_TYPES=") - 1;
+ do {
+ OUString token( line.getToken( 0, ' ', index ).trim() );
+ if (!token.isEmpty())
+ {
+ if (token[ 0 ] == '?')
+ token = token.copy( 1 );
+ if (create_ucb_content(
+ nullptr, expandUnoRcTerm(token), xCmdEnv,
+ false /* no throw */ ))
{
- if (token[ 0 ] == '?')
- token = token.copy( 1 );
- if (create_ucb_content(
- nullptr, expandUnoRcTerm(token), xCmdEnv,
- false /* no throw */ ))
- {
- //The RDB file may not exist anymore if a shared or bundled
- //extension was removed, but it can still be in the unorc.
- //After running XExtensionManager::synchronize, the unorc is
- //cleaned up
- m_rdb_typelibs.push_back( token );
- }
+ //The RDB file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the unorc.
+ //After running XExtensionManager::synchronize, the unorc is
+ //cleaned up
+ m_rdb_typelibs.push_back( token );
}
}
- while (index >= 0);
}
- if (readLine( &line, "UNO_SERVICES=", ucb_content,
- RTL_TEXTENCODING_UTF8 ))
+ while (index >= 0);
+ }
+ if (readLine( &line, "UNO_SERVICES=", ucb_content,
+ RTL_TEXTENCODING_UTF8 ))
+ {
+ // The UNO_SERVICES line always has the BNF form
+ // "UNO_SERVICES="
+ // ("?$ORIGIN/" <common-rdb>)? -- first
+ // "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}"? -- second
+ // ("?" ("BUNDLED_EXTENSIONS" | -- third
+ // "UNO_SHARED_PACKAGES_CACHE" | "UNO_USER_PACKAGES_CACHE")
+ // ...)*
+ // so can unambiguously be split into its three parts:
+ int state = 1;
+ for (sal_Int32 i = RTL_CONSTASCII_LENGTH("UNO_SERVICES=");
+ i >= 0;)
{
- // The UNO_SERVICES line always has the BNF form
- // "UNO_SERVICES="
- // ("?$ORIGIN/" <common-rdb>)? -- first
- // "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}"? -- second
- // ("?" ("BUNDLED_EXTENSIONS" | -- third
- // "UNO_SHARED_PACKAGES_CACHE" | "UNO_USER_PACKAGES_CACHE")
- // ...)*
- // so can unambiguously be split into its three parts:
- int state = 1;
- for (sal_Int32 i = RTL_CONSTASCII_LENGTH("UNO_SERVICES=");
- i >= 0;)
+ OUString token(line.getToken(0, ' ', i));
+ if (!token.isEmpty())
{
- OUString token(line.getToken(0, ' ', i));
- if (!token.isEmpty())
+ if (state == 1 && token.match("?$ORIGIN/"))
{
- if (state == 1 && token.match("?$ORIGIN/"))
- {
- m_commonRDB_orig = token.copy(
- RTL_CONSTASCII_LENGTH("?$ORIGIN/"));
- state = 2;
- }
- else if ( state <= 2 && token == "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}" )
- {
- state = 3;
- }
- else
+ m_commonRDB_orig = token.copy(
+ RTL_CONSTASCII_LENGTH("?$ORIGIN/"));
+ state = 2;
+ }
+ else if ( state <= 2 && token == "${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}" )
+ {
+ state = 3;
+ }
+ else
+ {
+ if (token[0] == '?')
{
- if (token[0] == '?')
- {
- token = token.copy(1);
- }
- m_components.push_back(token);
- state = 3;
+ token = token.copy(1);
}
+ m_components.push_back(token);
+ state = 3;
}
}
}
+ }
- // native rc:
- if (create_ucb_content(
- &ucb_content,
- makeURL( getCachePath(), getPlatformString() + "rc"),
- xCmdEnv, false /* no throw */ )) {
- if (readLine( &line, "UNO_SERVICES=", ucb_content,
- RTL_TEXTENCODING_UTF8 )) {
- m_nativeRDB_orig = line.copy(
- sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 );
- }
+ // native rc:
+ if (create_ucb_content(
+ &ucb_content,
+ makeURL( getCachePath(), getPlatformString() + "rc"),
+ xCmdEnv, false /* no throw */ )) {
+ if (readLine( &line, "UNO_SERVICES=", ucb_content,
+ RTL_TEXTENCODING_UTF8 )) {
+ m_nativeRDB_orig = line.copy(
+ sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 );
}
}
- m_unorc_modified = false;
- m_unorc_inited = true;
}
+ m_unorc_modified = false;
+ m_unorc_inited = true;
}
@@ -1184,27 +1184,27 @@ void BackendImpl::ComponentPackageImpl::componentLiveInsertion(
SAL_WARN("desktop.deployment", "implementation already registered " << implementationName);
}
}
- if (!data.singletons.empty()) {
- css::uno::Reference< css::container::XNameContainer > cont(
- rootContext, css::uno::UNO_QUERY_THROW);
- for (auto const& singleton : data.singletons)
- {
- OUString name("/singletons/" + singleton.first);
- //TODO: Update should be atomic:
- try {
- cont->removeByName( name + "/arguments");
- } catch (const container::NoSuchElementException &) {}
- try {
- cont->insertByName( name + "/service", css::uno::Any(singleton.second));
- } catch (const container::ElementExistException &) {
- cont->replaceByName( name + "/service", css::uno::Any(singleton.second));
- }
- try {
- cont->insertByName(name, css::uno::Any());
- } catch (const container::ElementExistException &) {
- SAL_WARN("desktop.deployment", "singleton already registered " << singleton.first);
- cont->replaceByName(name, css::uno::Any());
- }
+ if (data.singletons.empty()) return;
+
+ css::uno::Reference< css::container::XNameContainer > cont(
+ rootContext, css::uno::UNO_QUERY_THROW);
+ for (auto const& singleton : data.singletons)
+ {
+ OUString name("/singletons/" + singleton.first);
+ //TODO: Update should be atomic:
+ try {
+ cont->removeByName( name + "/arguments");
+ } catch (const container::NoSuchElementException &) {}
+ try {
+ cont->insertByName( name + "/service", css::uno::Any(singleton.second));
+ } catch (const container::ElementExistException &) {
+ cont->replaceByName( name + "/service", css::uno::Any(singleton.second));
+ }
+ try {
+ cont->insertByName(name, css::uno::Any());
+ } catch (const container::ElementExistException &) {
+ SAL_WARN("desktop.deployment", "singleton already registered " << singleton.first);
+ cont->replaceByName(name, css::uno::Any());
}
}
}
@@ -1224,23 +1224,24 @@ void BackendImpl::ComponentPackageImpl::componentLiveRemoval(
// ignore if factory has not been live deployed
}
}
- if (!data.singletons.empty()) {
- css::uno::Reference< css::container::XNameContainer > cont(
- rootContext, css::uno::UNO_QUERY_THROW);
- for (auto const& singleton : data.singletons)
- {
- OUString name("/singletons/" + singleton.first);
- //TODO: Removal should be atomic:
- try {
- cont->removeByName(name);
- } catch (const container::NoSuchElementException &) {}
- try {
- cont->removeByName( name + "/service" );
- } catch (const container::NoSuchElementException &) {}
- try {
- cont->removeByName( name + "/arguments" );
- } catch (const container::NoSuchElementException &) {}
- }
+ if (data.singletons.empty())
+ return;
+
+ css::uno::Reference< css::container::XNameContainer > cont(
+ rootContext, css::uno::UNO_QUERY_THROW);
+ for (auto const& singleton : data.singletons)
+ {
+ OUString name("/singletons/" + singleton.first);
+ //TODO: Removal should be atomic:
+ try {
+ cont->removeByName(name);
+ } catch (const container::NoSuchElementException &) {}
+ try {
+ cont->removeByName( name + "/service" );
+ } catch (const container::NoSuchElementException &) {}
+ try {
+ cont->removeByName( name + "/arguments" );
+ } catch (const container::NoSuchElementException &) {}
}
}
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 9b7d4386fec5..ee1d6eb49886 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -350,54 +350,54 @@ void BackendImpl::configmgrini_verify_init(
if (transientMode())
return;
const ::osl::MutexGuard guard( getMutex() );
- if (! m_configmgrini_inited)
+ if ( m_configmgrini_inited)
+ return;
+
+ // common rc:
+ ::ucbhelper::Content ucb_content;
+ if (create_ucb_content(
+ &ucb_content,
+ makeURL( getCachePath(), "configmgr.ini" ),
+ xCmdEnv, false /* no throw */ ))
{
- // common rc:
- ::ucbhelper::Content ucb_content;
- if (create_ucb_content(
- &ucb_content,
- makeURL( getCachePath(), "configmgr.ini" ),
- xCmdEnv, false /* no throw */ ))
+ OUString line;
+ if (readLine( &line, "SCHEMA=", ucb_content,
+ RTL_TEXTENCODING_UTF8 ))
{
- OUString line;
- if (readLine( &line, "SCHEMA=", ucb_content,
- RTL_TEXTENCODING_UTF8 ))
- {
- sal_Int32 index = RTL_CONSTASCII_LENGTH("SCHEMA=");
- do {
- OUString token( line.getToken( 0, ' ', index ).trim() );
- if (!token.isEmpty()) {
- //The file may not exist anymore if a shared or bundled
- //extension was removed, but it can still be in the configmgrini.
- //After running XExtensionManager::synchronize, the configmgrini is
- //cleaned up
- m_xcs_files.push_back( token );
- }
+ sal_Int32 index = RTL_CONSTASCII_LENGTH("SCHEMA=");
+ do {
+ OUString token( line.getToken( 0, ' ', index ).trim() );
+ if (!token.isEmpty()) {
+ //The file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the configmgrini.
+ //After running XExtensionManager::synchronize, the configmgrini is
+ //cleaned up
+ m_xcs_files.push_back( token );
}
- while (index >= 0);
}
- if (readLine( &line, "DATA=", ucb_content,
- RTL_TEXTENCODING_UTF8 )) {
- sal_Int32 index = RTL_CONSTASCII_LENGTH("DATA=");
- do {
- OUString token( line.getToken( 0, ' ', index ).trim() );
- if (!token.isEmpty())
- {
- if (token[ 0 ] == '?')
- token = token.copy( 1 );
- //The file may not exist anymore if a shared or bundled
- //extension was removed, but it can still be in the configmgrini.
- //After running XExtensionManager::synchronize, the configmgrini is
- //cleaned up
- m_xcu_files.push_back( token );
- }
+ while (index >= 0);
+ }
+ if (readLine( &line, "DATA=", ucb_content,
+ RTL_TEXTENCODING_UTF8 )) {
+ sal_Int32 index = RTL_CONSTASCII_LENGTH("DATA=");
+ do {
+ OUString token( line.getToken( 0, ' ', index ).trim() );
+ if (!token.isEmpty())
+ {
+ if (token[ 0 ] == '?')
+ token = token.copy( 1 );
+ //The file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the configmgrini.
+ //After running XExtensionManager::synchronize, the configmgrini is
+ //cleaned up
+ m_xcu_files.push_back( token );
}
- while (index >= 0);
}
+ while (index >= 0);
}
- m_configmgrini_modified = false;
- m_configmgrini_inited = true;
}
+ m_configmgrini_modified = false;
+ m_configmgrini_inited = true;
}
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 0dab3ad8d69b..e6339def509a 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -553,17 +553,18 @@ void Package::fireModified()
{
::cppu::OInterfaceContainerHelper * container = rBHelper.getContainer(
cppu::UnoType<util::XModifyListener>::get() );
- if (container != nullptr) {
- Sequence< Reference<XInterface> > elements(
- container->getElements() );
- lang::EventObject evt( static_cast<OWeakObject *>(this) );
- for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos )
- {
- Reference<util::XModifyListener> xListener(
- elements[ pos ], UNO_QUERY );
- if (xListener.is())
- xListener->modified( evt );
- }
+ if (container == nullptr)
+ return;
+
+ Sequence< Reference<XInterface> > elements(
+ container->getElements() );
+ lang::EventObject evt( static_cast<OWeakObject *>(this) );
+ for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos )
+ {
+ Reference<util::XModifyListener> xListener(
+ elements[ pos ], UNO_QUERY );
+ if (xListener.is())
+ xListener->modified( evt );
}
}
diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index 27cf615eb41b..eddb42b28a40 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -129,20 +129,20 @@ BackendImpl::BackendImpl(
m_typeInfos( 1 )
{
m_typeInfos[ 0 ] = m_xHelpTypeInfo;
- if (!transientMode())
- {
- OUString dbFile = makeURL(getCachePath(), "backenddb.xml");
- m_backendDb.reset(
- new HelpBackendDb(getComponentContext(), dbFile));
-
- //clean up data folders which are no longer used.
- //This must not be done in the same process where the help files
- //are still registers. Only after revoking and restarting OOo the folders
- //can be removed. This works now, because the extension manager is a singleton
- //and the backends are only create once per process.
- std::vector<OUString> folders = m_backendDb->getAllDataUrls();
- deleteUnusedFolders(folders);
- }
+ if (transientMode())
+ return;
+
+ OUString dbFile = makeURL(getCachePath(), "backenddb.xml");
+ m_backendDb.reset(
+ new HelpBackendDb(getComponentContext(), dbFile));
+
+ //clean up data folders which are no longer used.
+ //This must not be done in the same process where the help files
+ //are still registers. Only after revoking and restarting OOo the folders
+ //can be removed. This works now, because the extension manager is a singleton
+ //and the backends are only create once per process.
+ std::vector<OUString> folders = m_backendDb->getAllDataUrls();
+ deleteUnusedFolders(folders);
}
// XPackageRegistry
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 9cc78c7e6bc3..ce8fe18a44c0 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -1454,28 +1454,28 @@ void BackendImpl::PackageImpl::scanBundle(
}
}
- if (!descrFile.isEmpty())
+ if (descrFile.isEmpty())
+ return;
+
+ ::ucbhelper::Content descrFileContent;
+ if (!create_ucb_content( &descrFileContent, descrFile,
+ xCmdEnv, false /* no throw */ ))
+ return;
+
+ // patch description:
+ std::vector<sal_Int8> bytes( readFile( descrFileContent ) );
+ OUStringBuffer buf;
+ if ( !bytes.empty() )
{
- ::ucbhelper::Content descrFileContent;
- if (create_ucb_content( &descrFileContent, descrFile,
- xCmdEnv, false /* no throw */ ))
- {
- // patch description:
- std::vector<sal_Int8> bytes( readFile( descrFileContent ) );
- OUStringBuffer buf;
- if ( !bytes.empty() )
- {
- buf.append( OUString( reinterpret_cast<char const *>(
- bytes.data() ),
- bytes.size(), RTL_TEXTENCODING_UTF8 ) );
- }
- else
- {
- buf.append( Package::getDescription() );
- }
- m_oldDescription = buf.makeStringAndClear();
- }
+ buf.append( OUString( reinterpret_cast<char const *>(
+ bytes.data() ),
+ bytes.size(), RTL_TEXTENCODING_UTF8 ) );
+ }
+ else
+ {
+ buf.append( Package::getDescription() );
}
+ m_oldDescription = buf.makeStringAndClear();
}