diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-02 10:36:43 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2013-05-22 10:44:29 +0000 |
commit | 6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch) | |
tree | 2746468845d6f1159e3759ee2cf7a620fca15b6e /ucb | |
parent | 697a007c61b9cabceb9767fad87cd5822b300452 (diff) |
Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases.
Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752
Reviewed-on: https://gerrit.libreoffice.org/4001
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/cacher/dynamicresultsetwrapper.cxx | 3 | ||||
-rw-r--r-- | ucb/source/ucp/file/bc.cxx | 3 | ||||
-rw-r--r-- | ucb/source/ucp/file/filglob.cxx | 23 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ftpcontent.cxx | 3 |
4 files changed, 10 insertions, 22 deletions
diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx index 3faca33ec7aa..e50863fc2c90 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.cxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx @@ -353,8 +353,7 @@ Reference< XResultSet > SAL_CALL DynamicResultSetWrapper if( xSource.is() ) { - Reference< XComponent > xSourceComponent( xSource, UNO_QUERY ); - xSourceComponent->addEventListener( xMyListenerImpl ); + xSource->addEventListener( xMyListenerImpl ); } if( !xSource.is() ) m_aSourceSet.wait(); diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 2959d5dea872..302149cc11bf 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -743,8 +743,7 @@ BaseContent::getParent( try { - Reference< XContent > content = m_pMyShell->m_pProvider->queryContent( Identifier ); - return Reference<XInterface>(content,UNO_QUERY); + return m_pMyShell->m_pProvider->queryContent( Identifier ); } catch (const IllegalIdentifierException&) { diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index c3f22b6a2f01..e2172875fcfa 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -541,12 +541,11 @@ namespace fileaccess { } else if(errorCode == TASKHANDLING_INPUTSTREAM_FOR_WRITE) { - Reference<XInterface> xContext(xComProc,UNO_QUERY); aAny <<= MissingInputStreamException( OUString( "the inputstream is missing necessary" "to create a content"), - xContext); + xComProc); cancelCommandExecution(aAny,xEnv); } else if( errorCode == TASKHANDLING_NOREPLACE_FOR_WRITE ) @@ -555,8 +554,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "file exists and overwrite forbidden"); aAny <<= excep; cancelCommandExecution( aAny,xEnv ); @@ -578,8 +576,7 @@ namespace fileaccess { seq[0] <<= prop; excep.Arguments = seq; excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "the name contained invalid characters"); if(isHandled) throw excep; @@ -600,8 +597,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "folder exists and overwrite forbidden"); if(isHandled) throw excep; @@ -793,12 +789,10 @@ namespace fileaccess { } else if( errorCode == TASKHANDLING_TRANSFER_INVALIDSCHEME ) { - Reference<XInterface> xContext(xComProc,UNO_QUERY); - aAny <<= InteractiveBadTransferURLException( OUString( "bad tranfer url"), - xContext); + xComProc); cancelCommandExecution( aAny,xEnv ); } else if( errorCode == TASKHANDLING_OVERWRITE_FOR_MOVE || @@ -859,8 +853,7 @@ namespace fileaccess { NameClashException excep; excep.Name = getTitle(aUncPath); excep.Classification = InteractionClassification_ERROR; - Reference<XInterface> xContext(xComProc,UNO_QUERY); - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "name clash during copy or move"); aAny <<= excep; @@ -869,11 +862,9 @@ namespace fileaccess { else if( errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_MOVE || errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_COPY ) { - Reference<XInterface> xContext( - xComProc,UNO_QUERY); UnsupportedNameClashException excep; excep.NameClash = minorCode; - excep.Context = xContext; + excep.Context = xComProc; excep.Message = OUString( "name clash value not supported during copy or move"); aAny <<= excep; diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index 3e145ad18766..eedc779a7736 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -673,8 +673,7 @@ FTPContent::getParent( ) { Reference<XContentIdentifier> xIdent(new FTPContentIdentifier(m_aFTPURL.parent(false))); - Reference<XContent> xContent(m_xProvider->queryContent(xIdent)); - return Reference<XInterface>(xContent,UNO_QUERY); + return m_xProvider->queryContent(xIdent); } |