summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-13 20:42:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-14 10:13:46 +0200
commit8e39ef66928a3e37c618d3a70a631e71266db274 (patch)
tree8cab0264e58c885ae7d78a77d90fd041bcdbe15d /svgio
parentd7e06e46acc2ee17101cef63e59b9f5efcbfab14 (diff)
extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781 Reviewed-on: https://gerrit.libreoffice.org/39932 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svgpatternnode.hxx11
-rw-r--r--svgio/source/svgreader/svgpatternnode.cxx6
2 files changed, 9 insertions, 8 deletions
diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index 73d3c126bcf2..f22439eae86a 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -22,6 +22,7 @@
#include <svgnode.hxx>
#include <svgstyleattributes.hxx>
+#include <memory>
namespace svgio
{
@@ -43,8 +44,10 @@ namespace svgio
SvgNumber maY;
SvgNumber maWidth;
SvgNumber maHeight;
- SvgUnits* mpPatternUnits;
- SvgUnits* mpPatternContentUnits;
+ std::unique_ptr<SvgUnits>
+ mpPatternUnits;
+ std::unique_ptr<SvgUnits>
+ mpPatternContentUnits;
basegfx::B2DHomMatrix* mpaPatternTransform;
/// link to another pattern used as style. If maXLink
@@ -95,11 +98,11 @@ namespace svgio
/// PatternUnits content
const SvgUnits* getPatternUnits() const;
- void setPatternUnits(const SvgUnits aPatternUnits) { if(mpPatternUnits) delete mpPatternUnits; mpPatternUnits = nullptr; mpPatternUnits = new SvgUnits(aPatternUnits); }
+ void setPatternUnits(const SvgUnits aPatternUnits) { mpPatternUnits.reset( new SvgUnits(aPatternUnits) ); }
/// PatternContentUnits content
const SvgUnits* getPatternContentUnits() const;
- void setPatternContentUnits(const SvgUnits aPatternContentUnits) { if(mpPatternContentUnits) delete mpPatternContentUnits; mpPatternContentUnits = nullptr; mpPatternContentUnits = new SvgUnits(aPatternContentUnits); }
+ void setPatternContentUnits(const SvgUnits aPatternContentUnits) { mpPatternContentUnits.reset( new SvgUnits(aPatternContentUnits) ); }
/// PatternTransform content
const basegfx::B2DHomMatrix* getPatternTransform() const;
diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx
index 44cd3850aca9..6fddc16af0c2 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -56,8 +56,6 @@ namespace svgio
{
delete mpViewBox;
delete mpaPatternTransform;
- delete mpPatternUnits;
- delete mpPatternContentUnits;
}
const SvgStyleAttributes* SvgPatternNode::getSvgStyleAttributes() const
@@ -402,7 +400,7 @@ namespace svgio
{
if(mpPatternUnits)
{
- return mpPatternUnits;
+ return mpPatternUnits.get();
}
const_cast< SvgPatternNode* >(this)->tryToFindLink();
@@ -419,7 +417,7 @@ namespace svgio
{
if(mpPatternContentUnits)
{
- return mpPatternContentUnits;
+ return mpPatternContentUnits.get();
}
const_cast< SvgPatternNode* >(this)->tryToFindLink();