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

Noel Grandin noel at peralex.com
Mon Jul 27 00:24:47 PDT 2015


 ucb/source/ucp/webdav/DAVResourceAccess.hxx    |    2 -
 ucb/source/ucp/webdav/DateTimeHelper.cxx       |   26 ++++++++++++-------------
 ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx   |    2 -
 ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx  |    2 -
 ucb/source/ucp/webdav/SerfRequestProcessor.cxx |   16 +++++++--------
 ucb/source/ucp/webdav/SerfSession.cxx          |   16 ++++-----------
 ucb/source/ucp/webdav/SerfSession.hxx          |    4 +--
 ucb/source/ucp/webdav/SerfUri.cxx              |    2 -
 ucb/source/ucp/webdav/webdavcontent.cxx        |    6 ++---
 ucb/source/ucp/webdav/webdavdatasupplier.cxx   |    2 -
 ucb/source/ucp/webdav/webdavprovider.cxx       |    2 -
 ucb/source/ucp/webdav/webdavresponseparser.cxx |    7 +++---
 ucb/source/ucp/webdav/webdavservices.cxx       |    3 --
 13 files changed, 42 insertions(+), 48 deletions(-)

New commits:
commit 165c939818b18d68216864600097b99e5d8c2266
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 27 09:21:05 2015 +0200

    loplugin:cstylecast
    
    Change-Id: I21fd75b3c891d98f6ad1e4c8af985c2cd21c7db4

diff --git a/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
index 30b1628..8c9ee4a 100644
--- a/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
@@ -102,7 +102,7 @@ void SerfGetReqProcImpl::processChunkOfResponseData( const char* data,
     }
     else if ( xOutputStream.is() )
     {
-        const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)data, len );
+        const uno::Sequence< sal_Int8 > aDataSeq( reinterpret_cast<const sal_Int8 *>(data), len );
         xOutputStream->writeBytes( aDataSeq );
     }
 }
diff --git a/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx b/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
index 1938fcb..89d4e2f 100644
--- a/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
@@ -111,7 +111,7 @@ void SerfPostReqProcImpl::processChunkOfResponseData( const char* data,
     }
     else if ( xOutputStream.is() )
     {
-        const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)data, len );
+        const uno::Sequence< sal_Int8 > aDataSeq( reinterpret_cast<const sal_Int8 *>(data), len );
         xOutputStream->writeBytes( aDataSeq );
     }
 }
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index c3d890f..9cb54ad 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -462,7 +462,7 @@ apr_status_t SerfSession::verifySerfCertificateChain (
         {
             uno::Reference< security::XCertificateExtension >element = extensions[i];
 
-            const rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength());
+            const rtl::OString aId ( reinterpret_cast<const sal_Char *>(const_cast<const signed char *>(element->getExtensionId().getArray())), element->getExtensionId().getLength());
             if ( aId.equals( OID_SUBJECT_ALTERNATIVE_NAME ) )
             {
                 uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY );
@@ -1423,9 +1423,7 @@ SerfSession::getDataFromInputStream(
                         rData.realloc( nPos + nRead );
 
                     aBuffer.realloc( nRead );
-                    memcpy( (void*)( rData.getArray() + nPos ),
-                                    (const void*)aBuffer.getConstArray(),
-                                    nRead );
+                    memcpy( rData.getArray() + nPos, aBuffer.getConstArray(), nRead );
                     nPos += nRead;
 
                     aBuffer.realloc( 0 );
diff --git a/ucb/source/ucp/webdav/webdavservices.cxx b/ucb/source/ucp/webdav/webdavservices.cxx
index 47509dd..6516603 100644
--- a/ucb/source/ucp/webdav/webdavservices.cxx
+++ b/ucb/source/ucp/webdav/webdavservices.cxx
@@ -31,8 +31,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpdav1_component_getFactory(
     void * pRet = 0;
 
     uno::Reference< lang::XMultiServiceFactory > xSMgr(
-            reinterpret_cast< lang::XMultiServiceFactory * >(
-                pServiceManager ) );
+            static_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
     uno::Reference< lang::XSingleServiceFactory > xFactory;
 
 
commit 58cb14239267d6ab1b0be20bc8aa8f6895e15cb7
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 27 09:10:46 2015 +0200

    loplugin:staticmethods
    
    Change-Id: Iab1eda788690366bfc03ba7c4f085cb474fef1b8

diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
index 52a337b..6e51a42 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
@@ -219,7 +219,7 @@ public:
         throw ( DAVException );
 
     void
-    abort()
+    static abort()
         throw ( DAVException );
 
     // helper
diff --git a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
index 06088d2..cb3ab7e 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
@@ -61,7 +61,7 @@ SerfRequestProcessor::SerfRequestProcessor( SerfSession& rSerfSession,
     , mbAcceptSerfResponseCalled( false )
     , mbHandleSerfResponseCalled( false )
 {
-    mPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
+    mPathStr = apr_pstrdup( SerfSession::getAprPool(),
                             OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ).getStr() );
 }
 
@@ -226,9 +226,9 @@ bool SerfRequestProcessor::processPost( const char* inData,
                                         const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
                                         apr_status_t& outSerfStatus )
 {
-    mContentType = apr_pstrdup( mrSerfSession.getAprPool(),
+    mContentType = apr_pstrdup( SerfSession::getAprPool(),
                                 OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
-    mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
+    mReferer = apr_pstrdup( SerfSession::getAprPool(),
                                 OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
     mpProcImpl = new SerfPostReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
@@ -250,9 +250,9 @@ bool SerfRequestProcessor::processPost( const char* inData,
                                         const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
                                         apr_status_t& outSerfStatus )
 {
-    mContentType = apr_pstrdup( mrSerfSession.getAprPool(),
+    mContentType = apr_pstrdup( SerfSession::getAprPool(),
                                 OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
-    mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
+    mReferer = apr_pstrdup( SerfSession::getAprPool(),
                             OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
     mpProcImpl = new SerfPostReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
@@ -291,7 +291,7 @@ bool SerfRequestProcessor::processCopy( const OUString & inDestinationPath,
                                         const bool inOverwrite,
                                         apr_status_t& outSerfStatus )
 {
-    mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
+    mDestPathStr = apr_pstrdup( SerfSession::getAprPool(),
                                 OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
     mpProcImpl = new SerfCopyReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
@@ -307,7 +307,7 @@ bool SerfRequestProcessor::processMove( const OUString & inDestinationPath,
                                         const bool inOverwrite,
                                         apr_status_t& outSerfStatus )
 {
-    mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
+    mDestPathStr = apr_pstrdup( SerfSession::getAprPool(),
                                 OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
     mpProcImpl = new SerfMoveReqProcImpl( mPathStr,
                                         mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
@@ -365,7 +365,7 @@ apr_status_t SerfRequestProcessor::runProcessor()
     mbProcessingDone = false;
     apr_status_t status = APR_SUCCESS;
     serf_context_t* pSerfContext = mrSerfSession.getSerfContext();
-    apr_pool_t* pAprPool = mrSerfSession.getAprPool();
+    apr_pool_t* pAprPool = SerfSession::getAprPool();
     while ( true )
     {
         status = serf_context_run( pSerfContext,
diff --git a/ucb/source/ucp/webdav/SerfSession.hxx b/ucb/source/ucp/webdav/SerfSession.hxx
index a2f5402..2d5abea 100644
--- a/ucb/source/ucp/webdav/SerfSession.hxx
+++ b/ucb/source/ucp/webdav/SerfSession.hxx
@@ -102,7 +102,7 @@ public:
                                        apr_pool_t* inAprPool );
 
     // Serf-related data structures
-    apr_pool_t* getAprPool();
+    static apr_pool_t* getAprPool();
     serf_bucket_alloc_t* getSerfBktAlloc();
     serf_context_t* getSerfContext();
     serf_connection_t* getSerfConnection();
@@ -264,7 +264,7 @@ private:
 
     const ucbhelper::InternetProxyServer & getProxySettings() const;
 
-    bool removeExpiredLocktoken( const OUString & inURL,
+    static bool removeExpiredLocktoken( const OUString & inURL,
                                  const DAVRequestEnvironment & rEnv );
 
     // refresh lock, called by SerfLockStore::refreshLocks
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index c61511b..32ca2db 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -830,7 +830,7 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
             osl::MutexGuard aGuard( m_aMutex );
             xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
         }
-        xResAccess->abort();
+        DAVResourceAccess::abort();
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
             m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) );
commit a3c6ead658a6342f74425a7bd05b3a0b9d6265f5
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 27 09:05:06 2015 +0200

    loplugin:loopvartoosmall
    
    Change-Id: I9114a7dd3eae7a76432655c4459a7326bb1908f4

diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.cxx b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
index 89f50cb..3fa7d86 100644
--- a/ucb/source/ucp/webdav/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
@@ -394,7 +394,7 @@ bool DataSupplier::getData()
                 aPath = SerfUri::unescape( aPath );
                 bool bFoundParent = false;
 
-                for ( sal_uInt32 n = 0; n < resources.size(); ++n )
+                for ( size_t n = 0; n < resources.size(); ++n )
                 {
                     const DAVResource & rRes = resources[ n ];
 
commit 53b496daa8be70e29c71ed44b30c49a52677c14c
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 27 09:04:24 2015 +0200

    loplugin:simplifybool
    
    Change-Id: Id57ee3c09b11c3ce4820ed06a15f13866a10f19a

diff --git a/ucb/source/ucp/webdav/DateTimeHelper.cxx b/ucb/source/ucp/webdav/DateTimeHelper.cxx
index b2e39be..7f2a06a 100644
--- a/ucb/source/ucp/webdav/DateTimeHelper.cxx
+++ b/ucb/source/ucp/webdav/DateTimeHelper.cxx
@@ -242,7 +242,7 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s,
         }
     }
 
-    return (found) ? true : false;
+    return found;
 }
 
 bool DateTimeHelper::convert (const OUString& s, DateTime& dateTime)
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index 1aa8952..c3d890f 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -328,7 +328,7 @@ apr_status_t SerfSession::provideSerfCredentials( bool bGiveProvidedCredentialsA
                                              theUserName,
                                              thePassWord,
                                              bCanUseSystemCreds,
-                                             bGiveProvidedCredentialsASecondTry ? sal_False : sal_True );
+                                             bGiveProvidedCredentialsASecondTry );
 
     if ( theRetVal == 0 )
     {
@@ -923,9 +923,7 @@ void SerfSession::COPY( const OUString & inSourceURL,
     SerfUri theSourceUri( inSourceURL );
     boost::shared_ptr<SerfRequestProcessor> aReqProc( createReqProc( theSourceUri.GetPath() ) );
     apr_status_t status = APR_SUCCESS;
-    aReqProc->processCopy( inDestinationURL,
-                           (inOverWrite ? true : false),
-                           status );
+    aReqProc->processCopy( inDestinationURL, inOverWrite, status );
 
     HandleError( aReqProc );
 }
@@ -946,9 +944,7 @@ void SerfSession::MOVE( const OUString & inSourceURL,
     SerfUri theSourceUri( inSourceURL );
     boost::shared_ptr<SerfRequestProcessor> aReqProc( createReqProc( theSourceUri.GetPath() ) );
     apr_status_t status = APR_SUCCESS;
-    aReqProc->processMove( inDestinationURL,
-                           (inOverWrite ? true : false),
-                           status );
+    aReqProc->processMove( inDestinationURL, inOverWrite, status );
 
     HandleError( aReqProc );
 }
commit 3e4c5a3538843bbab5d94e431f9cdb6e394c17c5
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 27 09:01:38 2015 +0200

    loplugin:stringconstant
    
    Change-Id: I95765e9c26e393a838ee0c617fde415e6c50e884

diff --git a/ucb/source/ucp/webdav/DateTimeHelper.cxx b/ucb/source/ucp/webdav/DateTimeHelper.cxx
index 961c233..b2e39be 100644
--- a/ucb/source/ucp/webdav/DateTimeHelper.cxx
+++ b/ucb/source/ucp/webdav/DateTimeHelper.cxx
@@ -127,29 +127,29 @@ sal_Int32 DateTimeHelper::convertDayToInt (const OUString& day)
 
 sal_Int32 DateTimeHelper::convertMonthToInt (const OUString& month)
 {
-    if (month.equalsAscii("Jan"))
+    if (month == "Jan")
         return 1;
-    else if (month.equalsAscii("Feb"))
+    else if (month == "Feb")
         return 2;
-    else if (month.equalsAscii("Mar"))
+    else if (month == "Mar")
         return 3;
-    else if (month.equalsAscii("Apr"))
+    else if (month == "Apr")
         return 4;
-    else if (month.equalsAscii("May"))
+    else if (month == "May")
         return 5;
-    else if (month.equalsAscii("Jun"))
+    else if (month == "Jun")
         return 6;
-    else if (month.equalsAscii("Jul"))
+    else if (month == "Jul")
         return 7;
-    else if (month.equalsAscii("Aug"))
+    else if (month == "Aug")
         return 8;
-    else if (month.equalsAscii("Sep"))
+    else if (month == "Sep")
         return 9;
-    else if (month.equalsAscii("Oct"))
+    else if (month == "Oct")
         return 10;
-    else if (month.equalsAscii("Nov"))
+    else if (month == "Nov")
         return 11;
-    else if (month.equalsAscii("Dec"))
+    else if (month == "Dec")
         return 12;
     else
         return 0;
diff --git a/ucb/source/ucp/webdav/SerfUri.cxx b/ucb/source/ucp/webdav/SerfUri.cxx
index df29933..8947655 100644
--- a/ucb/source/ucp/webdav/SerfUri.cxx
+++ b/ucb/source/ucp/webdav/SerfUri.cxx
@@ -202,7 +202,7 @@ OUString SerfUri::GetPathBaseNameUnescaped () const
 void SerfUri::AppendPath (const OUString& rPath)
 {
     if (mPath.lastIndexOf ('/') != mPath.getLength () - 1)
-        mPath += OUString("/");
+        mPath += "/";
 
     mPath += rPath;
     calculateURI ();
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 861b175..c61511b 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -1134,7 +1134,7 @@ Content::queryCreatableContentsInfo()
     uno::Sequence< ucb::ContentInfo > aSeq( 2 );
 
     // document.
-    aSeq.getArray()[ 0 ].Type = OUString( WEBDAV_CONTENT_TYPE );
+    aSeq.getArray()[ 0 ].Type = WEBDAV_CONTENT_TYPE;
     aSeq.getArray()[ 0 ].Attributes
         = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
           | ucb::ContentInfoAttribute::KIND_DOCUMENT;
@@ -1148,7 +1148,7 @@ Content::queryCreatableContentsInfo()
     aSeq.getArray()[ 0 ].Properties = aDocProps;
 
     // folder.
-    aSeq.getArray()[ 1 ].Type = OUString( WEBDAV_COLLECTION_TYPE );
+    aSeq.getArray()[ 1 ].Type = WEBDAV_COLLECTION_TYPE;
     aSeq.getArray()[ 1 ].Attributes
         = ucb::ContentInfoAttribute::KIND_FOLDER;
 
diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx
index 16684d8..e485d0e 100644
--- a/ucb/source/ucp/webdav/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav/webdavprovider.cxx
@@ -94,7 +94,7 @@ XTYPEPROVIDER_IMPL_3( ContentProvider,
 
 XSERVICEINFO_IMPL_1_CTX( ContentProvider,
                      OUString( "com.sun.star.comp.WebDAVContentProvider" ),
-                     OUString( WEBDAV_CONTENT_PROVIDER_SERVICE_NAME ) );
+                     WEBDAV_CONTENT_PROVIDER_SERVICE_NAME );
 
 
 
diff --git a/ucb/source/ucp/webdav/webdavresponseparser.cxx b/ucb/source/ucp/webdav/webdavresponseparser.cxx
index f513f1e..95a451b 100644
--- a/ucb/source/ucp/webdav/webdavresponseparser.cxx
+++ b/ucb/source/ucp/webdav/webdavresponseparser.cxx
@@ -230,7 +230,7 @@ namespace
     void WebDAVContext::splitName(const OUString& rSource)
     {
         const sal_Int32 nLen(rSource.getLength());
-        maNamespace = "";
+        maNamespace.clear();
         maName = rSource;
 
         if(nLen)
@@ -457,7 +457,8 @@ namespace
                             case WebDAVName_response:
                             {
                                 // response start, reset Href and status and maResponseProperties
-                                maHref = maStatus = "";
+                                maHref.clear();
+                                maStatus.clear();
 
                                 if(isCollectingProperties())
                                 {
@@ -807,7 +808,7 @@ namespace
                 if(aNew.getLength())
                 {
                     // add one char when appending (see html1.1 spec)
-                    aNew += OUString(' ');
+                    aNew += " ";
                 }
 
                 aNew += aTrimmedChars;


More information about the Libreoffice-commits mailing list