From c77d3bb13e20fcafaaa2941247c2d0b14ee0d9b3 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Tue, 18 Mar 2014 14:00:20 +0100 Subject: webdav: fix various warnings (cherry picked from commit c8d2c653ae6467bbfa05e8312b10bacb3eba249f) Conflicts: ucb/source/ucp/webdav/SerfSession.cxx ucb/source/ucp/webdav/SerfUri.cxx ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx Change-Id: I86289c09b3694e5c48dffeb2de571d99e2484bd3 --- ucb/Library_ucpdav1.mk | 2 -- ucb/source/ucp/webdav/ContentProperties.cxx | 2 +- ucb/source/ucp/webdav/ContentProperties.hxx | 5 +-- ucb/source/ucp/webdav/SerfCallbacks.cxx | 2 +- ucb/source/ucp/webdav/SerfSession.cxx | 31 ++++------------- ucb/source/ucp/webdav/SerfUri.cxx | 24 ++----------- ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx | 19 +++++----- ucb/source/ucp/webdav/webdavcontent.cxx | 48 +++++++++++--------------- ucb/source/ucp/webdav/webdavcontent.hxx | 10 +++--- ucb/source/ucp/webdav/webdavcontentcaps.cxx | 6 ++-- ucb/source/ucp/webdav/webdavresponseparser.cxx | 4 +-- 11 files changed, 55 insertions(+), 98 deletions(-) (limited to 'ucb') diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk index 42d273fe39c8..4f6f4c26bb90 100644 --- a/ucb/Library_ucpdav1.mk +++ b/ucb/Library_ucpdav1.mk @@ -59,8 +59,6 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\ else # WITH_WEBDAV == serf -$(eval $(call gb_Library_set_warnings_not_errors,ucpdav1)) - $(eval $(call gb_Library_use_externals,ucpdav1,\ boost_headers \ apr \ diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx index ba2caa860c20..2bed42ac6f77 100644 --- a/ucb/source/ucp/webdav/ContentProperties.cxx +++ b/ucb/source/ucp/webdav/ContentProperties.cxx @@ -598,7 +598,7 @@ CachableContentProperties::CachableContentProperties( void CachableContentProperties::addProperties( const ContentProperties & rProps ) { - const std::auto_ptr< PropertyValueMap > & props = rProps.getProperties(); + const boost::scoped_ptr< PropertyValueMap > & props = rProps.getProperties(); PropertyValueMap::const_iterator it = props->begin(); const PropertyValueMap::const_iterator end = props->end(); diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx index 1776306357c2..17446d500d38 100644 --- a/ucb/source/ucp/webdav/ContentProperties.hxx +++ b/ucb/source/ucp/webdav/ContentProperties.hxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -173,12 +174,12 @@ public: // Not good to expose implementation details, but this is actually an // internal class. - const std::auto_ptr< PropertyValueMap > & getProperties() const + const boost::scoped_ptr< PropertyValueMap > & getProperties() const { return m_xProps; } private: OUString m_aEscapedTitle; - std::auto_ptr< PropertyValueMap > m_xProps; + boost::scoped_ptr< PropertyValueMap > m_xProps; bool m_bTrailingSlash; static com::sun::star::uno::Any m_aEmptyAny; diff --git a/ucb/source/ucp/webdav/SerfCallbacks.cxx b/ucb/source/ucp/webdav/SerfCallbacks.cxx index afa177a4913a..5d1194ea9503 100644 --- a/ucb/source/ucp/webdav/SerfCallbacks.cxx +++ b/ucb/source/ucp/webdav/SerfCallbacks.cxx @@ -59,7 +59,7 @@ extern "C" apr_status_t Serf_Credentials( char **username, extern "C" apr_status_t Serf_CertificateChainValidation( void* pSerfSession, int nFailures, - int nErrorCode, + int /*nErrorCode*/, const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded, apr_size_t nCertificateChainLength) { diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx index 88ad742a8dc6..b7c19108c2e5 100644 --- a/ucb/source/ucp/webdav/SerfSession.cxx +++ b/ucb/source/ucp/webdav/SerfSession.cxx @@ -157,11 +157,11 @@ void SerfSession::Init() if ( m_aProxyName.getLength() ) { apr_sockaddr_t *proxy_address = NULL; - const apr_status_t status = apr_sockaddr_info_get( &proxy_address, - OUStringToOString( m_aProxyName, RTL_TEXTENCODING_UTF8 ).getStr(), - APR_UNSPEC, - static_cast(m_nProxyPort), - 0, getAprPool() ); + status = apr_sockaddr_info_get( &proxy_address, + OUStringToOString( m_aProxyName, RTL_TEXTENCODING_UTF8 ).getStr(), + APR_UNSPEC, + static_cast(m_nProxyPort), + 0, getAprPool() ); if ( status != APR_SUCCESS ) { @@ -341,25 +341,6 @@ apr_status_t SerfSession::provideSerfCredentials( bool bGiveProvidedCredentialsA return theRetVal != 0 ? SERF_ERROR_AUTHN_FAILED : APR_SUCCESS; } -namespace { - // ------------------------------------------------------------------- - // Helper function - OUString GetHostnamePart( const OUString& _rRawString ) - { - OUString sPart; - OUString sPartId = OUString::createFromAscii( "CN=" ); - sal_Int32 nContStart = _rRawString.indexOf( sPartId ); - if ( nContStart != -1 ) - { - nContStart += sPartId.getLength(); - sal_Int32 nContEnd = _rRawString.indexOf( ',', nContStart ); - sPart = _rRawString.copy( nContStart, nContEnd - nContStart ); - } - return sPart; - } -} // namespace - - apr_status_t SerfSession::verifySerfCertificateChain ( int, const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded, @@ -452,7 +433,7 @@ apr_status_t SerfSession::verifySerfCertificateChain ( // done outside the isDomainMatch() block because the result is // used by the interaction handler. std::vector< uno::Reference< security::XCertificate > > aChain; - for (int nIndex=1; nIndex" ); +/* + #define STATE_TOP (1) #define STATE_UCBPROP (STATE_TOP) #define STATE_TYPE (STATE_TOP + 1) #define STATE_VALUE (STATE_TOP + 2) -/* ////////////////////////////////////////////////////////////////////////// extern "C" int UCBDeadPropertyValue_startelement_callback( void *, @@ -456,7 +457,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // long sal_Int32 nValue = 0; rInData >>= nValue; - aStringValue = OUString::valueOf( nValue ); + aStringValue = OUString::number( nValue ); aStringType = aTypeLong; } else if ( rType == getCppuType( static_cast< const sal_Int16 * >( 0 ) ) ) @@ -464,7 +465,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // short sal_Int32 nValue = 0; rInData >>= nValue; - aStringValue = OUString::valueOf( nValue ); + aStringValue = OUString::number( nValue ); aStringType = aTypeShort; } else if ( rType == getCppuBooleanType() ) @@ -472,7 +473,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // boolean sal_Bool bValue = false; rInData >>= bValue; - aStringValue = OUString::valueOf( bValue ); + aStringValue = OUString::boolean( bValue ); aStringType = aTypeBoolean; } else if ( rType == getCppuCharType() ) @@ -480,7 +481,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // char sal_Unicode cValue = 0; rInData >>= cValue; - aStringValue = OUString::valueOf( cValue ); + aStringValue = OUString( cValue ); aStringType = aTypeChar; } else if ( rType == getCppuType( static_cast< const sal_Int8 * >( 0 ) ) ) @@ -488,7 +489,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // byte sal_Int8 nValue = 0; rInData >>= nValue; - aStringValue = OUString::valueOf( sal_Unicode( nValue ) ); + aStringValue = OUString( sal_Unicode( nValue ) ); aStringType = aTypeByte; } else if ( rType == getCppuType( static_cast< const sal_Int64 * >( 0 ) ) ) @@ -496,7 +497,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // hyper sal_Int64 nValue = 0; rInData >>= nValue; - aStringValue = OUString::valueOf( nValue ); + aStringValue = OUString::number( nValue ); aStringType = aTypeHyper; } else if ( rType == getCppuType( static_cast< const float * >( 0 ) ) ) @@ -504,7 +505,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // float float nValue = 0; rInData >>= nValue; - aStringValue = OUString::valueOf( nValue ); + aStringValue = OUString::number( nValue ); aStringType = aTypeFloat; } else if ( rType == getCppuType( static_cast< const double * >( 0 ) ) ) @@ -512,7 +513,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // double double nValue = 0; rInData >>= nValue; - aStringValue = OUString::valueOf( nValue ); + aStringValue = OUString::number( nValue ); aStringType = aTypeDouble; } else diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index c9d9250d8858..ce52946e3406 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -81,8 +81,8 @@ static void lcl_sendPartialGETRequest( bool &bError, DAVException &aLastException, const std::vector< rtl::OUString > aProps, std::vector< rtl::OUString > &aHeaderNames, - const std::auto_ptr< DAVResourceAccess > &xResAccess, - std::auto_ptr< ContentProperties > &xProps, + const boost::scoped_ptr< DAVResourceAccess > &xResAccess, + boost::scoped_ptr< ContentProperties > &xProps, const uno::Reference< ucb::XCommandEnvironment >& xEnv ) { bool bIsRequestSize = false; @@ -636,7 +636,7 @@ uno::Any SAL_CALL Content::execute( // { try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); @@ -830,7 +830,7 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) { try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::MutexGuard aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); @@ -914,7 +914,7 @@ throw( beans::PropertyExistException, try { // Set property value at server. - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); @@ -1026,7 +1026,7 @@ throw( beans::UnknownPropertyException, aProppatchValues.push_back( aValue ); // Remove property value from server. - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); @@ -1315,7 +1315,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { // Append all standard UCB, DAV and HTTP properties. - const std::auto_ptr< PropertyValueMap > & xProps = rData.getProperties(); + const boost::scoped_ptr< PropertyValueMap > & xProps = rData.getProperties(); PropertyValueMap::const_iterator it = xProps->begin(); PropertyValueMap::const_iterator end = xProps->end(); @@ -1348,9 +1348,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw ( uno::Exception ) { - std::auto_ptr< ContentProperties > xProps; - std::auto_ptr< ContentProperties > xCachedProps; - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< ContentProperties > xProps; + boost::scoped_ptr< ContentProperties > xCachedProps; + boost::scoped_ptr< DAVResourceAccess > xResAccess; OUString aUnescapedTitle; bool bHasAll = false; uno::Reference< uno::XComponentContext > xContext; @@ -1695,7 +1695,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( uno::Reference< ucb::XContentIdentifier > xIdentifier; rtl::Reference< ContentProvider > xProvider; sal_Bool bTransient; - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -2168,7 +2168,6 @@ uno::Any Content::open( // Unreachable } - OUString aURL = m_xIdentifier->getContentIdentifier(); uno::Reference< io::XOutputStream > xOut = uno::Reference< io::XOutputStream >( rArg.Sink, uno::UNO_QUERY ); if ( xOut.is() ) @@ -2176,7 +2175,7 @@ uno::Any Content::open( // PUSH: write data try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::MutexGuard aGuard( m_aMutex ); @@ -2221,7 +2220,7 @@ uno::Any Content::open( // PULL: wait for client read try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::MutexGuard aGuard( m_aMutex ); @@ -2291,7 +2290,7 @@ void Content::post( { try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::MutexGuard aGuard( m_aMutex ); xResAccess.reset( @@ -2325,7 +2324,7 @@ void Content::post( { try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::MutexGuard aGuard( m_aMutex ); xResAccess.reset( @@ -2424,7 +2423,7 @@ void Content::insert( { sal_Bool bTransient, bCollection; OUString aEscapedTitle; - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -2670,7 +2669,7 @@ void Content::transfer( uno::Reference< uno::XComponentContext > xContext; uno::Reference< ucb::XContentIdentifier > xIdentifier; uno::Reference< ucb::XContentProvider > xProvider; - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -2904,7 +2903,6 @@ void Content::destroy( sal_Bool bDeletePhysical ) throw( uno::Exception ) { // @@@ take care about bDeletePhysical -> trashcan support - OUString aURL = m_xIdentifier->getContentIdentifier(); uno::Reference< ucb::XContent > xThis = this; @@ -2960,7 +2958,7 @@ void Content::lock( { try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); @@ -3000,7 +2998,7 @@ void Content::unlock( { try { - std::auto_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< DAVResourceAccess > xResAccess; { osl::Guard< osl::Mutex > aGuard( m_aMutex ); xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); @@ -3323,7 +3321,7 @@ void Content::cancelCommandExecution( //========================================================================= const OUString -Content::getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ) +Content::getBaseURI( const boost::scoped_ptr< DAVResourceAccess > & rResAccess ) { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -3355,7 +3353,7 @@ Content::getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ) //========================================================================= const Content::ResourceType & Content::getResourceType( const uno::Reference< ucb::XCommandEnvironment >& xEnv, - const std::auto_ptr< DAVResourceAccess > & rResAccess ) + const boost::scoped_ptr< DAVResourceAccess > & rResAccess ) throw ( uno::Exception ) { if ( m_eResourceType == UNKNOWN ) @@ -3365,10 +3363,6 @@ const Content::ResourceType & Content::getResourceType( ResourceType eResourceType; eResourceType = m_eResourceType; - const OUString & rURL = rResAccess->getURL(); - const OUString aScheme( - rURL.copy( 0, rURL.indexOf( ':' ) ).toAsciiLowerCase() ); - try { // Try to fetch some frequently used property value, e.g. those diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx index 52f14c840c30..27dd55fc9eb6 100644 --- a/ucb/source/ucp/webdav/webdavcontent.hxx +++ b/ucb/source/ucp/webdav/webdavcontent.hxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -75,9 +76,8 @@ class Content : public ::ucbhelper::ContentImplHelper, DAV }; - std::auto_ptr< DAVResourceAccess > m_xResAccess; - std::auto_ptr< CachableContentProperties > - m_xCachedProps; // locally cached props + boost::scoped_ptr< DAVResourceAccess > m_xResAccess; + boost::scoped_ptr< CachableContentProperties > m_xCachedProps; // locally cached props OUString m_aEscapedTitle; ResourceType m_eResourceType; ContentProvider* m_pProvider; // No need for a ref, base class holds object @@ -122,7 +122,7 @@ private: ::com::sun::star::ucb::XContentIdentifier >& xNewId ); const OUString - getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ); + getBaseURI( const boost::scoped_ptr< DAVResourceAccess > & rResAccess ); const ResourceType & getResourceType( const ::com::sun::star::uno::Reference< @@ -132,7 +132,7 @@ private: const ResourceType & getResourceType( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv, - const std::auto_ptr< DAVResourceAccess > & rResAccess ) + const boost::scoped_ptr< DAVResourceAccess > & rResAccess ) throw ( ::com::sun::star::uno::Exception ); // Command "open" diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx index 921d8e79378f..275ecddeeac2 100644 --- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx @@ -275,8 +275,8 @@ uno::Sequence< beans::Property > Content::getProperties( const uno::Reference< ucb::XCommandEnvironment > & xEnv ) { sal_Bool bTransient; - std::auto_ptr< DAVResourceAccess > xResAccess; - std::auto_ptr< ContentProperties > xCachedProps; + boost::scoped_ptr< DAVResourceAccess > xResAccess; + boost::scoped_ptr< ContentProperties > xCachedProps; rtl::Reference< ContentProvider > xProvider; { @@ -455,7 +455,7 @@ uno::Sequence< beans::Property > Content::getProperties( const std::set< OUString >::const_iterator set_end = aPropSet.end(); - const std::auto_ptr< PropertyValueMap > & xProps + const boost::scoped_ptr< PropertyValueMap > & xProps = xCachedProps->getProperties(); PropertyValueMap::const_iterator map_it = xProps->begin(); diff --git a/ucb/source/ucp/webdav/webdavresponseparser.cxx b/ucb/source/ucp/webdav/webdavresponseparser.cxx index 075b35daab38..9166843a20f5 100644 --- a/ucb/source/ucp/webdav/webdavresponseparser.cxx +++ b/ucb/source/ucp/webdav/webdavresponseparser.cxx @@ -175,8 +175,8 @@ namespace const OUString& getNamespace() const { return maNamespace; } const OUString& getName() const { return maName; } - const WebDAVNamespace getWebDAVNamespace() const { return maWebDAVNamespace; } - const WebDAVName getWebDAVName() const { return maWebDAVName; } + const WebDAVNamespace& getWebDAVNamespace() const { return maWebDAVNamespace; } + const WebDAVName& getWebDAVName() const { return maWebDAVName; } }; void WebDAVContext::parseForNamespaceTokens(const uno::Reference< xml::sax::XAttributeList >& xAttribs) -- cgit