basegfx/source/polygon/b2dpolygon.cxx     |    9 +++++++++
 basegfx/source/polygon/b2dpolypolygon.cxx |    2 ++
 2 files changed, 11 insertions(+)

New commits:
commit c8649af8d0353e2fba2e472f0ace50f5bd8167b2
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Sep 20 11:16:17 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Sep 20 17:26:54 2022 +0200

    Assert that cow_wrapped objects aren't called to do nothing
    
    An omission from commit e39fa3c4f5ae2560a4b6f6f789a0c5098ac43cf4
      Simplify b2d(poly)polygon implementation
    
    Change-Id: Ib0b10e06baf91888f0e9797e670e0626f512af15
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140229
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/basegfx/source/polygon/b2dpolygon.cxx 
b/basegfx/source/polygon/b2dpolygon.cxx
index 03957c8710a3..b0171ef000e2 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -82,6 +82,7 @@ public:
 
     void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue, sal_uInt32 
nCount)
     {
+        assert(nCount > 0);
         assert(nIndex <= maVector.size());
         // add nCount copies of rValue
         maVector.insert(maVector.begin() + nIndex, nCount, rValue);
@@ -89,6 +90,7 @@ public:
 
     void insert(sal_uInt32 nIndex, const CoordinateDataArray2D& rSource)
     {
+        assert(rSource.maVector.size() > 0);
         assert(nIndex <= maVector.size());
         // insert data
         auto aIndex = maVector.begin();
@@ -100,6 +102,7 @@ public:
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
+        assert(nCount > 0);
         assert(nIndex + nCount <= maVector.size());
         // remove point data
         const auto aStart = maVector.begin() + nIndex;
@@ -328,6 +331,7 @@ public:
 
     void insert(sal_uInt32 nIndex, const ControlVectorPair2D& rValue, 
sal_uInt32 nCount)
     {
+        assert(nCount > 0);
         assert(nIndex <= maVector.size());
 
         // add nCount copies of rValue
@@ -342,6 +346,7 @@ public:
 
     void insert(sal_uInt32 nIndex, const ControlVectorArray2D& rSource)
     {
+        assert(rSource.maVector.size() > 0);
         assert(nIndex <= maVector.size());
 
         // insert data
@@ -362,6 +367,7 @@ public:
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
+        assert(nCount > 0);
         assert(nIndex + nCount <= maVector.size());
 
         const ControlVectorPair2DVector::iterator 
aDeleteStart(maVector.begin() + nIndex);
@@ -689,6 +695,7 @@ public:
 
     void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 
nCount)
     {
+        assert(nCount > 0);
         mpBufferedData.reset();
         auto aCoordinate = rPoint;
         maPoints.insert(nIndex, aCoordinate, nCount);
@@ -804,6 +811,7 @@ public:
 
     void append(const ImplB2DPolygon& rSource)
     {
+        assert(rSource.maPoints.count() > 0);
         const sal_uInt32 nIndex = count();
 
         mpBufferedData.reset();
@@ -828,6 +836,7 @@ public:
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
+        assert(nCount > 0);
         mpBufferedData.reset();
         maPoints.remove(nIndex, nCount);
 
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx 
b/basegfx/source/polygon/b2dpolypolygon.cxx
index dc8f0f53e98c..6ce3b398a1fb 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -102,6 +102,7 @@ public:
 
     void insert(sal_uInt32 nIndex, const basegfx::B2DPolygon& rPolygon, 
sal_uInt32 nCount)
     {
+        assert(nCount > 0);
         assert(nIndex <= maPolygons.size());
         // add nCount copies of rPolygon
         maPolygons.insert(maPolygons.begin() + nIndex, nCount, rPolygon);
@@ -131,6 +132,7 @@ public:
 
     void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
     {
+        assert(nCount > 0);
         assert(nIndex + nCount <= maPolygons.size());
         // remove polygon data
         auto aStart(maPolygons.begin() + nIndex);

Reply via email to