[Libreoffice-commits] core.git: ucb/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 17 12:40:28 UTC 2019


 ucb/source/ucp/webdav/ContentProperties.cxx  |   10 ++--
 ucb/source/ucp/webdav/DAVSessionFactory.cxx  |    4 -
 ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx |    2 
 ucb/source/ucp/webdav/SerfUri.cxx            |    6 --
 ucb/source/ucp/webdav/SerfUri.hxx            |    1 
 ucb/source/ucp/webdav/webdavcontent.cxx      |   58 ++++++++++++---------------
 ucb/source/ucp/webdav/webdavcontent.hxx      |    2 
 ucb/source/ucp/webdav/webdavcontentcaps.cxx  |    4 -
 ucb/source/ucp/webdav/webdavdatasupplier.cxx |    2 
 ucb/source/ucp/webdav/webdavprovider.cxx     |    2 
 10 files changed, 42 insertions(+), 49 deletions(-)

New commits:
commit 7b9e75da2e057fe5b551bf7294814d1744fe653f
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 17 11:42:52 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Dec 17 13:38:27 2019 +0100

    Fix various Clang and loplugin warnings in --with-webdav=serf code
    
    Change-Id: I9390d9242b1ea4413ce01bff9002929e55c1617c
    Reviewed-on: https://gerrit.libreoffice.org/85277
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx
index 058b2a55c1c0..85406e680972 100644
--- a/ucb/source/ucp/webdav/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav/ContentProperties.cxx
@@ -231,7 +231,7 @@ void ContentProperties::UCBNamesToDAVNames(
         {
             if ( !bCreationDate )
             {
-                    propertyNames.push_back( DAVProperties::CREATIONDATE );
+                propertyNames.push_back( DAVProperties::CREATIONDATE );
                 bCreationDate = true;
             }
         }
@@ -240,7 +240,7 @@ void ContentProperties::UCBNamesToDAVNames(
         {
             if ( !bLastModified )
             {
-                    propertyNames.push_back(
+                propertyNames.push_back(
                     DAVProperties::GETLASTMODIFIED );
                 bLastModified = true;
             }
@@ -250,7 +250,7 @@ void ContentProperties::UCBNamesToDAVNames(
         {
             if ( !bContentType )
             {
-                    propertyNames.push_back(
+                propertyNames.push_back(
                         DAVProperties::GETCONTENTTYPE );
                 bContentType = true;
             }
@@ -260,7 +260,7 @@ void ContentProperties::UCBNamesToDAVNames(
         {
             if ( !bContentLength )
             {
-                    propertyNames.push_back(
+                propertyNames.push_back(
                     DAVProperties::GETCONTENTLENGTH );
                 bContentLength = true;
             }
@@ -272,7 +272,7 @@ void ContentProperties::UCBNamesToDAVNames(
         {
             if ( !bResourceType )
             {
-                    propertyNames.push_back( DAVProperties::RESOURCETYPE );
+                propertyNames.push_back( DAVProperties::RESOURCETYPE );
                 bResourceType = true;
             }
         }
diff --git a/ucb/source/ucp/webdav/DAVSessionFactory.cxx b/ucb/source/ucp/webdav/DAVSessionFactory.cxx
index 78aadb7e2dfa..6a0963f915d2 100644
--- a/ucb/source/ucp/webdav/DAVSessionFactory.cxx
+++ b/ucb/source/ucp/webdav/DAVSessionFactory.cxx
@@ -46,7 +46,7 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
         SerfUri aURI( inUri );
 
         std::unique_ptr< DAVSession > xElement(
-            new SerfSession( this, inUri, *m_xProxyDecider.get() ) );
+            new SerfSession( this, inUri, *m_xProxyDecider ) );
 
         aIt = m_aMap.emplace(  inUri, xElement.get() ).first;
         aIt->second->m_aContainerIt = aIt;
@@ -69,7 +69,7 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
         // call a little:
         SerfUri aURI( inUri );
 
-        aIt->second = new SerfSession( this, inUri, *m_xProxyDecider.get() );
+        aIt->second = new SerfSession( this, inUri, *m_xProxyDecider );
         aIt->second->m_aContainerIt = aIt;
         return aIt->second;
     }
diff --git a/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
index a08d260f01bd..466f7a10cacb 100644
--- a/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
@@ -67,7 +67,7 @@ serf_bucket_t * SerfPutReqProcImpl::createSerfRequestBucket( serf_request_t * in
     setRequestHeaders( hdrs_bkt );
 
     // 'If' header with token, so that we can save document locked by us
-    const OString sIfHeader( "<" + OString(getPathStr()) + "> (<" + OUStringToOString(
+    const OString sIfHeader( "<" + rtl::OStringView(getPathStr()) + "> (<" + OUStringToOString(
                 msToken, RTL_TEXTENCODING_UTF8) + ">)" );
     serf_bucket_headers_set( hdrs_bkt, "If", sIfHeader.getStr() );
 
diff --git a/ucb/source/ucp/webdav/SerfUri.cxx b/ucb/source/ucp/webdav/SerfUri.cxx
index f146dfade70b..dab11a64cfa9 100644
--- a/ucb/source/ucp/webdav/SerfUri.cxx
+++ b/ucb/source/ucp/webdav/SerfUri.cxx
@@ -109,10 +109,6 @@ void SerfUri::init( const apr_uri_t * pUri )
     }
 }
 
-SerfUri::~SerfUri( )
-{
-}
-
 void SerfUri::calculateURI ()
 {
     OUStringBuffer aBuf( mScheme );
@@ -183,7 +179,7 @@ OUString SerfUri::GetPathBaseName () const
         return aTemp;
     }
     else
-        return OUString("/");
+        return "/";
 }
 
 bool SerfUri::operator== ( const SerfUri & rOther ) const
diff --git a/ucb/source/ucp/webdav/SerfUri.hxx b/ucb/source/ucp/webdav/SerfUri.hxx
index f943cd489e0e..f47b2892e207 100644
--- a/ucb/source/ucp/webdav/SerfUri.hxx
+++ b/ucb/source/ucp/webdav/SerfUri.hxx
@@ -54,7 +54,6 @@ class SerfUri
         explicit SerfUri( const OUString & inUri );
         /// @throws DAVException
         explicit SerfUri( const apr_uri_t * inUri );
-        ~SerfUri( );
 
         bool operator== ( const SerfUri & rOther ) const;
         bool operator!= ( const SerfUri & rOther ) const
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index de9031a30781..6c0198199011 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -21,7 +21,6 @@
 
 #include <cppuhelper/queryinterface.hxx>
 #include <rtl/uri.hxx>
-#include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
 #include <ucbhelper/contentidentifier.hxx>
 #include <ucbhelper/macros.hxx>
@@ -388,7 +387,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
 // virtual
 OUString SAL_CALL Content::getImplementationName()
 {
-    return OUString( "com.sun.star.comp.ucb.WebDAVContent" );
+    return "com.sun.star.comp.ucb.WebDAVContent";
 }
 
 
@@ -421,9 +420,9 @@ OUString SAL_CALL Content::getContentType()
     }
 
     if ( bFolder )
-        return OUString( WEBDAV_COLLECTION_TYPE );
+        return WEBDAV_COLLECTION_TYPE;
 
-    return OUString( WEBDAV_CONTENT_TYPE );
+    return WEBDAV_CONTENT_TYPE;
 }
 
 
@@ -575,7 +574,7 @@ uno::Any SAL_CALL Content::execute(
             std::unique_ptr< DAVResourceAccess > xResAccess;
             {
                 osl::Guard< osl::Mutex > aGuard( m_aMutex );
-                xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+                xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
             }
             xResAccess->DESTROY( Environment );
             {
@@ -763,7 +762,7 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
         std::unique_ptr< DAVResourceAccess > xResAccess;
         {
             osl::MutexGuard aGuard( m_aMutex );
-            xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+            xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
         DAVResourceAccess::abort();
         {
@@ -841,7 +840,7 @@ void Content::addProperty( const css::ucb::PropertyCommandArgument &aCmdArg,
         std::unique_ptr< DAVResourceAccess > xResAccess;
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
-            xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+            xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
         xResAccess->PROPPATCH( aProppatchValues, xEnv );
         {
@@ -947,7 +946,7 @@ void Content::removeProperty( const OUString& Name,
         std::unique_ptr< DAVResourceAccess > xResAccess;
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
-            xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+            xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
         xResAccess->PROPPATCH( aProppatchValues, xEnv );
         {
@@ -1195,10 +1194,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
                 // Process local Additional Properties.
                 if ( !bTriedToGetAdditionalPropSet && !xAdditionalPropSet.is() )
                 {
-                    xAdditionalPropSet.set(
+                    xAdditionalPropSet =
                             rProvider->getAdditionalPropertySet( rContentId,
-                                                                 false ),
-                            uno::UNO_QUERY );
+                                                                 false );
                     bTriedToGetAdditionalPropSet = true;
                 }
 
@@ -1229,9 +1227,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
         }
 
         // Append all local Additional Properties.
-        uno::Reference< beans::XPropertySet > xSet(
-            rProvider->getAdditionalPropertySet( rContentId, false ),
-            uno::UNO_QUERY );
+        uno::Reference< beans::XPropertySet > xSet =
+            rProvider->getAdditionalPropertySet( rContentId, false );
         xRow->appendPropertySet( xSet );
     }
 
@@ -1259,12 +1256,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
         xContext.set( m_xContext );
         xIdentifier.set( m_xIdentifier );
         xProvider.set( m_xProvider.get() );
-        xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+        xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
 
         // First, ask cache...
         if ( m_xCachedProps.get() )
         {
-            xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) );
+            xCachedProps.reset( new ContentProperties( *m_xCachedProps ) );
 
             std::vector< OUString > aMissingProps;
             if ( xCachedProps->containsAllNames( rProperties, aMissingProps ) )
@@ -1294,7 +1291,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
             if ( m_xCachedProps.get() )
             {
                 xCachedProps.reset(
-                    new ContentProperties( *m_xCachedProps.get() ) );
+                    new ContentProperties( *m_xCachedProps ) );
 
                 std::vector< OUString > aMissingProps;
                 if ( xCachedProps->containsAllNames(
@@ -1581,7 +1578,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
         xProvider.set( m_pProvider );
         xIdentifier.set( m_xIdentifier );
         bTransient = m_bTransient;
-        xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+        xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
     }
 
     uno::Sequence< uno::Any > aRet( rValues.getLength() );
@@ -1991,13 +1988,12 @@ uno::Any Content::open(
         {
             // Error: Not a folder!
 
-            OUStringBuffer aMsg;
-            aMsg.append( "Non-folder resource cannot be opened as folder! Wrong Open Mode!" );
+            OUString aMsg( "Non-folder resource cannot be opened as folder! Wrong Open Mode!" );
 
             ucbhelper::cancelCommandExecution(
                 uno::makeAny(
                     lang::IllegalArgumentException(
-                        aMsg.makeStringAndClear(),
+                        aMsg,
                         static_cast< cppu::OWeakObject * >( this ),
                         -1 ) ),
                 xEnv );
@@ -2035,7 +2031,7 @@ uno::Any Content::open(
                     osl::MutexGuard aGuard( m_aMutex );
 
                     xResAccess.reset(
-                        new DAVResourceAccess( *m_xResAccess.get() ) );
+                        new DAVResourceAccess( *m_xResAccess ) );
                 }
 
                 DAVResource aResource;
@@ -2077,7 +2073,7 @@ uno::Any Content::open(
                         osl::MutexGuard aGuard( m_aMutex );
 
                         xResAccess.reset(
-                            new DAVResourceAccess( *m_xResAccess.get() ) );
+                            new DAVResourceAccess( *m_xResAccess ) );
                     }
 
                     // fill inputstream sync; return if all data present
@@ -2145,7 +2141,7 @@ void Content::post(
             {
                 osl::MutexGuard aGuard( m_aMutex );
                 xResAccess.reset(
-                    new DAVResourceAccess( *m_xResAccess.get() ) );
+                    new DAVResourceAccess( *m_xResAccess ) );
             }
 
             uno::Reference< io::XInputStream > xResult
@@ -2179,7 +2175,7 @@ void Content::post(
                 {
                     osl::MutexGuard aGuard( m_aMutex );
                     xResAccess.reset(
-                        new DAVResourceAccess( *m_xResAccess.get() ) );
+                        new DAVResourceAccess( *m_xResAccess ) );
                 }
 
                 xResAccess->POST( rArg.MediaType,
@@ -2277,7 +2273,7 @@ void Content::insert(
         bTransient    = m_bTransient;
         bCollection   = m_bCollection;
         aEscapedTitle = m_aEscapedTitle;
-        xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+        xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
     }
 
     // Check, if all required properties are present.
@@ -2520,7 +2516,7 @@ void Content::transfer(
         xContext.set( m_xContext );
         xIdentifier.set( m_xIdentifier );
         xProvider.set( m_xProvider.get() );
-        xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+        xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
     }
 
     OUString aTargetURI;
@@ -2813,7 +2809,7 @@ void Content::lock(
         std::unique_ptr< DAVResourceAccess > xResAccess;
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
-            xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+            xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
 
         uno::Any aOwnerAny;
@@ -2852,7 +2848,7 @@ void Content::unlock(
         std::unique_ptr< DAVResourceAccess > xResAccess;
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
-            xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+            xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         }
 
         xResAccess->UNLOCK( Environment );
@@ -3165,7 +3161,7 @@ void Content::cancelCommandExecution(
 }
 
 
-const OUString
+OUString
 Content::getBaseURI( const std::unique_ptr< DAVResourceAccess > & rResAccess )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -3283,7 +3279,7 @@ Content::ResourceType Content::getResourceType(
     std::unique_ptr< DAVResourceAccess > xResAccess;
     {
         osl::MutexGuard aGuard( m_aMutex );
-        xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+        xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
     }
     const Content::ResourceType & ret = getResourceType( xEnv, xResAccess );
     {
diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx
index 68cf8e5d24fc..fbd8e6300f4b 100644
--- a/ucb/source/ucp/webdav/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav/webdavcontent.hxx
@@ -110,7 +110,7 @@ private:
     bool
     exchangeIdentity( const css::uno::Reference< css::ucb::XContentIdentifier >& xNewId );
 
-    const OUString
+    OUString
     getBaseURI( const std::unique_ptr< DAVResourceAccess > & rResAccess );
 
     /// @throws css::uno::Exception
diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
index f26ebb01d21f..14050e2a1e49 100644
--- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
@@ -275,10 +275,10 @@ uno::Sequence< beans::Property > Content::getProperties(
         osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
         bTransient = m_bTransient;
-        xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+        xResAccess.reset( new DAVResourceAccess( *m_xResAccess ) );
         if ( m_xCachedProps.get() )
             xCachedProps.reset(
-                new ContentProperties( *m_xCachedProps.get() ) );
+                new ContentProperties( *m_xCachedProps ) );
         xProvider.set( m_pProvider );
     }
 
diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.cxx b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
index 17f4f2051b41..6001b8665f4c 100644
--- a/ucb/source/ucp/webdav/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
@@ -43,6 +43,7 @@ namespace http_dav_ucp
 
 // struct ResultListEntry.
 
+namespace {
 
 struct ResultListEntry
 {
@@ -55,6 +56,7 @@ struct ResultListEntry
     explicit ResultListEntry( std::unique_ptr<ContentProperties> && pEntry ) : pData( std::move(pEntry) ) {}
 };
 
+}
 
 // ResultList.
 
diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx
index 9a78c0648ebe..6c1d77b94d0c 100644
--- a/ucb/source/ucp/webdav/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav/webdavprovider.cxx
@@ -84,7 +84,7 @@ XTYPEPROVIDER_IMPL_3( ContentProvider,
 // XServiceInfo methods.
 
 XSERVICEINFO_COMMOM_IMPL( ContentProvider,
-                          OUString( "com.sun.star.comp.WebDAVContentProvider" ) )
+                          "com.sun.star.comp.WebDAVContentProvider" )
 /// @throws css::uno::Exception
 static css::uno::Reference< css::uno::XInterface >
 ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )


More information about the Libreoffice-commits mailing list