diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-01-15 17:57:07 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-01-15 17:57:07 +0000 |
| commit | c908cda71c90792646e6dfe79143ca6b7249027b (patch) | |
| tree | c96b48cd56e0a9847359493382593dfad7499c97 /src/2geom | |
| parent | cppcheck tells us: Memory leak: potraceBitmap (diff) | |
| download | inkscape-c908cda71c90792646e6dfe79143ca6b7249027b.tar.gz inkscape-c908cda71c90792646e6dfe79143ca6b7249027b.zip | |
cppcheck performance
(bzr r10891)
Diffstat (limited to 'src/2geom')
| -rw-r--r-- | src/2geom/bezier-clipping.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/conic_section_clipper_impl.cpp | 8 | ||||
| -rw-r--r-- | src/2geom/conicsec.cpp | 6 | ||||
| -rw-r--r-- | src/2geom/curve.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/d2-sbasis.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/path-intersection.cpp | 4 | ||||
| -rw-r--r-- | src/2geom/path.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/quadtree.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/sbasis-2d.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/sbasis-math.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/sbasis-roots.cpp | 2 | ||||
| -rw-r--r-- | src/2geom/solve-bezier.cpp | 2 |
12 files changed, 18 insertions, 18 deletions
diff --git a/src/2geom/bezier-clipping.cpp b/src/2geom/bezier-clipping.cpp index 799b3664a..fe925cf28 100644 --- a/src/2geom/bezier-clipping.cpp +++ b/src/2geom/bezier-clipping.cpp @@ -676,7 +676,7 @@ void distance_control_points (std::vector<Point> & D, std::vector<Point> const& F) { assert (B.size() > 1); - assert (F.size() > 0); + assert (!F.empty()); const size_t n = B.size() - 1; const size_t m = F.size() - 1; const size_t r = 2 * n - 1; diff --git a/src/2geom/conic_section_clipper_impl.cpp b/src/2geom/conic_section_clipper_impl.cpp index e091d1e05..2867e243c 100644 --- a/src/2geom/conic_section_clipper_impl.cpp +++ b/src/2geom/conic_section_clipper_impl.cpp @@ -55,7 +55,7 @@ bool CLIPPER_CLASS::intersect (std::vector<Point> & crossing_points) const // rigth edge cs.roots (rts, R.right(), X); - if (rts.size() != 0) + if (!rts.empty()) { no_crossing = false; DBGPRINT ("CLIP: right: rts[0] = ", rts[0]) @@ -84,7 +84,7 @@ bool CLIPPER_CLASS::intersect (std::vector<Point> & crossing_points) const // top edge cs.roots (rts, R.top(), Y); - if (rts.size() != 0) + if (!rts.empty()) { no_crossing = false; DBGPRINT ("CLIP: top: rts[0] = ", rts[0]) @@ -113,7 +113,7 @@ bool CLIPPER_CLASS::intersect (std::vector<Point> & crossing_points) const // left edge cs.roots (rts, R.left(), X); - if (rts.size() != 0) + if (!rts.empty()) { no_crossing = false; DBGPRINT ("CLIP: left: rts[0] = ", rts[0]) @@ -142,7 +142,7 @@ bool CLIPPER_CLASS::intersect (std::vector<Point> & crossing_points) const // bottom edge cs.roots (rts, R.bottom(), Y); - if (rts.size() != 0) + if (!rts.empty()) { no_crossing = false; DBGPRINT ("CLIP: bottom: rts[0] = ", rts[0]) diff --git a/src/2geom/conicsec.cpp b/src/2geom/conicsec.cpp index a7e8e0ad8..46793fb22 100644 --- a/src/2geom/conicsec.cpp +++ b/src/2geom/conicsec.cpp @@ -594,7 +594,7 @@ xAx xAx::operator*(double const &b) const { } Line bisector = make_bisector_line(LineSegment(A, C)); std::vector<double> bisect_rts = this->roots(bisector); - if(bisect_rts.size() > 0) { + if(!bisect_rts.empty()) { int besti = -1; for(unsigned i =0; i < bisect_rts.size(); i++) { Point p = bisector.pointAt(bisect_rts[i]); @@ -1488,7 +1488,7 @@ Rect xAx::arc_bound (const Point & P1, const Point & Q, const Point & P2) const * * P: the point to compute the nearest one */ -std::vector<Point> xAx::allNearestPoints (const Point P) const +std::vector<Point> xAx::allNearestPoints (const Point &P) const { // TODO: manage the circle - centre case std::vector<Point> points; @@ -1507,7 +1507,7 @@ std::vector<Point> xAx::allNearestPoints (const Point P) const std::vector<Point> crs = intersect (*this, G); //std::cout << "NEAREST POINT: crs.size = " << crs.size() << std::endl; - if (crs.size() == 0) return points; + if (crs.empty()) return points; size_t idx = 0; double mindist = distanceSq (crs[0], P); diff --git a/src/2geom/curve.cpp b/src/2geom/curve.cpp index fe9d607d8..c0f2bf883 100644 --- a/src/2geom/curve.cpp +++ b/src/2geom/curve.cpp @@ -61,7 +61,7 @@ int CurveHelpers::root_winding(Curve const &c, Point p) { if ( c.valueAt(t, X) > p[X] ) { // root is ray intersection // Get t of next: std::vector<double>::iterator next = ti; - next++; + ++next; double nt; if(next == ts.end()) nt = t + fudge; else nt = *next; diff --git a/src/2geom/d2-sbasis.cpp b/src/2geom/d2-sbasis.cpp index 697a9d84e..228e1ce24 100644 --- a/src/2geom/d2-sbasis.cpp +++ b/src/2geom/d2-sbasis.cpp @@ -214,7 +214,7 @@ static void set_last_point(Piecewise<D2<SBasis> > &f, Point a){ std::vector<Piecewise<D2<SBasis> > > fuse_nearby_ends(std::vector<Piecewise<D2<SBasis> > > const &f, double tol){ - if ( f.size()==0 ) return f; + if ( f.empty()) return f; std::vector<Piecewise<D2<SBasis> > > result; std::vector<std::vector<unsigned> > pre_result; for (unsigned i=0; i<f.size(); i++){ diff --git a/src/2geom/path-intersection.cpp b/src/2geom/path-intersection.cpp index c680f3a31..c514991d4 100644 --- a/src/2geom/path-intersection.cpp +++ b/src/2geom/path-intersection.cpp @@ -70,8 +70,8 @@ int winding(Path const &path, Point p) { //Traverse segments until it breaks away from y //99.9% of the time this will happen the first go Path::const_iterator next = iter; - next++; - for(; ; next++) { + ++next; + for(; ; ++next) { if(next == path.end_closed()) next = path.begin(); Rect bnds = (next->boundsFast()); //TODO: X considerations diff --git a/src/2geom/path.cpp b/src/2geom/path.cpp index 266694390..857028ccd 100644 --- a/src/2geom/path.cpp +++ b/src/2geom/path.cpp @@ -314,7 +314,7 @@ void Path::appendPortionTo(Path &ret, double from, double to) const { } if(from >= to) { const_iterator ender = end(); - if(ender->initialPoint() == ender->finalPoint()) ender++; + if(ender->initialPoint() == ender->finalPoint()) ++ender; ret.insert(ret.end(), ++fromi, ender, STITCH_DISCONTINUOUS); ret.insert(ret.end(), begin(), toi, STITCH_DISCONTINUOUS); } else { diff --git a/src/2geom/quadtree.cpp b/src/2geom/quadtree.cpp index f30475415..98030c424 100644 --- a/src/2geom/quadtree.cpp +++ b/src/2geom/quadtree.cpp @@ -236,7 +236,7 @@ void QuadTree::insert(double x0, double y0, double x1, double y1, int shape) { void QuadTree::erase(Quad *q, int shape) { - for(Quad::iterator i = q->data.begin(); i != q->data.end(); i++) { + for(Quad::iterator i = q->data.begin(); i != q->data.end(); ++i) { if(*i == shape) { q->data.erase(i); if(q->data.empty()) { diff --git a/src/2geom/sbasis-2d.cpp b/src/2geom/sbasis-2d.cpp index 4b414099a..aa5018e9e 100644 --- a/src/2geom/sbasis-2d.cpp +++ b/src/2geom/sbasis-2d.cpp @@ -168,7 +168,7 @@ sb2d_cubic_solve(SBasis2d const &f, Geom::Point const &A, Geom::Point const &B){ f_vv.apply(B[X],B[Y])*V1[Y]*V1[Y]; std::vector<D2<SBasis> > candidates = cubics_fitting_curvature(A,B,V0,V1,D2fVV0,D2fVV1); - if (candidates.size()==0) { + if (candidates.empty()) { return D2<SBasis>(Linear(A[X],B[X]),Linear(A[Y],B[Y])); } //TODO: I'm sure std algorithm could do that for me... diff --git a/src/2geom/sbasis-math.cpp b/src/2geom/sbasis-math.cpp index 409f80c31..97cdf45ce 100644 --- a/src/2geom/sbasis-math.cpp +++ b/src/2geom/sbasis-math.cpp @@ -349,7 +349,7 @@ Piecewise<SBasis> reciprocal(Piecewise<SBasis> const &f, double tol, int order){ */ Piecewise<SBasis> interpolate(std::vector<double> times, std::vector<double> values, unsigned smoothness){ assert ( values.size() == times.size() ); - if ( values.size() == 0 ) return Piecewise<SBasis>(); + if ( values.empty() ) return Piecewise<SBasis>(); if ( values.size() == 1 ) return Piecewise<SBasis>(values[0]);//what about time?? SBasis sk = shift(Linear(1.),smoothness); diff --git a/src/2geom/sbasis-roots.cpp b/src/2geom/sbasis-roots.cpp index 1b870d88f..813e471e8 100644 --- a/src/2geom/sbasis-roots.cpp +++ b/src/2geom/sbasis-roots.cpp @@ -342,7 +342,7 @@ static unsigned upper_level(vector<Interval> const &levels, double x ){ static std::vector<Interval> fuseContiguous(std::vector<Interval> const &sets, double tol=0.){ std::vector<Interval> result; - if (sets.size() == 0 ) return result; + if (sets.empty() ) return result; result.push_back( sets.front() ); for (unsigned i=1; i < sets.size(); i++ ){ if ( result.back().max() + tol >= sets[i].min() ){ diff --git a/src/2geom/solve-bezier.cpp b/src/2geom/solve-bezier.cpp index 0a9f0e310..432acb3df 100644 --- a/src/2geom/solve-bezier.cpp +++ b/src/2geom/solve-bezier.cpp @@ -232,7 +232,7 @@ void Bernsteins::find_bernstein_roots(Bezier bz, debug(std::cout << "dsolutions = " << dsolutions << std::endl); double dsplit_t = 0.5; - if(dsolutions.size() > 0) { + if(!dsolutions.empty()) { dsplit_t = dsolutions[0]; split_t = left_t + (right_t - left_t)*dsplit_t; debug(std::cout << "split_value = " << bz(split_t) << std::endl); |
