[Libreoffice-commits] core.git: 4 commits - connectivity/source editeng/source include/editeng

Caolán McNamara caolanm at redhat.com
Fri Nov 11 17:04:07 UTC 2016


 connectivity/source/inc/file/fcode.hxx |    9 +++++
 editeng/source/items/frmitems.cxx      |   56 +++++++++++++++++++++++++++------
 include/editeng/brushitem.hxx          |    4 +-
 3 files changed, 58 insertions(+), 11 deletions(-)

New commits:
commit 8909cbeb315e257fbe06dad6caee5db18879b916
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 16:45:22 2016 +0000

    coverity#1371239 Missing move assignment operator
    
    Change-Id: Ie5cddac8b4b0c8eefee82a14c845982600df0455

diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index c346569..e18bebf 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -44,7 +44,16 @@ namespace connectivity
         class OOO_DLLPUBLIC_FILE OCode
         {
         public:
+            //virtual dtor to allow this to be the root of the class hierarchy
             virtual ~OCode() = default;
+            //but that disables the default move ctor
+            OCode(OCode&&) = default;
+            //but that disables the rest of default ctors
+            OCode(const OCode&) = default;
+            OCode() = default;
+            //and same issue for the assignment operators
+            OCode& operator=(const OCode&) = default;
+            OCode& operator=(OCode&&) = default;
 
             inline static void * SAL_CALL operator new( size_t nSize )
                 { return ::rtl_allocateMemory( nSize ); }
commit 5abd8d2eeeaecfcd18e2c61fe6d5a674a1826b69
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 12:34:27 2016 +0000

    coverity#1371263 Missing move assignment operator
    
    Change-Id: Ifb4117afac4aa86893e674a581e1a7bb80925ee3

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index ec383eb..20b8511 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3439,6 +3439,19 @@ SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem)
 {
 }
 
+SvxBrushItem::SvxBrushItem(SvxBrushItem&& rItem)
+    : SfxPoolItem(std::move(rItem))
+    , aColor(std::move(rItem.aColor))
+    , nShadingValue(std::move(rItem.nShadingValue))
+    , xGraphicObject(std::move(rItem.xGraphicObject))
+    , nGraphicTransparency(std::move(rItem.nGraphicTransparency))
+    , maStrLink(std::move(rItem.maStrLink))
+    , maStrFilter(std::move(rItem.maStrFilter))
+    , eGraphicPos(std::move(rItem.eGraphicPos))
+    , bLoadAgain(std::move(rItem.bLoadAgain))
+{
+}
+
 SvxBrushItem::~SvxBrushItem()
 {
 }
@@ -3688,6 +3701,19 @@ SvxBrushItem& SvxBrushItem::operator=(const SvxBrushItem& rItem)
     return *this;
 }
 
+SvxBrushItem& SvxBrushItem::operator=(SvxBrushItem&& rItem)
+{
+    aColor = std::move(rItem.aColor);
+    nShadingValue = std::move(rItem.nShadingValue);
+    xGraphicObject = std::move(rItem.xGraphicObject);
+    nGraphicTransparency = std::move(rItem.nGraphicTransparency);
+    maStrLink = std::move(rItem.maStrLink);
+    maStrFilter = std::move(rItem.maStrFilter);
+    eGraphicPos = std::move(rItem.eGraphicPos);
+    bLoadAgain = std::move(rItem.bLoadAgain);
+    return *this;
+}
+
 bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
 {
     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
index 45c5a3f..83d4467 100644
--- a/include/editeng/brushitem.hxx
+++ b/include/editeng/brushitem.hxx
@@ -72,6 +72,7 @@ public:
     SvxBrushItem( const OUString& rLink, const OUString& rFilter,
                   SvxGraphicPosition ePos, sal_uInt16 nWhich );
     SvxBrushItem( const SvxBrushItem& );
+    SvxBrushItem( SvxBrushItem&& );
     SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
 
     virtual ~SvxBrushItem() override;
@@ -114,7 +115,8 @@ public:
     void                SetGraphicLink( const OUString& rNew );
     void                SetGraphicFilter( const OUString& rNew );
 
-    SvxBrushItem&       operator=( const SvxBrushItem& rItem);
+    SvxBrushItem&       operator=(const SvxBrushItem& rItem);
+    SvxBrushItem&       operator=(SvxBrushItem&& rItem);
 
     static SvxGraphicPosition   WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
     static WallpaperStyle       GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
commit f731296e0ce7c4a0be77fdcba0c2578147211dfa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 12:33:35 2016 +0000

    check for self-assignment
    
    Change-Id: I74eb934d19c0b511870e5a675917ca4baaf768cc

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 6bfcbaa..ec383eb 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3674,14 +3674,17 @@ bool SvxBrushItem::GetPresentation
 
 SvxBrushItem& SvxBrushItem::operator=(const SvxBrushItem& rItem)
 {
-    aColor = rItem.aColor;
-    nShadingValue = rItem.nShadingValue;
-    xGraphicObject.reset(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr);
-    nGraphicTransparency = rItem.nGraphicTransparency;
-    maStrLink = rItem.maStrLink;
-    maStrFilter = rItem.maStrFilter;
-    eGraphicPos = rItem.eGraphicPos;
-    bLoadAgain = rItem.bLoadAgain;
+    if (&rItem != this)
+    {
+        aColor = rItem.aColor;
+        nShadingValue = rItem.nShadingValue;
+        xGraphicObject.reset(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr);
+        nGraphicTransparency = rItem.nGraphicTransparency;
+        maStrLink = rItem.maStrLink;
+        maStrFilter = rItem.maStrFilter;
+        eGraphicPos = rItem.eGraphicPos;
+        bLoadAgain = rItem.bLoadAgain;
+    }
     return *this;
 }
 
commit 4a862a6a016f5ae9f8ce466c917a8d012fe293ef
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 11 12:19:48 2016 +0000

    make it more typical copy ctor
    
    Change-Id: I0367e24b966a5bcc0d4838022ae12054e097270e

diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 8aa5ee4..6bfcbaa 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3427,9 +3427,16 @@ SvxBrushItem::SvxBrushItem(SvStream& rStream, sal_uInt16 nVersion, sal_uInt16 _n
 }
 
 SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem)
-    : SfxPoolItem(rItem.Which())
+    : SfxPoolItem(rItem)
+    , aColor(rItem.aColor)
+    , nShadingValue(rItem.nShadingValue)
+    , xGraphicObject(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr)
+    , nGraphicTransparency(rItem.nGraphicTransparency)
+    , maStrLink(rItem.maStrLink)
+    , maStrFilter(rItem.maStrFilter)
+    , eGraphicPos(rItem.eGraphicPos)
+    , bLoadAgain(rItem.bLoadAgain)
 {
-    *this = rItem;
 }
 
 SvxBrushItem::~SvxBrushItem()


More information about the Libreoffice-commits mailing list