summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2013-04-21 09:56:09 +0000
committerKris <Kris.De.Gussem@hotmail.com>2013-04-21 09:56:09 +0000
commit8d793593fff1737c91b76f820e1b4aa021897cee (patch)
tree7e23a82675cbb16050942625337c35836a17f59a /src
parentFix symbols not being installed bug reported by suv (diff)
downloadinkscape-8d793593fff1737c91b76f820e1b4aa021897cee.tar.gz
inkscape-8d793593fff1737c91b76f820e1b4aa021897cee.zip
cppcheck
(bzr r12293)
Diffstat (limited to 'src')
-rw-r--r--src/color-profile.cpp6
-rw-r--r--src/color.cpp4
-rw-r--r--src/dom/util/ziptool.cpp26
-rw-r--r--src/snapped-point.cpp163
4 files changed, 109 insertions, 90 deletions
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 14f88c77e..5fb84d8ac 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -619,8 +619,6 @@ cmsHTRANSFORM ColorProfile::getTransfGamutCheck()
bool ColorProfile::GamutCheck(SPColor color)
{
- bool result = false;
-
guint32 val = color.toRGBA32(0);
#if HAVE_LIBLCMS1
@@ -651,9 +649,7 @@ bool ColorProfile::GamutCheck(SPColor color)
cmsSetAlarmCodes(oldAlarmCodes);
#endif // HAVE_LIBLCMS1
- result = (outofgamut != 0);
-
- return result;
+ return (outofgamut != 0);
}
class ProfileInfo
diff --git a/src/color.cpp b/src/color.cpp
index 0a07d3f21..5eb0d91ef 100644
--- a/src/color.cpp
+++ b/src/color.cpp
@@ -99,9 +99,7 @@ bool SPColor::operator == (SPColor const& other) const
*/
bool SPColor::isClose( SPColor const& other, float epsilon ) const
{
- bool match = false;
-
- match = (fabs((v.c[0]) - (other.v.c[0])) < epsilon)
+ bool match = (fabs((v.c[0]) - (other.v.c[0])) < epsilon)
&& (fabs((v.c[1]) - (other.v.c[1])) < epsilon)
&& (fabs((v.c[2]) - (other.v.c[2])) < epsilon);
diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp
index 9d9d5685c..cf024008f 100644
--- a/src/dom/util/ziptool.cpp
+++ b/src/dom/util/ziptool.cpp
@@ -1895,24 +1895,30 @@ bool GzipFile::readFile(const std::string &fileName)
/**
* Constructor
*/
-ZipEntry::ZipEntry()
+ZipEntry::ZipEntry() :
+ crc (0L),
+ fileName (),
+ comment (),
+ compressionMethod (8),
+ compressedData (),
+ uncompressedData (),
+ position (0)
{
- crc = 0L;
- compressionMethod = 8;
- position = 0;
}
/**
*
*/
ZipEntry::ZipEntry(const std::string &fileNameArg,
- const std::string &commentArg)
+ const std::string &commentArg) :
+ crc (0L),
+ fileName (fileNameArg),
+ comment (commentArg),
+ compressionMethod (8),
+ compressedData (),
+ uncompressedData (),
+ position (0)
{
- crc = 0L;
- compressionMethod = 8;
- fileName = fileNameArg;
- comment = commentArg;
- position = 0;
}
/**
diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp
index d155babd7..ca45410c5 100644
--- a/src/snapped-point.cpp
+++ b/src/snapped-point.cpp
@@ -14,92 +14,111 @@
#include "preferences.h"
// overloaded constructor
-Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained, Geom::OptRect target_bbox)
- : _point(p), _source(source), _source_num(source_num), _target(target), _distance(d), _tolerance(std::max(t,1.0)), _always_snap(a), _target_bbox(target_bbox)
+Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained, Geom::OptRect target_bbox) :
+ _point(p),
+ _tangent(Geom::Point(0,0)),
+ _source(source),
+ _source_num(source_num),
+ _target(target),
+ _at_intersection (false),
+ _constrained_snap (constrained_snap),
+ _fully_constrained (fully_constrained),
+ _distance(d),
+ _tolerance(std::max(t,1.0)),// tolerance should never be smaller than 1 px, as it is used for normalization in isOtherSnapBetter. We don't want a division by zero.
+ _always_snap(a),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _target_bbox(target_bbox),
+ _pointer_distance (Geom::infinity())
{
- // tolerance should never be smaller than 1 px, as it is used for normalization in isOtherSnapBetter. We don't want a division by zero.
- _at_intersection = false;
- _constrained_snap = constrained_snap;
- _fully_constrained = fully_constrained;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
}
-Inkscape::SnappedPoint::SnappedPoint(Inkscape::SnapCandidatePoint const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained)
- : _target(target), _distance(d), _tolerance(std::max(t,1.0)), _always_snap(a)
+Inkscape::SnappedPoint::SnappedPoint(Inkscape::SnapCandidatePoint const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained) :
+ _point (p.getPoint()),
+ _tangent (Geom::Point(0,0)),
+ _source (p.getSourceType()),
+ _source_num (p.getSourceNum()),
+ _target(target),
+ _at_intersection (false),
+ _constrained_snap (constrained_snap),
+ _fully_constrained (fully_constrained),
+ _distance(d),
+ _tolerance(std::max(t,1.0)),
+ _always_snap(a),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _target_bbox (p.getTargetBBox()),
+ _pointer_distance (Geom::infinity())
{
- _point = p.getPoint();
- _source = p.getSourceType();
- _source_num = p.getSourceNum();
- _at_intersection = false;
- _constrained_snap = constrained_snap;
- _fully_constrained = fully_constrained;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = p.getTargetBBox();
-
}
-Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &constrained_snap, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2)
- : _point(p), _source(source), _source_num(source_num), _target(target), _at_intersection(at_intersection), _constrained_snap(constrained_snap), _fully_constrained(fully_constrained), _distance(d), _tolerance(std::max(t,1.0)), _always_snap(a),
- _second_distance(d2), _second_tolerance(std::max(t2,1.0)), _second_always_snap(a2)
-{
+Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &constrained_snap, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2) :
+ _point(p),
+ _tangent (Geom::Point(0,0)),
+ _source(source),
+ _source_num(source_num),
+ _target(target),
+ _at_intersection(at_intersection),
+ _constrained_snap(constrained_snap),
+ _fully_constrained(fully_constrained),
+ _distance(d),
+ _tolerance(std::max(t,1.0)),
+ _always_snap(a),
+ _second_distance(d2),
+ _second_tolerance(std::max(t2,1.0)),
+ _second_always_snap(a2),
// tolerance should never be smaller than 1 px, as it is used for normalization in
// isOtherSnapBetter. We don't want a division by zero.
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = Geom::OptRect();
+ _transformation (Geom::Point(1,1)),
+ _pointer_distance (Geom::infinity()),
+ _target_bbox (Geom::OptRect())
+{
}
-Inkscape::SnappedPoint::SnappedPoint()
+Inkscape::SnappedPoint::SnappedPoint():
+ _point (Geom::Point(0,0)),
+ _tangent (Geom::Point(0,0)),
+ _source (SNAPSOURCE_UNDEFINED),
+ _source_num (-1),
+ _target (SNAPTARGET_UNDEFINED),
+ _at_intersection (false),
+ _constrained_snap (false),
+ _fully_constrained (false),
+ _distance (Geom::infinity()),
+ _tolerance (1),
+ _always_snap (false),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _pointer_distance (Geom::infinity()),
+ _target_bbox (Geom::OptRect())
{
- _point = Geom::Point(0,0);
- _source = SNAPSOURCE_UNDEFINED,
- _source_num = -1,
- _target = SNAPTARGET_UNDEFINED,
- _at_intersection = false;
- _constrained_snap = false;
- _fully_constrained = false;
- _distance = Geom::infinity();
- _tolerance = 1;
- _always_snap = false;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = Geom::OptRect();
}
-Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p)
+Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p):
+ _point (p),
+ _tangent (Geom::Point(0,0)),
+ _source (SNAPSOURCE_UNDEFINED),
+ _source_num (-1),
+ _target (SNAPTARGET_UNDEFINED),
+ _at_intersection (false),
+ _constrained_snap (false),
+ _fully_constrained (false),
+ _distance (Geom::infinity()),
+ _tolerance (1),
+ _always_snap (false),
+ _second_distance (Geom::infinity()),
+ _second_tolerance (1),
+ _second_always_snap (false),
+ _transformation (Geom::Point(1,1)),
+ _pointer_distance (Geom::infinity()),
+ _target_bbox (Geom::OptRect())
{
- _point = p;
- _source = SNAPSOURCE_UNDEFINED,
- _source_num = -1,
- _target = SNAPTARGET_UNDEFINED,
- _at_intersection = false;
- _constrained_snap = false;
- _fully_constrained = false;
- _distance = Geom::infinity();
- _tolerance = 1;
- _always_snap = false;
- _second_distance = Geom::infinity();
- _second_tolerance = 1;
- _second_always_snap = false;
- _transformation = Geom::Point(1,1);
- _tangent = Geom::Point(0,0);
- _pointer_distance = Geom::infinity();
- _target_bbox = Geom::OptRect();
}
Inkscape::SnappedPoint::~SnappedPoint()