summaryrefslogtreecommitdiff
path: root/basegfx/source
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2009-10-16 22:58:23 +0200
committerthb <thb@openoffice.org>2009-10-16 22:58:23 +0200
commit42c0c069b71db77b3a0f1617dac3c569df798625 (patch)
tree82d1cc56cc8e60aca8f11a790219fb9d6125ca12 /basegfx/source
parentd3356548cf6aa4c53cb4c17395df82e8bbdea88f (diff)
#i105939# Decided returning by const ref was a bad idea, coupling-
and in terms of unwanted side effects (think vector re-allocating the mem). Fixed iterator-to-ptr conversion for obvious oversights.
Diffstat (limited to 'basegfx/source')
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx24
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx20
-rw-r--r--basegfx/source/range/b2dpolyrange.cxx20
3 files changed, 50 insertions, 14 deletions
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index ccf45d31cbbc..0f70c7efafda 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -210,22 +210,34 @@ public:
const basegfx::B2DPoint* begin() const
{
- return &maVector.front();
+ if(maVector.empty())
+ return 0;
+ else
+ return &maVector.front();
}
const basegfx::B2DPoint* end() const
{
- return &maVector[maVector.size()];
+ if(maVector.empty())
+ return 0;
+ else
+ return (&maVector.back())+1;
}
basegfx::B2DPoint* begin()
{
- return &maVector.front();
+ if(maVector.empty())
+ return 0;
+ else
+ return &maVector.front();
}
basegfx::B2DPoint* end()
{
- return &maVector[maVector.size()];
+ if(maVector.empty())
+ return 0;
+ else
+ return (&maVector.back())+1;
}
};
@@ -1201,7 +1213,7 @@ namespace basegfx
return mpPolygon->count();
}
- const B2DPoint& B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
+ B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");
@@ -1460,7 +1472,7 @@ namespace basegfx
return mpPolygon->getDefaultAdaptiveSubdivision(*this);
}
- const B2DRange& B2DPolygon::getB2DRange() const
+ B2DRange B2DPolygon::getB2DRange() const
{
return mpPolygon->getB2DRange(*this);
}
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index af63bbccf8d4..2acc1a31a369 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -169,22 +169,34 @@ public:
const basegfx::B2DPolygon* begin() const
{
- return &maPolygons.front();
+ if(maPolygons.empty())
+ return 0;
+ else
+ return &maPolygons.front();
}
const basegfx::B2DPolygon* end() const
{
- return &maPolygons[maPolygons.size()];
+ if(maPolygons.empty())
+ return 0;
+ else
+ return (&maPolygons.back())+1;
}
basegfx::B2DPolygon* begin()
{
- return &maPolygons.front();
+ if(maPolygons.empty())
+ return 0;
+ else
+ return &maPolygons.front();
}
basegfx::B2DPolygon* end()
{
- return &maPolygons[maPolygons.size()];
+ if(maPolygons.empty())
+ return 0;
+ else
+ return &(maPolygons.back())+1;
}
};
diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx
index d35af8f5dd0c..e212e083ef55 100644
--- a/basegfx/source/range/b2dpolyrange.cxx
+++ b/basegfx/source/range/b2dpolyrange.cxx
@@ -229,22 +229,34 @@ namespace basegfx
const B2DRange* begin() const
{
- return &maRanges.front();
+ if(maRanges.empty())
+ return 0;
+ else
+ return &maRanges.front();
}
const B2DRange* end() const
{
- return &maRanges[maRanges.size()];
+ if(maRanges.empty())
+ return 0;
+ else
+ return (&maRanges.back())+1;
}
B2DRange* begin()
{
- return &maRanges.front();
+ if(maRanges.empty())
+ return 0;
+ else
+ return &maRanges.front();
}
B2DRange* end()
{
- return &maRanges[maRanges.size()];
+ if(maRanges.empty())
+ return 0;
+ else
+ return (&maRanges.back())+1;
}
private: