summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-26 12:01:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-27 09:05:39 +0200
commit467724410dc470ec259131f97abd836fe9b021a1 (patch)
treec4af76c0132cc6a4638eace0ccebe5ae1bd9e305 /ucb
parente827d227c92c338fb75f076b6d3f3a7b52b9f767 (diff)
loplugin:flatten in toolkit..vbahelper
Change-Id: I6d4be3e1cc29b2b91d5c39b757ff3b903c47112d Reviewed-on: https://gerrit.libreoffice.org/42794 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/file/prov.cxx6
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx5
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.cxx78
-rw-r--r--ucb/source/ucp/webdav-neon/NeonInputStream.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx71
5 files changed, 79 insertions, 87 deletions
diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index f2f888ed8d31..c0ce411df4e0 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -394,11 +394,9 @@ void SAL_CALL
FileProvider::setPropertyValue( const OUString& aPropertyName,
const Any& )
{
- if( aPropertyName == "FileSystemNotation" ||
+ if( !(aPropertyName == "FileSystemNotation" ||
aPropertyName == "HomeDirectory" ||
- aPropertyName == "HostName" )
- return;
- else
+ aPropertyName == "HostName") )
throw UnknownPropertyException( THROW_WHERE );
}
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 9b5f1a8e308a..9eac0b3acdce 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -187,10 +187,9 @@ Reference<XContent> SAL_CALL FTPContentProvider::queryContent(
}
else {
Reference<XContentProvider> xProvider(UniversalContentBroker::create( m_xContext )->queryContentProvider("http:"));
- if(xProvider.is())
- return xProvider->queryContent(xCanonicId);
- else
+ if(!xProvider.is())
throw RuntimeException();
+ return xProvider->queryContent(xCanonicId);
}
} catch(const malformed_exception&) {
throw IllegalIdentifierException();
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index dbcd58851012..4d972b4a6425 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -170,54 +170,50 @@ ContentProvider::createDocumentContent(
const uno::Reference< frame::XModel >& Model )
{
// model -> id -> content identifier -> queryContent
- if ( m_xDocsMgr.is() )
+ if ( !m_xDocsMgr.is() )
+ {
+ throw lang::IllegalArgumentException(
+ "No Document Manager!",
+ static_cast< cppu::OWeakObject * >( this ),
+ 1 );
+ }
+
+ OUString aDocId = tdoc_ucp::OfficeDocumentsManager::queryDocumentId( Model );
+ if ( aDocId.isEmpty() )
{
- OUString aDocId = tdoc_ucp::OfficeDocumentsManager::queryDocumentId( Model );
- if ( !aDocId.isEmpty() )
- {
- OUStringBuffer aBuffer;
- aBuffer.append( TDOC_URL_SCHEME ":/" );
- aBuffer.append( aDocId );
+ throw lang::IllegalArgumentException(
+ "Unable to obtain document id from model!",
+ static_cast< cppu::OWeakObject * >( this ),
+ 1 );
+ }
- uno::Reference< ucb::XContentIdentifier > xId
- = new ::ucbhelper::ContentIdentifier( aBuffer.makeStringAndClear() );
+ OUStringBuffer aBuffer;
+ aBuffer.append( TDOC_URL_SCHEME ":/" );
+ aBuffer.append( aDocId );
- osl::MutexGuard aGuard( m_aMutex );
+ uno::Reference< ucb::XContentIdentifier > xId
+ = new ::ucbhelper::ContentIdentifier( aBuffer.makeStringAndClear() );
- // Check, if a content with given id already exists...
- uno::Reference< ucb::XContent > xContent
- = queryExistingContent( xId ).get();
+ osl::MutexGuard aGuard( m_aMutex );
- if ( !xContent.is() )
- {
- // Create a new content.
- xContent = Content::create( m_xContext, this, xId );
- }
+ // Check, if a content with given id already exists...
+ uno::Reference< ucb::XContent > xContent
+ = queryExistingContent( xId ).get();
- if ( xContent.is() )
- return xContent;
+ if ( !xContent.is() )
+ {
+ // Create a new content.
+ xContent = Content::create( m_xContext, this, xId );
+ }
- // no content.
- throw lang::IllegalArgumentException(
- "Illegal Content Identifier!",
- static_cast< cppu::OWeakObject * >( this ),
- 1 );
- }
- else
- {
- throw lang::IllegalArgumentException(
- "Unable to obtain document id from model!",
- static_cast< cppu::OWeakObject * >( this ),
- 1 );
- }
- }
- else
- {
- throw lang::IllegalArgumentException(
- "No Document Manager!",
- static_cast< cppu::OWeakObject * >( this ),
- 1 );
- }
+ if ( xContent.is() )
+ return xContent;
+
+ // no content.
+ throw lang::IllegalArgumentException(
+ "Illegal Content Identifier!",
+ static_cast< cppu::OWeakObject * >( this ),
+ 1 );
}
diff --git a/ucb/source/ucp/webdav-neon/NeonInputStream.cxx b/ucb/source/ucp/webdav-neon/NeonInputStream.cxx
index 6958ad90ea3c..3e43456a1838 100644
--- a/ucb/source/ucp/webdav-neon/NeonInputStream.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonInputStream.cxx
@@ -117,10 +117,10 @@ void SAL_CALL NeonInputStream::seek( sal_Int64 location )
if ( location < 0 )
throw css::lang::IllegalArgumentException();
- if ( location <= mLen )
- mPos = location;
- else
+ if ( location > mLen )
throw css::lang::IllegalArgumentException();
+
+ mPos = location;
}
sal_Int64 SAL_CALL NeonInputStream::getPosition()
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index cc381283dd98..c49caa3d8367 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -2553,53 +2553,52 @@ void Content::insert(
if ( Environment.is() )
xIH = Environment->getInteractionHandler();
- if ( xIH.is() )
+ if ( !xIH.is() )
{
- uno::Any aExAsAny( uno::makeAny( aEx ) );
+ // No IH; throw.
+ throw aEx;
+ }
- rtl::Reference< ucbhelper::SimpleInteractionRequest > xRequest
- = new ucbhelper::SimpleInteractionRequest(
- aExAsAny,
- ContinuationFlags::Approve | ContinuationFlags::Disapprove );
- xIH->handle( xRequest.get() );
+ uno::Any aExAsAny( uno::makeAny( aEx ) );
- const ContinuationFlags nResp = xRequest->getResponse();
+ rtl::Reference< ucbhelper::SimpleInteractionRequest > xRequest
+ = new ucbhelper::SimpleInteractionRequest(
+ aExAsAny,
+ ContinuationFlags::Approve | ContinuationFlags::Disapprove );
+ xIH->handle( xRequest.get() );
- switch ( nResp )
- {
- case ContinuationFlags::NONE:
- // Not handled; throw.
- throw aEx;
+ const ContinuationFlags nResp = xRequest->getResponse();
+
+ switch ( nResp )
+ {
+ case ContinuationFlags::NONE:
+ // Not handled; throw.
+ throw aEx;
// break;
- case ContinuationFlags::Approve:
- // Continue -> Overwrite.
- bReplaceExisting = true;
- break;
+ case ContinuationFlags::Approve:
+ // Continue -> Overwrite.
+ bReplaceExisting = true;
+ break;
- case ContinuationFlags::Disapprove:
- // Abort.
- throw ucb::CommandFailedException(
- OUString(),
- uno::Reference< uno::XInterface >(),
- aExAsAny );
+ case ContinuationFlags::Disapprove:
+ // Abort.
+ throw ucb::CommandFailedException(
+ OUString(),
+ uno::Reference< uno::XInterface >(),
+ aExAsAny );
// break;
- default:
- SAL_WARN( "ucb.ucp.webdav", "Content::insert - "
- "Unknown interaction selection!" );
- throw ucb::CommandFailedException(
- "Unknown interaction selection!",
- uno::Reference< uno::XInterface >(),
- aExAsAny );
+ default:
+ SAL_WARN( "ucb.ucp.webdav", "Content::insert - "
+ "Unknown interaction selection!" );
+ throw ucb::CommandFailedException(
+ "Unknown interaction selection!",
+ uno::Reference< uno::XInterface >(),
+ aExAsAny );
// break;
- }
- }
- else
- {
- // No IH; throw.
- throw aEx;
}
+
}
}