summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2015-10-29 22:24:26 +0000
committerKris De Gussem <Kris.De.Gussem@hotmail.com>2015-10-29 22:24:26 +0000
commitfd5fce801e86b3e9ab0d56a702e89b11dbf7484e (patch)
treeeede96d54a785014bbd15af59fea2980704fa891 /src
parentpatch for bug 1511508 (diff)
downloadinkscape-fd5fce801e86b3e9ab0d56a702e89b11dbf7484e.tar.gz
inkscape-fd5fce801e86b3e9ab0d56a702e89b11dbf7484e.zip
static code analysis
(bzr r14436)
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-text.cpp8
-rw-r--r--src/extension/execution-env.cpp2
-rw-r--r--src/extension/internal/cairo-renderer.cpp2
-rw-r--r--src/extension/internal/latex-text-renderer.cpp2
-rw-r--r--src/live_effects/lpe-fill-between-many.cpp2
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp10
-rw-r--r--src/pure-transform.h56
-rw-r--r--src/selection-describer.cpp6
-rw-r--r--src/snap.cpp2
-rw-r--r--src/sp-hatch.cpp2
-rw-r--r--src/unclump.cpp10
11 files changed, 47 insertions, 55 deletions
diff --git a/src/display/canvas-text.cpp b/src/display/canvas-text.cpp
index 2c29fc207..7c019caf5 100644
--- a/src/display/canvas-text.cpp
+++ b/src/display/canvas-text.cpp
@@ -266,14 +266,10 @@ sp_canvastext_set_coords (SPCanvasText *ct, gdouble x0, gdouble y0)
void
sp_canvastext_set_coords (SPCanvasText *ct, const Geom::Point start)
{
- Geom::Point pos;
-
- g_return_if_fail (ct != NULL);
+ g_return_if_fail (ct && ct->desktop);
g_return_if_fail (SP_IS_CANVASTEXT (ct));
- if (ct && ct->desktop) {
- pos = ct->desktop->doc2dt(start);
- }
+ Geom::Point pos = ct->desktop->doc2dt(start);
if (DIFFER (pos[0], ct->s[Geom::X]) || DIFFER (pos[1], ct->s[Geom::Y])) {
ct->s[Geom::X] = pos[0];
diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp
index 29c2b5537..27d19fdff 100644
--- a/src/extension/execution-env.cpp
+++ b/src/extension/execution-env.cpp
@@ -61,7 +61,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp
if (desktop != NULL) {
std::vector<SPItem*> selected = desktop->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); x++){
+ for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); ++x){
Glib::ustring selected_id;
selected_id = (*x)->getId();
_selected.insert(_selected.end(), selected_id);
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 5a5553e97..a4561fd11 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -295,7 +295,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx)
TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value)));
std::vector<SPObject*> l(group->childList(false));
- for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); x++){
+ for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); ++x){
SPItem *item = dynamic_cast<SPItem*>(*x);
if (item) {
renderer->renderItem(ctx, item);
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index 5933dd526..dec75aeb6 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -229,7 +229,7 @@ LaTeXTextRenderer::writePostamble()
void LaTeXTextRenderer::sp_group_render(SPGroup *group)
{
std::vector<SPObject*> l = (group->childList(false));
- for(std::vector<SPObject*>::const_iterator x = l.begin(); x != l.end(); x++){
+ for(std::vector<SPObject*>::const_iterator x = l.begin(); x != l.end(); ++x){
SPItem *item = dynamic_cast<SPItem*>(*x);
if (item) {
renderItem(item);
diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp
index 3e0810cfc..574ec3580 100644
--- a/src/live_effects/lpe-fill-between-many.cpp
+++ b/src/live_effects/lpe-fill-between-many.cpp
@@ -37,7 +37,7 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve)
{
Geom::PathVector res_pathv;
SPItem * firstObj = NULL;
- for (std::vector<PathAndDirection*>::iterator iter = linked_paths._vector.begin(); iter != linked_paths._vector.end(); iter++) {
+ for (std::vector<PathAndDirection*>::iterator iter = linked_paths._vector.begin(); iter != linked_paths._vector.end(); ++iter) {
SPObject *obj;
if ((*iter)->ref.isAttached() && (obj = (*iter)->ref.getObject()) && SP_IS_ITEM(obj) && !(*iter)->_pathvector.empty()) {
Geom::Path linked_path;
diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp
index b089213fd..399307502 100644
--- a/src/live_effects/parameter/filletchamferpointarray.cpp
+++ b/src/live_effects/parameter/filletchamferpointarray.cpp
@@ -159,9 +159,8 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2(
//todo: if the path remove some nodes whith the result of a straight
//line but with handles, the node inserted into dont fire the knot
// because is not handle as cusp node by get_nodetype function
- bool this_is_line = true;
bool next_is_line = is_straight_curve(*curve_it1);
- this_is_line = is_straight_curve((*path_it)[counterCurves - 1]);
+ bool this_is_line = is_straight_curve((*path_it)[counterCurves - 1]);
nodetype = get_nodetype((*path_it)[counterCurves - 1], *curve_it1);
if (this_is_line || next_is_line) {
nodetype = NODE_CUSP;
@@ -307,9 +306,8 @@ void FilletChamferPointArrayParam::recalculate_knots(
nodetype = NODE_NONE;
}
} else {
- bool this_is_line = true;
bool next_is_line = is_straight_curve(*curve_it1);
- this_is_line = is_straight_curve((*path_it)[counterCurves - 1]);
+ bool this_is_line = is_straight_curve((*path_it)[counterCurves - 1]);
nodetype = get_nodetype((*path_it)[counterCurves - 1], *curve_it1);
if (this_is_line || next_is_line) {
nodetype = NODE_CUSP;
@@ -467,12 +465,12 @@ double FilletChamferPointArrayParam::len_to_rad(int index, double len)
Geom::Point endArcPoint = B->toSBasis().valueAt(times[2]);
Curve *knotCurve1 = A->portion(times[0], times[1]);
Curve *knotCurve2 = B->portion(times[2], 1);
- Geom::CubicBezier const *cubic1 = dynamic_cast<Geom::CubicBezier const *>(&*knotCurve1);
+ Geom::CubicBezier const *cubic1 = dynamic_cast<Geom::CubicBezier const *>(knotCurve1);
Ray ray1(startArcPoint, A->finalPoint());
if (cubic1) {
ray1.setPoints((*cubic1)[2], startArcPoint);
}
- Geom::CubicBezier const *cubic2 = dynamic_cast<Geom::CubicBezier const *>(&*knotCurve2);
+ Geom::CubicBezier const *cubic2 = dynamic_cast<Geom::CubicBezier const *>(knotCurve2);
Ray ray2(B->initialPoint(), endArcPoint);
if (cubic2) {
ray2.setPoints(endArcPoint, (*cubic2)[1]);
diff --git a/src/pure-transform.h b/src/pure-transform.h
index 8ea74ce76..f973a95b1 100644
--- a/src/pure-transform.h
+++ b/src/pure-transform.h
@@ -54,10 +54,7 @@ public:
// PureTranslate(); // Default constructor
// PureTranslate(PureTranslate const &); // Copy constructor
virtual ~PureTranslate() {};
- PureTranslate(Geom::Point vector = Geom::Point()) {
- _vector = vector;
- _vector_snapped = vector;
- }
+ PureTranslate(Geom::Point vector = Geom::Point()) : _vector(vector), _vector_snapped(vector) {}
Geom::Point getTranslationSnapped() {return _vector_snapped;}
// PureTranslate * clone () const {return new PureTranslate(*this);}
@@ -100,12 +97,12 @@ public:
// PureScale(PureScale const &); // Copy constructor
virtual ~PureScale() {};
- PureScale(Geom::Scale scale, Geom::Point origin, bool uniform) {
- _scale = scale;
- _scale_snapped = scale;
- _origin = origin;
- _uniform = uniform;
- }
+ PureScale(Geom::Scale scale, Geom::Point origin, bool uniform) :
+ _scale (scale),
+ _scale_snapped (scale),
+ _origin (origin),
+ _uniform (uniform)
+ {}
Geom::Scale getScaleSnapped() {return _scale_snapped;}
// PureScale * clone () const {return new PureScale (*this);}
@@ -142,12 +139,13 @@ protected:
public:
virtual ~PureStretchConstrained() {};
- PureStretchConstrained(Geom::Coord magnitude, Geom::Point origin, Geom::Dim2 direction, bool uniform) {
- _magnitude = magnitude;
- _origin = origin;
- _direction = direction;
- _uniform = uniform;
- _stretch_snapped = Geom::Scale(magnitude, magnitude);
+ PureStretchConstrained(Geom::Coord magnitude, Geom::Point origin, Geom::Dim2 direction, bool uniform) :
+ _magnitude (magnitude),
+ _stretch_snapped (Geom::Scale(magnitude, magnitude)),
+ _origin (origin),
+ _direction (direction),
+ _uniform (uniform)
+ {
if (not uniform) {
_stretch_snapped[1-direction] = 1.0;
}
@@ -178,13 +176,13 @@ protected:
public:
virtual ~PureSkewConstrained() {};
- PureSkewConstrained(Geom::Coord skew, Geom::Coord scale, Geom::Point origin, Geom::Dim2 direction) {
- _skew = skew;
- _skew_snapped = skew;
- _scale = scale;
- _origin = origin;
- _direction = direction;
- };
+ PureSkewConstrained(Geom::Coord skew, Geom::Coord scale, Geom::Point origin, Geom::Dim2 direction) :
+ _skew (skew),
+ _skew_snapped (skew),
+ _scale (scale),
+ _origin (origin),
+ _direction (direction)
+ {};
Geom::Coord getSkewSnapped() {return _skew_snapped;}
@@ -212,12 +210,12 @@ public:
// PureRotate(PureRotate const &); // Copy constructor
virtual ~PureRotateConstrained() {};
- PureRotateConstrained(double angle, Geom::Point origin) {
- _origin = origin;
- _angle = angle; // in radians!
- _angle_snapped = angle;
- _uniform = true; // We do not yet allow for simultaneous rotation and scaling
- }
+ PureRotateConstrained(double angle, Geom::Point origin) :
+ _angle (angle), // in radians!
+ _angle_snapped (angle),
+ _origin (origin),
+ _uniform (true) // We do not yet allow for simultaneous rotation and scaling
+ {}
double getAngleSnapped() {return _angle_snapped;}
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp
index 8304db684..ddc7a0d10 100644
--- a/src/selection-describer.cpp
+++ b/src/selection-describer.cpp
@@ -46,7 +46,7 @@ char* collect_terms (const std::vector<SPItem*> &items)
std::stringstream ss;
bool first = true;
- for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();iter++ ) {
+ for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();++iter ) {
SPItem *item = *iter;
if (item) {
const char *term = item->displayName();
@@ -65,7 +65,7 @@ static int count_terms (const std::vector<SPItem*> &items)
{
GSList *check = NULL;
int count=0;
- for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();iter++ ) {
+ for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();++iter ) {
SPItem *item = *iter;
if (item) {
const char *term = item->displayName();
@@ -82,7 +82,7 @@ static int count_terms (const std::vector<SPItem*> &items)
static int count_filtered (const std::vector<SPItem*> &items)
{
int count=0;
- for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();iter++ ) {
+ for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();++iter ) {
SPItem *item = *iter;
if (item) {
count += item->isFiltered();
diff --git a/src/snap.cpp b/src/snap.cpp
index 5a4a047b2..4721283c3 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -710,7 +710,7 @@ void SnapManager::setupIgnoreSelection(SPDesktop const *desktop,
Inkscape::Selection *sel = _desktop->selection;
std::vector<SPItem*> const items = sel->itemList();
- for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++) {
+ for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i) {
_items_to_ignore.push_back(*i);
}
}
diff --git a/src/sp-hatch.cpp b/src/sp-hatch.cpp
index ea4c5865a..2d938618c 100644
--- a/src/sp-hatch.cpp
+++ b/src/sp-hatch.cpp
@@ -113,7 +113,7 @@ void SPHatch::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref)
SPHatchPath *path_child = dynamic_cast<SPHatchPath *>(document->getObjectByRepr(child));
if (path_child) {
- for (ViewIterator iter = _display.begin(); iter != _display.end(); iter++) {
+ for (ViewIterator iter = _display.begin(); iter != _display.end(); ++iter) {
Geom::OptInterval extents = _calculateStripExtents(iter->bbox);
Inkscape::DrawingItem *ac = path_child->show(iter->arenaitem->drawing(), iter->key, extents);
diff --git a/src/unclump.cpp b/src/unclump.cpp
index 81c958937..2c6840425 100644
--- a/src/unclump.cpp
+++ b/src/unclump.cpp
@@ -172,7 +172,7 @@ static double unclump_average (SPItem *item, std::list<SPItem*> &others)
{
int n = 0;
double sum = 0;
- for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();i++) {
+ for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();++i) {
SPItem *other = *i;
if (other == item)
@@ -196,7 +196,7 @@ static SPItem *unclump_closest (SPItem *item, std::list<SPItem*> &others)
double min = HUGE_VAL;
SPItem *closest = NULL;
- for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();i++) {
+ for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();++i) {
SPItem *other = *i;
if (other == item)
@@ -219,7 +219,7 @@ static SPItem *unclump_farest (SPItem *item, std::list<SPItem*> &others)
{
double max = -HUGE_VAL;
SPItem *farest = NULL;
- for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();i++) {
+ for (std::list<SPItem*>::const_iterator i = others.begin(); i != others.end();++i) {
SPItem *other = *i;
if (other == item)
@@ -259,7 +259,7 @@ unclump_remove_behind (SPItem *item, SPItem *closest, std::list<SPItem*> &rest)
double val_item = A * it[Geom::X] + B * it[Geom::Y] + C;
std::vector<SPItem*> out;
- for (std::list<SPItem*>::const_reverse_iterator i = rest.rbegin(); i != rest.rend();i++) {
+ for (std::list<SPItem*>::const_reverse_iterator i = rest.rbegin(); i != rest.rend();++i) {
SPItem *other = *i;
if (other == item)
@@ -336,7 +336,7 @@ unclump (std::vector<SPItem*> &items)
c_cache.clear();
wh_cache.clear();
- for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end();i++) { // for each original/clone x:
+ for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end();++i) { // for each original/clone x:
SPItem *item = *i;
std::list<SPItem*> nei;