# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # Version: MPL 1.1 / GPLv3+ / LGPLv3+ # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License or as specified alternatively below. You may obtain a copy of # the License at http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # Major Contributor(s): # Copyright (C) 2012 Red Hat, Inc., David Tardon # (initial developer) # # All Rights Reserved. # # For minor contributions see the git repository. # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 3 or later (the "GPLv3+"), or # the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable # instead of those above. $(eval $(call gb_InstallScript_InstallScript,test)) $(eval $(call gb_InstallScript_use_modules,test,\ scp2/smoketest \ )) # vim: set shiftwidth=4 tabstop=4 noexpandtab: eoffice-5-2'>distro/cib/libreoffice-5-2 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 12:53:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-23 09:02:58 +0200
commita8622c77d26ca7a635afc95bba9a5054dc31eb7c (patch)
treeecb1ce71272291515dec10fc5fe94061f7231b78 /stoc
parent2684aefcf5d2804351bda01a2d2fe7bbbd351451 (diff)
loplugin:flatten in sdext..stoc
Change-Id: I460e813e20a691c53738373376d3363f553bbab2 Reviewed-on: https://gerrit.libreoffice.org/42636 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/corereflection/crcomp.cxx14
-rw-r--r--stoc/source/corereflection/crefl.cxx8
-rw-r--r--stoc/source/corereflection/criface.cxx5
-rw-r--r--stoc/source/defaultregistry/defaultregistry.cxx60
-rw-r--r--stoc/source/inspect/introspection.cxx5
-rw-r--r--stoc/source/javaloader/javaloader.cxx10
-rw-r--r--stoc/source/security/access_controller.cxx16
-rw-r--r--stoc/source/typeconv/convert.cxx31
8 files changed, 62 insertions, 87 deletions
diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx
index 0a0572676a73..01e043144075 100644
--- a/stoc/source/corereflection/crcomp.cxx
+++ b/stoc/source/corereflection/crcomp.cxx
@@ -210,16 +210,13 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
if (pTD)
{
TYPELIB_DANGER_RELEASE( pObjTD );
- if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
- {
- return;
- }
- else
+ if (!coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
{
throw IllegalArgumentException(
"cannot assign value to destination",
static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
}
+ return;
}
TYPELIB_DANGER_RELEASE( pObjTD );
}
@@ -246,16 +243,13 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue )
if (pTD)
{
TYPELIB_DANGER_RELEASE( pObjTD );
- if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
- {
- return;
- }
- else
+ if (!coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
{
throw IllegalArgumentException(
"cannot assign to destination",
static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
}
+ return;
}
TYPELIB_DANGER_RELEASE( pObjTD );
}
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index 00c9429b3586..8982b768a684 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -264,12 +264,10 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName )
// else is enum member(?)
// update
- if (aRet.hasValue())
- _aElements.setValue( rName, aRet );
- else
- {
+ if (!aRet.hasValue())
throw container::NoSuchElementException( rName );
- }
+
+ _aElements.setValue( rName, aRet );
}
return aRet;
}
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index 680e55083dd4..841cb235eb90 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -296,16 +296,15 @@ void IdlAttributeFieldImpl::checkException(
&e, exception->pData, exception->pType,
getReflection()->getUno2Cpp().get());
uno_any_destruct(exception, nullptr);
- if (e.isExtractableTo(
+ if (!e.isExtractableTo(
cppu::UnoType<RuntimeException>::get()))
{
- cppu::throwException(e);
- } else {
throw WrappedTargetRuntimeException(
"non-RuntimeException occurred when accessing an"
" interface type attribute",
context, e);
}
+ cppu::throwException(e);
}
}
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index fb54149dc27d..5f24b18e34f6 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -263,10 +263,10 @@ sal_Bool SAL_CALL NestedKeyImpl::isReadOnly( )
Guard< Mutex > aGuard( m_xRegistry->m_mutex );
computeChanges();
- if ( m_localKey.is() && m_localKey->isValid() )
- return m_localKey->isReadOnly();
- else
+ if ( !m_localKey.is() || !m_localKey->isValid() )
throw InvalidRegistryException();
+
+ return m_localKey->isReadOnly();
}
@@ -724,22 +724,20 @@ void SAL_CALL NestedKeyImpl::closeKey( )
void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
{
Guard< Mutex > aGuard( m_xRegistry->m_mutex );
- if ( m_localKey.is() && m_localKey->isValid() &&
- !m_localKey->isReadOnly() )
+ if ( !m_localKey.is() || !m_localKey->isValid() ||
+ m_localKey->isReadOnly() )
{
- OUString resolvedName = computeName(rKeyName);
+ throw InvalidRegistryException();
+ }
- if ( resolvedName.isEmpty() )
- {
- throw InvalidRegistryException();
- }
+ OUString resolvedName = computeName(rKeyName);
- m_xRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
- }
- else
+ if ( resolvedName.isEmpty() )
{
throw InvalidRegistryException();
}
+
+ m_xRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
}
@@ -976,15 +974,13 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
resolvedName = m_name + "/" + rLinkName;
}
- if ( m_localKey.is() && m_localKey->isValid() &&
- !m_localKey->isReadOnly() )
- {
- m_xRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
- }
- else
+ if ( !m_localKey.is() || !m_localKey->isValid() ||
+ m_localKey->isReadOnly() )
{
throw InvalidRegistryException();
}
+
+ m_xRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
}
@@ -1224,25 +1220,23 @@ void SAL_CALL NestedRegistryImpl::destroy( )
Reference< XRegistryKey > SAL_CALL NestedRegistryImpl::getRootKey( )
{
Guard< Mutex > aGuard( m_mutex );
- if ( m_localReg.is() && m_localReg->isValid() )
+ if ( !m_localReg.is() || !m_localReg->isValid() )
{
- Reference<XRegistryKey> localKey, defaultKey;
+ throw InvalidRegistryException();
+ }
- localKey = m_localReg->getRootKey();
+ Reference<XRegistryKey> localKey, defaultKey;
- if ( localKey.is() )
- {
- if ( m_defaultReg.is() && m_defaultReg->isValid() )
- {
- defaultKey = m_defaultReg->getRootKey();
- }
+ localKey = m_localReg->getRootKey();
- return static_cast<XRegistryKey*>(new NestedKeyImpl(this, localKey, defaultKey));
- }
- }
- else
+ if ( localKey.is() )
{
- throw InvalidRegistryException();
+ if ( m_defaultReg.is() && m_defaultReg->isValid() )
+ {
+ defaultKey = m_defaultReg->getRootKey();
+ }
+
+ return static_cast<XRegistryKey*>(new NestedKeyImpl(this, localKey, defaultKey));
}
return Reference<XRegistryKey>();
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 063e868a1604..3bb086d5ad7d 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -372,10 +372,9 @@ void IntrospectionAccessStatic_Impl::setPropertyValue( const Any& obj, const OUS
//void IntrospectionAccessStatic_Impl::setPropertyValue( Any& obj, const OUString& aPropertyName, const Any& aValue ) const
{
sal_Int32 i = getPropertyIndex( aPropertyName );
- if( i != -1 )
- setPropertyValueByIndex( obj, i, aValue );
- else
+ if( i == -1 )
throw UnknownPropertyException(aPropertyName);
+ setPropertyValueByIndex( obj, i, aValue );
}
void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal_Int32 nSequenceIndex, const Any& aValue) const
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 01000b0ab827..2139815d357c 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -310,10 +310,9 @@ sal_Bool SAL_CALL JavaComponentLoader::writeRegistryInfo(
const OUString & rLibName)
{
const css::uno::Reference<XImplementationLoader> & loader = getJavaLoader();
- if (loader.is())
- return loader->writeRegistryInfo(xKey, blabla, rLibName);
- else
+ if (!loader.is())
throw CannotRegisterImplementationException("Could not create Java implementation loader");
+ return loader->writeRegistryInfo(xKey, blabla, rLibName);
}
@@ -322,10 +321,9 @@ css::uno::Reference<XInterface> SAL_CALL JavaComponentLoader::activate(
const css::uno::Reference<XRegistryKey> & xKey)
{
const css::uno::Reference<XImplementationLoader> & loader = getJavaLoader();
- if (loader.is())
- return loader->activate(rImplName, blabla, rLibName, xKey);
- else
+ if (!loader.is())
throw CannotActivateFactoryException("Could not create Java implementation loader");
+ return loader->activate(rImplName, blabla, rLibName, xKey);
}
static Mutex & getInitMutex()
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 65771de2bd99..06fdc0e4cfbf 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -439,19 +439,17 @@ Reference< security::XPolicy > const & AccessController::getPolicy()
Reference< security::XPolicy > xPolicy;
m_xComponentContext->getValueByName(
"/singletons/com.sun.star.security.thePolicy" ) >>= xPolicy;
- if (xPolicy.is())
- {
- MutexGuard guard( m_mutex );
- if (! m_xPolicy.is())
- {
- m_xPolicy = xPolicy;
- }
- }
- else
+ if (!xPolicy.is())
{
throw SecurityException(
"cannot get policy singleton!", static_cast<OWeakObject *>(this) );
}
+
+ MutexGuard guard( m_mutex );
+ if (! m_xPolicy.is())
+ {
+ m_xPolicy = xPolicy;
+ }
}
return m_xPolicy;
}
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx