[Libreoffice-commits] core.git: 6 commits - include/svtools svtools/source sw/inc sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Fri Nov 11 13:09:16 UTC 2016


 include/svtools/grfmgr.hxx         |    4 
 include/svtools/transfer.hxx       |   16 +-
 svtools/source/graphic/grfmgr.cxx  |   70 +++++-------
 svtools/source/misc/transfer.cxx   |  205 ++++++++++++++++++-------------------
 sw/inc/calc.hxx                    |    6 -
 sw/source/core/bastyp/calc.cxx     |    4 
 vcl/source/gdi/CommonSalLayout.cxx |    2 
 7 files changed, 141 insertions(+), 166 deletions(-)

New commits:
commit b8b05986e7ba37b90d4636f87bc31703cdff9d67
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 10:44:14 2016 +0000

    default dtor is sufficient
    
    Change-Id: Ia32b31489eb67f24987852dbadbcc2d3a81a0312

diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 92b4acf..8f54ab3 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -106,7 +106,6 @@ public:
     // always default to a number. otherwise it will become a SbxEMPTY
     SwSbxValue( long n = 0 ) : bVoid(false)  { PutLong( n ); }
     SwSbxValue( const double& rD ) : bVoid(false) { PutDouble( rD ); }
-    virtual ~SwSbxValue() override;
 
     bool GetBool() const;
     double GetDouble() const;
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index c7bdf9f..3f2d0ba 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1411,10 +1411,6 @@ SwCalcExp::SwCalcExp(const OUString& rStr, const SwSbxValue& rVal,
 {
 }
 
-SwSbxValue::~SwSbxValue()
-{
-}
-
 bool SwSbxValue::GetBool() const
 {
     return SbxSTRING == GetType() ? !GetOUString().isEmpty()
commit 18737001d8d78f365254dca8469f7ab1ab23fa2e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 10:43:33 2016 +0000

    default copy ctor is sufficient
    
    Change-Id: I908848590add00d96001e1fdaafedc85ae3d6765

diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index cbcd418..92b4acf 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -106,11 +106,6 @@ public:
     // always default to a number. otherwise it will become a SbxEMPTY
     SwSbxValue( long n = 0 ) : bVoid(false)  { PutLong( n ); }
     SwSbxValue( const double& rD ) : bVoid(false) { PutDouble( rD ); }
-    SwSbxValue( const SwSbxValue& rVal ) :
-        SvRefBase( rVal ),
-        SbxValue( rVal ),
-        bVoid(rVal.bVoid)
-        {}
     virtual ~SwSbxValue() override;
 
     bool GetBool() const;
commit fdfaf4b1e2c9b862a16e638aa7916f1b9d4316a4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 10:28:06 2016 +0000

    use std::unique_ptr
    
    Change-Id: I68e3e498fa4abeca66501897fe5975b44611259c

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index 75fb774..9ca2716 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -185,8 +185,8 @@ private:
     OUString                maLink;
     Link<const GraphicObject*, SvStream*> maSwapStreamHdl;
     OUString                maUserData;
-    Timer*                  mpSwapOutTimer;
-    GrfSimpleCacheObj*      mpSimpleCache;
+    std::unique_ptr<Timer>  mxSwapOutTimer;
+    std::unique_ptr<GrfSimpleCacheObj> mxSimpleCache;
     sal_uLong               mnAnimationLoopCount;
 
     // a unique increasing ID to be able to say which data change is older
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index a588edf..7c0d55d 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -131,17 +131,12 @@ GraphicObject::~GraphicObject()
             mpGlobalMgr = nullptr;
         }
     }
-
-    delete mpSwapOutTimer;
-    delete mpSimpleCache;
 }
 
 void GraphicObject::ImplConstruct()
 {
     mpMgr = nullptr;
     maSwapStreamHdl = Link<const GraphicObject*, SvStream*>();
-    mpSwapOutTimer = nullptr;
-    mpSimpleCache = nullptr;
     mnAnimationLoopCount = 0;
     mbAutoSwapped = false;
     mbIsInSwapIn = false;
@@ -356,8 +351,7 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
         mpMgr->ImplUnregisterObj( *this );
 
         maSwapStreamHdl = Link<const GraphicObject*, SvStream*>();
-        delete mpSimpleCache;
-        mpSimpleCache = nullptr;
+        mxSimpleCache.reset();
 
         maGraphic = rGraphicObj.GetGraphic();
         maAttr = rGraphicObj.maAttr;
@@ -406,11 +400,8 @@ void GraphicObject::SetAttr( const GraphicAttr& rAttr )
 {
     maAttr = rAttr;
 
-    if( mpSimpleCache && ( mpSimpleCache->maAttr != rAttr ) )
-    {
-        delete mpSimpleCache;
-        mpSimpleCache = nullptr;
-    }
+    if (mxSimpleCache && (mxSimpleCache->maAttr != rAttr))
+        mxSimpleCache.reset();
 }
 
 void GraphicObject::SetLink()
@@ -452,21 +443,20 @@ void GraphicObject::SetSwapStreamHdl(const Link<const GraphicObject*, SvStream*>
     maSwapStreamHdl = rHdl;
 
     sal_uInt32 const nSwapOutTimeout(GetCacheTimeInMs());
-    if( nSwapOutTimeout )
+    if (nSwapOutTimeout)
     {
-        if( !mpSwapOutTimer )
+        if (!mxSwapOutTimer)
         {
-            mpSwapOutTimer = new Timer("SwapOutTimer");
-            mpSwapOutTimer->SetTimeoutHdl( LINK( this, GraphicObject, ImplAutoSwapOutHdl ) );
+            mxSwapOutTimer.reset(new Timer("SwapOutTimer"));
+            mxSwapOutTimer->SetTimeoutHdl( LINK( this, GraphicObject, ImplAutoSwapOutHdl ) );
         }
 
-        mpSwapOutTimer->SetTimeout( nSwapOutTimeout );
-        mpSwapOutTimer->Start();
+        mxSwapOutTimer->SetTimeout( nSwapOutTimeout );
+        mxSwapOutTimer->Start();
     }
     else
     {
-        delete mpSwapOutTimer;
-        mpSwapOutTimer = nullptr;
+        mxSwapOutTimer.reset();
     }
 }
 
@@ -578,8 +568,8 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
     // (code above needs to call GetGraphic twice)
     if( bCached )
     {
-        if( mpSwapOutTimer )
-            mpSwapOutTimer->Start();
+        if (mxSwapOutTimer)
+            mxSwapOutTimer->Start();
         else
             FireSwapOutRequest();
     }
@@ -644,16 +634,13 @@ bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const
                 }
             }
 
-            if( !mpSimpleCache || ( mpSimpleCache->maAttr != aAttr ) || pFirstFrameOutDev )
+            if (!mxSimpleCache || (mxSimpleCache->maAttr != aAttr) || pFirstFrameOutDev)
             {
-                if( mpSimpleCache )
-                    delete mpSimpleCache;
-
-                mpSimpleCache = new GrfSimpleCacheObj( GetTransformedGraphic( &aAttr ), aAttr );
-                mpSimpleCache->maGraphic.SetAnimationNotifyHdl( GetGraphic().GetAnimationNotifyHdl() );
+                mxSimpleCache.reset(new GrfSimpleCacheObj(GetTransformedGraphic(&aAttr), aAttr));
+                mxSimpleCache->maGraphic.SetAnimationNotifyHdl(GetGraphic().GetAnimationNotifyHdl());
             }
 
-            mpSimpleCache->maGraphic.StartAnimation( pOut, aPt, aSz, nExtraData, pFirstFrameOutDev );
+            mxSimpleCache->maGraphic.StartAnimation(pOut, aPt, aSz, nExtraData, pFirstFrameOutDev);
 
             if( bCropped )
                 pOut->Pop();
@@ -669,8 +656,8 @@ bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const
 
 void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData )
 {
-    if( mpSimpleCache )
-        mpSimpleCache->maGraphic.StopAnimation( pOut, nExtraData );
+    if (mxSimpleCache)
+        mxSimpleCache->maGraphic.StopAnimation(pOut, nExtraData);
 }
 
 const Graphic& GraphicObject::GetGraphic() const
@@ -682,10 +669,10 @@ const Graphic& GraphicObject::GetGraphic() const
     //the cache timeout to start from now and not remain at the
     //time of creation
     // restart SwapOut timer; this is like touching in a cache to reset to the full timeout value
-    if( pThis->mpSwapOutTimer && pThis->mpSwapOutTimer->IsActive() )
+    if (pThis->mxSwapOutTimer && pThis->mxSwapOutTimer->IsActive())
     {
-        pThis->mpSwapOutTimer->Stop();
-        pThis->mpSwapOutTimer->Start();
+        pThis->mxSwapOutTimer->Stop();
+        pThis->mxSwapOutTimer->Start();
     }
 
     return maGraphic;
@@ -695,20 +682,19 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC
 {
     mpMgr->ImplUnregisterObj( *this );
 
-    if( mpSwapOutTimer )
-        mpSwapOutTimer->Stop();
+    if (mxSwapOutTimer)
+        mxSwapOutTimer->Stop();
 
     maGraphic = rGraphic;
     mbAutoSwapped = false;
     ImplAssignGraphicData();
     maLink.clear();
-    delete mpSimpleCache;
-    mpSimpleCache = nullptr;
+    mxSimpleCache.reset();
 
     mpMgr->ImplRegisterObj( *this, maGraphic, nullptr, pCopyObj);
 
-    if( mpSwapOutTimer )
-        mpSwapOutTimer->Start();
+    if (mxSwapOutTimer)
+        mxSwapOutTimer->Start();
 
 
 }
@@ -1089,8 +1075,8 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl, Timer *, void)
         mbIsInSwapOut = false;
     }
 
-    if( mpSwapOutTimer )
-        mpSwapOutTimer->Start();
+    if (mxSwapOutTimer)
+        mxSwapOutTimer->Start();
 }
 
 #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
commit d3c751fe21856cb0fcfe5672ebd9f40eaaf1dab4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 10:11:25 2016 +0000

    coverity#1371312 Missing move assignment operator
    
    Change-Id: I4484f270e33e479c954c8421a46d52f3d81ec4dc

diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
index 49ce844..13ea1c9 100644
--- a/include/svtools/transfer.hxx
+++ b/include/svtools/transfer.hxx
@@ -283,10 +283,12 @@ public:
 
                                 TransferableDataHelper();
                                 TransferableDataHelper( const TransferableDataHelper& rDataHelper );
+                                TransferableDataHelper( TransferableDataHelper&& rDataHelper );
                                 TransferableDataHelper( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable );
                                 ~TransferableDataHelper();
 
     TransferableDataHelper&     operator=( const TransferableDataHelper& rDataHelper );
+    TransferableDataHelper&     operator=( TransferableDataHelper&& rDataHelper );
 
     const css::uno::Reference< css::datatransfer::XTransferable >&    GetTransferable() const { return mxTransfer; }
     css::uno::Reference< css::datatransfer::XTransferable >           GetXTransferable() const;
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 5c0350f..1f7fcb7 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1137,15 +1137,24 @@ TransferableDataHelper::TransferableDataHelper(const TransferableDataHelper& rDa
 {
 }
 
+TransferableDataHelper::TransferableDataHelper(TransferableDataHelper&& rDataHelper)
+    : mxTransfer(std::move(rDataHelper.mxTransfer))
+    , mxClipboard(std::move(rDataHelper.mxClipboard))
+    , mxFormats(std::move(rDataHelper.mxFormats))
+    , mxObjDesc(std::move(rDataHelper.mxObjDesc))
+    , mxImpl(new TransferableDataHelper_Impl)
+{
+}
+
 TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDataHelper& rDataHelper )
 {
     if ( this != &rDataHelper )
     {
         ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
-        bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener);
+        const bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener);
 
-        if ( bWasClipboardListening )
+        if (bWasClipboardListening)
             StopClipboardListening();
 
         mxTransfer = rDataHelper.mxTransfer;
@@ -1153,13 +1162,33 @@ TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDat
         mxObjDesc.reset(new TransferableObjectDescriptor(*rDataHelper.mxObjDesc));
         mxClipboard = rDataHelper.mxClipboard;
 
-        if ( bWasClipboardListening )
+        if (bWasClipboardListening)
             StartClipboardListening();
     }
 
     return *this;
 }
 
+TransferableDataHelper& TransferableDataHelper::operator=(TransferableDataHelper&& rDataHelper)
+{
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
+
+    const bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener);
+
+    if (bWasClipboardListening)
+        StopClipboardListening();
+
+    mxTransfer = std::move(rDataHelper.mxTransfer);
+    mxFormats = std::move(rDataHelper.mxFormats);
+    mxObjDesc = std::move(rDataHelper.mxObjDesc);
+    mxClipboard = std::move(rDataHelper.mxClipboard);
+
+    if (bWasClipboardListening)
+        StartClipboardListening();
+
+    return *this;
+}
+
 TransferableDataHelper::~TransferableDataHelper()
 {
     StopClipboardListening( );
commit 0854e1a6f985b6cc272950dd3d2f3027e2f01080
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 10:02:32 2016 +0000

    use std::unique_ptr
    
    Change-Id: I5efcfe9ae2d94b34150127917c07dc920fd0e71a

diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
index 9213e67..49ce844 100644
--- a/include/svtools/transfer.hxx
+++ b/include/svtools/transfer.hxx
@@ -159,8 +159,8 @@ private:
     OUString                                                                  maLastFormat;
     mutable css::uno::Reference< css::datatransfer::clipboard::XClipboard >   mxClipboard;
     css::uno::Reference< css::frame::XTerminateListener >                     mxTerminateListener;
-    DataFlavorExVector*                                                       mpFormats;
-    TransferableObjectDescriptor*                                             mpObjDesc;
+    std::unique_ptr<DataFlavorExVector>                                       mxFormats;
+    std::unique_ptr<TransferableObjectDescriptor>                             mxObjDesc;
 
 protected:
     inline const css::uno::Reference< css::datatransfer::clipboard::XClipboard >&
@@ -212,8 +212,6 @@ private:
 
 protected:
 
-    virtual             ~TransferableHelper() override;
-
     void                AddFormat( SotClipboardFormatId nFormat );
     void                AddFormat( const css::datatransfer::DataFlavor& rFlavor );
     void                RemoveFormat( SotClipboardFormatId nFormat );
@@ -271,9 +269,9 @@ private:
 
     css::uno::Reference< css::datatransfer::XTransferable >           mxTransfer;
     css::uno::Reference< css::datatransfer::clipboard::XClipboard >   mxClipboard;
-    DataFlavorExVector*                                               mpFormats;
-    TransferableObjectDescriptor*                                     mpObjDesc;
-    std::unique_ptr<TransferableDataHelper_Impl>                      mpImpl;
+    std::unique_ptr<DataFlavorExVector>                               mxFormats;
+    std::unique_ptr<TransferableObjectDescriptor>                     mxObjDesc;
+    std::unique_ptr<TransferableDataHelper_Impl>                      mxImpl;
 
 protected:
     void                        InitFormats();
@@ -301,7 +299,7 @@ public:
     SotClipboardFormatId           GetFormat( sal_uInt32 nFormat ) const;
     css::datatransfer::DataFlavor  GetFormatDataFlavor( sal_uInt32 nFormat ) const;
 
-    DataFlavorExVector&         GetDataFlavorExVector() const {return *mpFormats; }
+    DataFlavorExVector&         GetDataFlavorExVector() const {return *mxFormats; }
 
     bool                        StartClipboardListening( );
     void                        StopClipboardListening( );
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index d673104..5c0350f 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -253,20 +253,11 @@ void SAL_CALL TransferableHelper::TerminateListener::notifyTermination( const Ev
 }
 
 
-TransferableHelper::TransferableHelper() :
-    mpFormats( new DataFlavorExVector ),
-    mpObjDesc( nullptr )
+TransferableHelper::TransferableHelper()
+    : mxFormats(new DataFlavorExVector)
 {
 }
 
-
-TransferableHelper::~TransferableHelper()
-{
-    delete mpObjDesc;
-    delete mpFormats;
-}
-
-
 Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor )
     throw (UnsupportedFlavorException, IOException, RuntimeException, std::exception)
 {
@@ -276,7 +267,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor )
 Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, const OUString& rDestDoc )
     throw (UnsupportedFlavorException, IOException, RuntimeException, std::exception)
 {
-    if( !maAny.hasValue() || mpFormats->empty() || ( maLastFormat != rFlavor.MimeType ) )
+    if( !maAny.hasValue() || mxFormats->empty() || ( maLastFormat != rFlavor.MimeType ) )
     {
         const SolarMutexGuard aGuard;
 
@@ -289,7 +280,7 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co
             bool        bDone = false;
 
             // add formats if not already done
-            if( mpFormats->empty() )
+            if (mxFormats->empty())
                 AddSupportedFormats();
 
             // check alien formats first and try to get a substitution format
@@ -393,14 +384,14 @@ Sequence< DataFlavor > SAL_CALL TransferableHelper::getTransferDataFlavors() thr
 
     try
     {
-        if( mpFormats->empty() )
+        if(mxFormats->empty())
             AddSupportedFormats();
     }
     catch( const css::uno::Exception& )
     {
     }
 
-    return comphelper::containerToSequence<DataFlavor>(*mpFormats);
+    return comphelper::containerToSequence<DataFlavor>(*mxFormats);
 }
 
 
@@ -411,14 +402,14 @@ sal_Bool SAL_CALL TransferableHelper::isDataFlavorSupported( const DataFlavor& r
 
     try
     {
-        if( mpFormats->empty() )
+        if (mxFormats->empty())
             AddSupportedFormats();
     }
     catch( const css::uno::Exception& )
     {
     }
 
-    for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
+    for (DataFlavorExVector::const_iterator aIter(mxFormats->begin() ), aEnd(mxFormats->end()); aIter != aEnd ; ++aIter)
     {
         if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
         {
@@ -542,18 +533,18 @@ void TransferableHelper::AddFormat( const DataFlavor& rFlavor )
 {
     bool bAdd = true;
 
-    for (DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
+    for (DataFlavorExVector::iterator aIter(mxFormats->begin()), aEnd(mxFormats->end()); aIter != aEnd ; ++aIter)
     {
         if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
         {
             // update MimeType for SotClipboardFormatId::OBJECTDESCRIPTOR in every case
-            if( ( SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId ) && mpObjDesc )
+            if ((SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId) && mxObjDesc)
             {
                 DataFlavor aObjDescFlavor;
 
                 SotExchange::GetFormatDataFlavor( SotClipboardFormatId::OBJECTDESCRIPTOR, aObjDescFlavor );
                 aIter->MimeType = aObjDescFlavor.MimeType;
-                aIter->MimeType += ::ImplGetParameterString( *mpObjDesc );
+                aIter->MimeType += ::ImplGetParameterString(*mxObjDesc);
             }
 
             bAdd = false;
@@ -570,10 +561,10 @@ void TransferableHelper::AddFormat( const DataFlavor& rFlavor )
         aFlavorEx.DataType = rFlavor.DataType;
         aFlavorEx.mnSotId = SotExchange::RegisterFormat( rFlavor );
 
-        if( ( SotClipboardFormatId::OBJECTDESCRIPTOR == aFlavorEx.mnSotId ) && mpObjDesc )
-            aFlavorEx.MimeType += ::ImplGetParameterString( *mpObjDesc );
+        if ((SotClipboardFormatId::OBJECTDESCRIPTOR == aFlavorEx.mnSotId) && mxObjDesc)
+            aFlavorEx.MimeType += ::ImplGetParameterString(*mxObjDesc);
 
-        mpFormats->push_back( aFlavorEx );
+        mxFormats->push_back(aFlavorEx);
 
         if( SotClipboardFormatId::BITMAP == aFlavorEx.mnSotId )
         {
@@ -600,12 +591,12 @@ void TransferableHelper::RemoveFormat( SotClipboardFormatId nFormat )
 
 void TransferableHelper::RemoveFormat( const DataFlavor& rFlavor )
 {
-    DataFlavorExVector::iterator aIter( mpFormats->begin() );
+    DataFlavorExVector::iterator aIter(mxFormats->begin());
 
-    while (aIter != mpFormats->end())
+    while (aIter != mxFormats->end())
     {
         if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
-            aIter = mpFormats->erase( aIter );
+            aIter = mxFormats->erase(aIter);
         else
             ++aIter;
     }
@@ -616,7 +607,7 @@ bool TransferableHelper::HasFormat( SotClipboardFormatId nFormat )
 {
     bool bRet = false;
 
-    for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
+    for (DataFlavorExVector::const_iterator aIter(mxFormats->begin()), aEnd(mxFormats->end()); aIter != aEnd; ++aIter)
     {
         if( nFormat == (*aIter).mnSotId )
         {
@@ -631,7 +622,7 @@ bool TransferableHelper::HasFormat( SotClipboardFormatId nFormat )
 
 void TransferableHelper::ClearFormats()
 {
-    mpFormats->clear();
+    mxFormats->clear();
     maAny.clear();
 }
 
@@ -901,8 +892,7 @@ void TransferableHelper::ObjectReleased()
 
 void TransferableHelper::PrepareOLE( const TransferableObjectDescriptor& rObjDesc )
 {
-    delete mpObjDesc;
-    mpObjDesc = new TransferableObjectDescriptor( rObjDesc );
+    mxObjDesc.reset(new TransferableObjectDescriptor(rObjDesc));
 
     if( HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ) )
         AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
@@ -1111,7 +1101,6 @@ void TransferableClipboardNotifier::dispose()
     mpListener = nullptr;
 }
 
-
 struct TransferableDataHelper_Impl
 {
     ::osl::Mutex                    maMutex;
@@ -1123,51 +1112,45 @@ struct TransferableDataHelper_Impl
     }
 };
 
-
-TransferableDataHelper::TransferableDataHelper() :
-    mpFormats( new DataFlavorExVector ),
-    mpObjDesc( new TransferableObjectDescriptor ),
-    mpImpl( new TransferableDataHelper_Impl )
+TransferableDataHelper::TransferableDataHelper()
+    : mxFormats(new DataFlavorExVector)
+    , mxObjDesc(new TransferableObjectDescriptor)
+    , mxImpl(new TransferableDataHelper_Impl)
 {
 }
 
-
-TransferableDataHelper::TransferableDataHelper( const Reference< css::datatransfer::XTransferable >& rxTransferable ) :
-    mxTransfer( rxTransferable ),
-    mpFormats( new DataFlavorExVector ),
-    mpObjDesc( new TransferableObjectDescriptor ),
-    mpImpl( new TransferableDataHelper_Impl )
+TransferableDataHelper::TransferableDataHelper(const Reference< css::datatransfer::XTransferable >& rxTransferable)
+    : mxTransfer(rxTransferable)
+    , mxFormats(new DataFlavorExVector)
+    , mxObjDesc(new TransferableObjectDescriptor)
+    , mxImpl(new TransferableDataHelper_Impl)
 {
     InitFormats();
 }
 
-
-TransferableDataHelper::TransferableDataHelper( const TransferableDataHelper& rDataHelper ) :
-    mxTransfer( rDataHelper.mxTransfer ),
-    mxClipboard( rDataHelper.mxClipboard ),
-    mpFormats( new DataFlavorExVector( *rDataHelper.mpFormats ) ),
-    mpObjDesc( new TransferableObjectDescriptor( *rDataHelper.mpObjDesc ) ),
-    mpImpl( new TransferableDataHelper_Impl )
+TransferableDataHelper::TransferableDataHelper(const TransferableDataHelper& rDataHelper)
+    : mxTransfer(rDataHelper.mxTransfer)
+    , mxClipboard(rDataHelper.mxClipboard)
+    , mxFormats(new DataFlavorExVector(*rDataHelper.mxFormats))
+    , mxObjDesc(new TransferableObjectDescriptor(*rDataHelper.mxObjDesc))
+    , mxImpl(new TransferableDataHelper_Impl)
 {
 }
 
-
 TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDataHelper& rDataHelper )
 {
     if ( this != &rDataHelper )
     {
-        ::osl::MutexGuard aGuard( mpImpl->maMutex );
+        ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
-        bool bWasClipboardListening = ( nullptr != mpImpl->mpClipboardListener );
+        bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener);
 
         if ( bWasClipboardListening )
             StopClipboardListening();
 
         mxTransfer = rDataHelper.mxTransfer;
-        delete mpFormats;
-        mpFormats = new DataFlavorExVector( *rDataHelper.mpFormats );
-        delete mpObjDesc;
-        mpObjDesc = new TransferableObjectDescriptor( *rDataHelper.mpObjDesc );
+        mxFormats.reset(new DataFlavorExVector(*rDataHelper.mxFormats));
+        mxObjDesc.reset(new TransferableObjectDescriptor(*rDataHelper.mxObjDesc));
         mxClipboard = rDataHelper.mxClipboard;
 
         if ( bWasClipboardListening )
@@ -1177,20 +1160,16 @@ TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDat
     return *this;
 }
 
-
 TransferableDataHelper::~TransferableDataHelper()
 {
     StopClipboardListening( );
     {
-        ::osl::MutexGuard aGuard( mpImpl->maMutex );
-        delete mpFormats;
-        mpFormats = nullptr;
-        delete mpObjDesc;
-        mpObjDesc = nullptr;
+        ::osl::MutexGuard aGuard(mxImpl->maMutex);
+        mxFormats.reset();
+        mxObjDesc.reset();
     }
 }
 
-
 void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor >& rDataFlavorSeq,
                                                      DataFlavorExVector& rDataFlavorExVector )
 {
@@ -1283,25 +1262,23 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor
     }
 }
 
-
 void TransferableDataHelper::InitFormats()
 {
     SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
-    mpFormats->clear();
-    delete mpObjDesc;
-    mpObjDesc = new TransferableObjectDescriptor;
+    mxFormats->clear();
+    mxObjDesc.reset(new TransferableObjectDescriptor);
 
     if( mxTransfer.is() )
     {
-        TransferableDataHelper::FillDataFlavorExVector( mxTransfer->getTransferDataFlavors(), *mpFormats );
+        TransferableDataHelper::FillDataFlavorExVector(mxTransfer->getTransferDataFlavors(), *mxFormats);
 
-        for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
+        for (DataFlavorExVector::const_iterator aIter(mxFormats->begin()), aEnd(mxFormats->end()); aIter != aEnd; ++aIter)
         {
             if( SotClipboardFormatId::OBJECTDESCRIPTOR == aIter->mnSotId )
             {
-                ImplSetParameterString( *mpObjDesc, *aIter );
+                ImplSetParameterString(*mxObjDesc, *aIter);
                 break;
             }
         }
@@ -1311,9 +1288,9 @@ void TransferableDataHelper::InitFormats()
 
 bool TransferableDataHelper::HasFormat( SotClipboardFormatId nFormat ) const
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
-    DataFlavorExVector::iterator    aIter( mpFormats->begin() ), aEnd( mpFormats->end() );
+    DataFlavorExVector::iterator    aIter(mxFormats->begin()), aEnd(mxFormats->end());
     bool                            bRet = false;
 
     while( aIter != aEnd )
@@ -1328,12 +1305,11 @@ bool TransferableDataHelper::HasFormat( SotClipboardFormatId nFormat ) const
     return bRet;
 }
 
-
 bool TransferableDataHelper::HasFormat( const DataFlavor& rFlavor ) const
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
-    DataFlavorExVector::iterator    aIter( mpFormats->begin() ), aEnd( mpFormats->end() );
+    DataFlavorExVector::iterator aIter(mxFormats->begin()), aEnd(mxFormats->end());
     bool                            bRet = false;
 
     while( aIter != aEnd )
@@ -1348,31 +1324,28 @@ bool TransferableDataHelper::HasFormat( const DataFlavor& rFlavor ) const
     return bRet;
 }
 
-
 sal_uInt32 TransferableDataHelper::GetFormatCount() const
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
-    return mpFormats->size();
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
+    return mxFormats->size();
 }
 
-
 SotClipboardFormatId TransferableDataHelper::GetFormat( sal_uInt32 nFormat ) const
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
-    DBG_ASSERT( nFormat < mpFormats->size(), "TransferableDataHelper::GetFormat: invalid format index" );
-    return( ( nFormat < mpFormats->size() ) ? (*mpFormats)[ nFormat ].mnSotId : SotClipboardFormatId::NONE );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
+    DBG_ASSERT(nFormat < mxFormats->size(), "TransferableDataHelper::GetFormat: invalid format index");
+    return( ( nFormat < mxFormats->size() ) ? (*mxFormats)[ nFormat ].mnSotId : SotClipboardFormatId::NONE );
 }
 
-
 DataFlavor TransferableDataHelper::GetFormatDataFlavor( sal_uInt32 nFormat ) const
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
-    DBG_ASSERT( nFormat < mpFormats->size(), "TransferableDataHelper::GetFormat: invalid format index" );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
+    DBG_ASSERT(nFormat < mxFormats->size(), "TransferableDataHelper::GetFormat: invalid format index");
 
     DataFlavor aRet;
 
-    if( nFormat < mpFormats->size() )
-        aRet = (*mpFormats)[ nFormat ];
+    if (nFormat < mxFormats->size())
+        aRet = (*mxFormats)[nFormat];
 
     return aRet;
 }
@@ -1413,10 +1386,9 @@ Any TransferableDataHelper::GetAny( SotClipboardFormatId nFormat, const OUString
     return aReturn;
 }
 
-
 Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& rDestDoc ) const
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
     Any aRet;
 
     try
@@ -1430,7 +1402,7 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& r
             if( nRequestFormat != SotClipboardFormatId::NONE )
             {
                 // try to get alien format first
-                for (DataFlavorExVector::const_iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() ); aIter != aEnd ; ++aIter)
+                for (DataFlavorExVector::const_iterator aIter(mxFormats->begin()), aEnd(mxFormats->end()); aIter != aEnd; ++aIter)
                 {
                     if( ( nRequestFormat == (*aIter).mnSotId ) && !rFlavor.MimeType.equalsIgnoreAsciiCase( (*aIter).MimeType ) )
                     {
@@ -1785,7 +1757,7 @@ bool TransferableDataHelper::GetTransferableObjectDescriptor( SotClipboardFormat
 
 bool TransferableDataHelper::GetTransferableObjectDescriptor( const css::datatransfer::DataFlavor&, TransferableObjectDescriptor& rDesc )
 {
-    rDesc = *mpObjDesc;
+    rDesc = *mxObjDesc;
     return true;
 }
 
@@ -2063,29 +2035,27 @@ void TransferableDataHelper::Rebind( const Reference< XTransferable >& _rxNewCon
     InitFormats();
 }
 
-
 bool TransferableDataHelper::StartClipboardListening( )
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
     StopClipboardListening( );
 
-    mpImpl->mpClipboardListener = new TransferableClipboardNotifier( mxClipboard, *this, mpImpl->maMutex );
-    mpImpl->mpClipboardListener->acquire();
+    mxImpl->mpClipboardListener = new TransferableClipboardNotifier(mxClipboard, *this, mxImpl->maMutex);
+    mxImpl->mpClipboardListener->acquire();
 
-    return mpImpl->mpClipboardListener->isListening();
+    return mxImpl->mpClipboardListener->isListening();
 }
 
-
 void TransferableDataHelper::StopClipboardListening( )
 {
-    ::osl::MutexGuard aGuard( mpImpl->maMutex );
+    ::osl::MutexGuard aGuard(mxImpl->maMutex);
 
-    if ( mpImpl->mpClipboardListener )
+    if (mxImpl->mpClipboardListener)
     {
-        mpImpl->mpClipboardListener->dispose();
-        mpImpl->mpClipboardListener->release();
-        mpImpl->mpClipboardListener = nullptr;
+        mxImpl->mpClipboardListener->dispose();
+        mxImpl->mpClipboardListener->release();
+        mxImpl->mpClipboardListener = nullptr;
     }
 }
 
commit a24b7ea97958af10004abb8f209a31031372d7c2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 13:08:11 2016 +0000

    fix build
    
    Change-Id: Ie5a566a523731bc75e85a227c4149fe8e03a2c76

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 52721e1..c402bed 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -95,7 +95,7 @@ void CommonSalLayout::getScale(double* nXScale, double* nYScale)
     unsigned int nUPEM = hb_face_get_upem(pHbFace);
 
     double nHeight(mrFontSelData.mnHeight);
-#if _WIN32
+#if defined(_WIN32)
     // FIXME: we get very weird font width on Windows, the number below is
     // “reverse engineered” so that I get the width I’m expecting.
     double nWidth(mrFontSelData.mnWidth ? mrFontSelData.mnWidth * 1.8285 : nHeight);


More information about the Libreoffice-commits mailing list