summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-20 16:14:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-21 15:41:50 +0200
commit2a612907aef4c9987f906c6b98aa9b400f58f617 (patch)
tree6170f363054cabb1cd33af9208145827b22c83a1 /cppuhelper
parent3a481dde031ba416ec4ef0351130e26e49417418 (diff)
loplugin:flatten in connectivity..desktop
Change-Id: Iff59d3049ba40b4338ef8eec67d08a96b0834d2b Reviewed-on: https://gerrit.libreoffice.org/42578 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/servicemanager.cxx48
1 files changed, 22 insertions, 26 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index c77526de6441..7e6c178c4e7c 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -410,23 +410,22 @@ rtl::OUString Parser::getNameAttribute() {
xmlreader::Span name;
int nsId;
while (reader_.nextAttribute(&nsId, &name)) {
- if (nsId == xmlreader::XmlReader::NAMESPACE_NONE
- && name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
+ if (nsId != xmlreader::XmlReader::NAMESPACE_NONE
+ || !name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
{
- if (!attrName.isEmpty()) {
- throw css::registry::InvalidRegistryException(
- reader_.getUrl()
- + ": element has multiple \"name\" attributes");
- }
- attrName = reader_.getAttributeValue(false).convertFromUtf8();
- if (attrName.isEmpty()) {
- throw css::registry::InvalidRegistryException(
- reader_.getUrl() + ": element has empty \"name\" attribute");
- }
- } else {
throw css::registry::InvalidRegistryException(
reader_.getUrl() + ": expected element attribute \"name\"");
}
+ if (!attrName.isEmpty()) {
+ throw css::registry::InvalidRegistryException(
+ reader_.getUrl()
+ + ": element has multiple \"name\" attributes");
+ }
+ attrName = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrName.isEmpty()) {
+ throw css::registry::InvalidRegistryException(
+ reader_.getUrl() + ": element has empty \"name\" attribute");
+ }
}
if (attrName.isEmpty()) {
throw css::registry::InvalidRegistryException(
@@ -910,15 +909,14 @@ void cppuhelper::ServiceManager::initialize(
css::uno::Sequence<css::uno::Any> const & aArguments)
{
OUString arg;
- if (aArguments.getLength() == 1 && (aArguments[0] >>= arg)
- && arg == "preload")
+ if (aArguments.getLength() != 1 || !(aArguments[0] >>= arg)
+ || arg != "preload")
{
- preloadImplementations();
- } else {
throw css::lang::IllegalArgumentException(
"invalid ServiceManager::initialize argument",
css::uno::Reference<css::uno::XInterface>(), 0);
}
+ preloadImplementations();
}
rtl::OUString cppuhelper::ServiceManager::getImplementationName()
@@ -1106,19 +1104,17 @@ void cppuhelper::ServiceManager::remove(css::uno::Any const & aElement)
if (aElement >>= args) {
std::vector< rtl::OUString > uris;
for (sal_Int32 i = 0; i < args.getLength(); ++i) {
- if (args[i].Name == "uri") {
- rtl::OUString uri;
- if (!(args[i].Value >>= uri)) {
- throw css::lang::IllegalArgumentException(
- "Bad uri argument",
- static_cast< cppu::OWeakObject * >(this), 0);
- }
- uris.push_back(uri);
- } else {
+ if (args[i].Name != "uri") {
throw css::lang::IllegalArgumentException(
"Bad argument " + args[i].Name,
static_cast< cppu::OWeakObject * >(this), 0);
+ } rtl::OUString uri;
+ if (!(args[i].Value >>= uri)) {
+ throw css::lang::IllegalArgumentException(
+ "Bad uri argument",
+ static_cast< cppu::OWeakObject * >(this), 0);
}
+ uris.push_back(uri);
}
removeRdbFiles(uris);
return;