diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-02-15 20:50:04 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-02-15 20:50:04 +0000 |
| commit | 97642b4ccedbca62162c9321509717ed86f31d6b (patch) | |
| tree | 94975614959c0681fa61031b854458748f5f6b3a /src | |
| parent | More header cleanup/fwd declarations (diff) | |
| download | inkscape-97642b4ccedbca62162c9321509717ed86f31d6b.tar.gz inkscape-97642b4ccedbca62162c9321509717ed86f31d6b.zip | |
cppcheck
(bzr r10987)
Diffstat (limited to 'src')
| -rw-r--r-- | src/conditions.cpp | 6 | ||||
| -rw-r--r-- | src/document-subset.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 2 | ||||
| -rw-r--r-- | src/filters/flood.cpp | 14 | ||||
| -rw-r--r-- | src/measure-context.cpp | 4 | ||||
| -rw-r--r-- | src/object-snapper.cpp | 34 | ||||
| -rw-r--r-- | src/pencil-context.cpp | 2 | ||||
| -rw-r--r-- | src/selection.cpp | 2 | ||||
| -rw-r--r-- | src/snap.cpp | 32 | ||||
| -rw-r--r-- | src/sp-conn-end.cpp | 4 | ||||
| -rw-r--r-- | src/sp-filter.cpp | 2 | ||||
| -rw-r--r-- | src/sp-flowregion.cpp | 4 | ||||
| -rw-r--r-- | src/sp-flowtext.cpp | 2 | ||||
| -rw-r--r-- | src/sp-item.cpp | 6 | ||||
| -rw-r--r-- | src/sp-path.cpp | 2 | ||||
| -rw-r--r-- | src/sp-shape.cpp | 4 | ||||
| -rw-r--r-- | src/sp-text.cpp | 10 | ||||
| -rw-r--r-- | src/sp-tref.cpp | 40 | ||||
| -rw-r--r-- | src/text-editing.cpp | 18 | ||||
| -rw-r--r-- | src/verbs.cpp | 13 |
20 files changed, 104 insertions, 101 deletions
diff --git a/src/conditions.cpp b/src/conditions.cpp index 21218831a..9b233a74f 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -258,9 +258,11 @@ static bool evaluateRequiredFeatures(SPItem const */*item*/, gchar const *value) return true; std::vector<Glib::ustring> parts = splitByWhitespace(value); - if ( 0 == parts.size() ) + if (parts.empty()) + { return false; - + } + for ( unsigned int i = 0 ; i < parts.size() ; i++ ) { if (!evaluateSingleFeature(parts[i].c_str())) { return false; diff --git a/src/document-subset.cpp b/src/document-subset.cpp index 1cc337cb7..365be64ef 100644 --- a/src/document-subset.cpp +++ b/src/document-subset.cpp @@ -79,7 +79,7 @@ struct DocumentSubset::Relations : public GC::Managed<GC::ATOMIC>, // compare to the single possiblity left int pos = sp_object_compare_position(*last, obj); if ( pos < 0 ) { - last++; + ++last; } } @@ -292,7 +292,7 @@ void DocumentSubset::Relations::remove(SPObject *obj, bool subtree) { children.begin(), children.end()); for ( Siblings::iterator iter=children.begin() - ; iter != children.end() ; iter++ ) + ; iter != children.end() ; ++iter) { Record *child_record=get(*iter); g_assert( child_record != NULL ); diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index ad1642da8..47a98cb8a 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -164,7 +164,7 @@ CairoRenderState* CairoRenderContext::getParentState(void) const if (g_slist_length(_state_stack) == 1) { return _state; } else { - return (CairoRenderState *)g_slist_nth_data(_state_stack, 1); + return static_cast<CairoRenderState *>(g_slist_nth_data(_state_stack, 1)); } } diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp index 3de1eb527..d5de57785 100644 --- a/src/filters/flood.cpp +++ b/src/filters/flood.cpp @@ -41,8 +41,7 @@ static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, Inkscape::Fi static SPFilterPrimitiveClass *feFlood_parent_class; -GType -sp_feFlood_get_type() +GType sp_feFlood_get_type() { static GType feFlood_type = 0; @@ -62,8 +61,7 @@ sp_feFlood_get_type() return feFlood_type; } -static void -sp_feFlood_class_init(SPFeFloodClass *klass) +static void sp_feFlood_class_init(SPFeFloodClass *klass) { SPObjectClass *sp_object_class = (SPObjectClass *)klass; SPFilterPrimitiveClass *sp_primitive_class = (SPFilterPrimitiveClass *)klass; @@ -78,8 +76,7 @@ sp_feFlood_class_init(SPFeFloodClass *klass) sp_primitive_class->build_renderer = sp_feFlood_build_renderer; } -static void -sp_feFlood_init(SPFeFlood *feFlood) +static void sp_feFlood_init(SPFeFlood *feFlood) { feFlood->opacity = 1; feFlood->icc = NULL; @@ -105,8 +102,7 @@ sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re /** * Drops any allocated memory. */ -static void -sp_feFlood_release(SPObject *object) +static void sp_feFlood_release(SPObject *object) { if (((SPObjectClass *) feFlood_parent_class)->release) ((SPObjectClass *) feFlood_parent_class)->release(object); @@ -156,7 +152,7 @@ sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value) case SP_PROP_FLOOD_OPACITY: if (value) { read_num = g_ascii_strtod(value, &end_ptr); - if (*end_ptr) { + if (end_ptr != NULL) { g_warning("Unable to convert \"%s\" to number", value); read_num = 1; } diff --git a/src/measure-context.cpp b/src/measure-context.cpp index 2143e35eb..9db2b8de4 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -151,7 +151,7 @@ void calculate_intersections(SPDesktop * /*desktop*/, SPItem* item, Geom::PathVe Geom::CrossingSet cs = Geom::crossings(*lineseg, curve->get_pathvector()); // Reconstruct and store the points of intersection - for (Geom::Crossings::const_iterator m = cs[0].begin(); m != cs[0].end(); m++) { + for (Geom::Crossings::const_iterator m = cs[0].begin(); m != cs[0].end(); ++m) { #if 0 //TODO: consider only visible intersections Geom::Point intersection = (*lineseg)[0].pointAt((*m).ta); @@ -369,7 +369,7 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv double fontsize = prefs->getInt("/tools/measure/fontsize"); Geom::Point previous_point; - if (intersections.size() > 0) { + if (!intersections.empty()) { previous_point = intersections[0]; } diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 328f58e68..1b0bcfebd 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -99,7 +99,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, if (it != NULL) { i = it->begin(); while (i != it->end() && *i != o) { - i++; + ++i; } } @@ -191,7 +191,7 @@ void Inkscape::ObjectSnapper::_collectNodes(SnapSourceType const &t, _getBorderNodes(_points_to_snap_to); } - for (std::vector<SnapCandidateItem>::const_iterator i = _candidates->begin(); i != _candidates->end(); i++) { + for (std::vector<SnapCandidateItem>::const_iterator i = _candidates->begin(); i != _candidates->end(); ++i) { //Geom::Affine i2doc(Geom::identity()); SPItem *root_item = (*i).item; if (SP_IS_USE((*i).item)) { @@ -283,7 +283,7 @@ void Inkscape::ObjectSnapper::_snapNodes(IntermSnapResults &isr, bool success = false; bool strict_snapping = _snapmanager->snapprefs.getStrictSnapping(); - for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) { + for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); ++k) { if (_allowSourceToSnapToTarget(p.getSourceType(), (*k).getTargetType(), strict_snapping)) { Geom::Point target_pt = (*k).getPoint(); Geom::Coord dist = Geom::infinity(); @@ -329,7 +329,7 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuide(IntermSnapResults &isr, Geom::Coord tol = getSnapperTolerance(); - for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) { + for (std::vector<SnapCandidatePoint>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); ++k) { Geom::Point target_pt = (*k).getPoint(); // Project each node (*k) on the guide line (running through point p) Geom::Point p_proj = Geom::projection(target_pt, Geom::Line(p, p + Geom::rot90(guide_normal))); @@ -376,7 +376,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/, } } - for (std::vector<SnapCandidateItem>::const_iterator i = _candidates->begin(); i != _candidates->end(); i++) { + for (std::vector<SnapCandidateItem>::const_iterator i = _candidates->begin(); i != _candidates->end(); ++i) { /* Transform the requested snap point to this item's coordinates */ Geom::Affine i2doc(Geom::identity()); @@ -503,7 +503,7 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr, bool snap_tang = _snapmanager->snapprefs.getSnapTang(); //dt->snapindicator->remove_debugging_points(); - for (std::vector<SnapCandidatePath >::const_iterator it_p = _paths_to_snap_to->begin(); it_p != _paths_to_snap_to->end(); it_p++) { + for (std::vector<SnapCandidatePath >::const_iterator it_p = _paths_to_snap_to->begin(); it_p != _paths_to_snap_to->end(); ++it_p) { if (_allowSourceToSnapToTarget(p.getSourceType(), (*it_p).target_type, strict_snapping)) { bool const being_edited = node_tool_active && (*it_p).currently_being_edited; //if true then this pathvector it_pv is currently being edited in the node tool @@ -517,7 +517,7 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr, // Now we will examine each of the nearest points, and determine whether it's within snapping range and if we should snap to it std::vector<double>::const_iterator np = anp.begin(); unsigned int index = 0; - for (; np != anp.end(); np++, index++) { + for (; np != anp.end(); ++np, index++) { Geom::Curve const *curve = &((*it_pv).at_index(index)); Geom::Point const sp_doc = curve->pointAt(*np); //dt->snapindicator->set_new_debugging_point(sp_doc*dt->doc2dt()); @@ -581,7 +581,7 @@ bool Inkscape::ObjectSnapper::isUnselectedNode(Geom::Point const &point, std::ve return false; } - for (std::vector<SnapCandidatePoint>::const_iterator i = unselected_nodes->begin(); i != unselected_nodes->end(); i++) { + for (std::vector<SnapCandidatePoint>::const_iterator i = unselected_nodes->begin(); i != unselected_nodes->end(); ++i) { if (Geom::L2(point - (*i).getPoint()) < 1e-4) { return true; } @@ -633,18 +633,18 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(IntermSnapResults &isr, // Find all intersections of the constrained path with the snap target candidates std::vector<Geom::Point> intersections; - for (std::vector<SnapCandidatePath >::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); k++) { + for (std::vector<SnapCandidatePath >::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); ++k) { if (k->path_vector && _allowSourceToSnapToTarget(p.getSourceType(), (*k).target_type, strict_snapping)) { // Do the intersection math Geom::CrossingSet cs = Geom::crossings(constraint_path, *(k->path_vector)); // Store the results as intersection points unsigned int index = 0; - for (Geom::CrossingSet::const_iterator i = cs.begin(); i != cs.end(); i++) { + for (Geom::CrossingSet::const_iterator i = cs.begin(); i != cs.end(); ++i) { if (index >= constraint_path.size()) { break; } // Reconstruct and store the points of intersection - for (Geom::Crossings::const_iterator m = (*i).begin(); m != (*i).end(); m++) { + for (Geom::Crossings::const_iterator m = (*i).begin(); m != (*i).end(); ++m) { intersections.push_back(constraint_path[index].pointAt((*m).ta)); } index++; @@ -662,14 +662,14 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(IntermSnapResults &isr, Geom::Crossings cs = Geom::crossings(constraint_path.front(), cls); // Reconstruct and store the points of intersection index = 0; // assuming the constraint path vector has only one path - for (Geom::Crossings::const_iterator m = cs.begin(); m != cs.end(); m++) { + for (Geom::Crossings::const_iterator m = cs.begin(); m != cs.end(); ++m) { intersections.push_back(constraint_path[index].pointAt((*m).ta)); } } } // Convert the collected points of intersection to snapped points - for (std::vector<Geom::Point>::iterator p_inters = intersections.begin(); p_inters != intersections.end(); p_inters++) { + for (std::vector<Geom::Point>::iterator p_inters = intersections.begin(); p_inters != intersections.end(); ++p_inters) { // Convert to desktop coordinates (*p_inters) = dt->doc2dt(*p_inters); // Construct a snapped point @@ -763,7 +763,7 @@ bool Inkscape::ObjectSnapper::ThisSnapperMightSnap() const void Inkscape::ObjectSnapper::_clear_paths() const { - for (std::vector<SnapCandidatePath >::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); k++) { + for (std::vector<SnapCandidatePath >::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); ++k) { delete k->path_vector; } _paths_to_snap_to->clear(); @@ -840,7 +840,7 @@ void Inkscape::ObjectSnapper::_snapPathsTangPerp(bool snap_tang, bool snap_perp, // or we need to know the vector of the guide which is currently being translated std::vector<std::pair<Geom::Point, bool> > const origins_and_vectors = p.getOriginsAndVectors(); // Now we will iterate over all the origins and vectors and see which of these will get use a tangential or perpendicular snap - for (std::vector<std::pair<Geom::Point, bool> >::const_iterator it_origin_or_vector = origins_and_vectors.begin(); it_origin_or_vector != origins_and_vectors.end(); it_origin_or_vector++) { + for (std::vector<std::pair<Geom::Point, bool> >::const_iterator it_origin_or_vector = origins_and_vectors.begin(); it_origin_or_vector != origins_and_vectors.end(); ++it_origin_or_vector) { Geom::Point origin_or_vector_doc = dt->dt2doc((*it_origin_or_vector).first); // "first" contains a Geom::Point, denoting either a point or vector if ((*it_origin_or_vector).second) { // if "second" is true then "first" is a vector, otherwise it's a point // So we have a vector, which tells us what tangential or perpendicular direction we're looking for @@ -865,7 +865,7 @@ void Inkscape::ObjectSnapper::_snapPathsTangPerp(bool snap_tang, bool snap_perp, } else { ts = find_tangents(origin_or_vector_doc, curve->toSBasis()); } - for (std::vector<double>::const_iterator t = ts.begin(); t != ts.end(); t++) { + for (std::vector<double>::const_iterator t = ts.begin(); t != ts.end(); ++t) { point_dt = dt->doc2dt(curve->pointAt(*t)); dist = Geom::distance(point_dt, p.getPoint()); isr.points.push_back(SnappedPoint(point_dt, p.getSourceType(), p.getSourceNum(), SNAPTARGET_PATH_TANGENTIAL, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), false, true)); @@ -878,7 +878,7 @@ void Inkscape::ObjectSnapper::_snapPathsTangPerp(bool snap_tang, bool snap_perp, } else { ts = find_normals(origin_or_vector_doc, curve->toSBasis()); } - for (std::vector<double>::const_iterator t = ts.begin(); t != ts.end(); t++) { + for (std::vector<double>::const_iterator t = ts.begin(); t != ts.end(); ++t) { point_dt = dt->doc2dt(curve->pointAt(*t)); dist = Geom::distance(point_dt, p.getPoint()); isr.points.push_back(SnappedPoint(point_dt, p.getSourceType(), p.getSourceNum(), SNAPTARGET_PATH_PERPENDICULAR, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), false, true)); diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index bdaae5d01..5bc369099 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -386,7 +386,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev } if ( pc->npoints != 0) { // buttonpress may have happened before we entered draw context! - if (pc->ps.size() == 0) { + if (pc->ps.empty()) { // Only in freehand mode we have to add the first point also to pc->ps (apparently) // - We cannot add this point in spdc_set_startpoint, because we only need it for freehand // - We cannot do this in the button press handler because at that point we don't know yet diff --git a/src/selection.cpp b/src/selection.cpp index 412718994..45d8c43f2 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -478,7 +478,7 @@ std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPointsConvexHull(Sna if (!p.empty()) { std::vector<Inkscape::SnapCandidatePoint>::iterator i; Geom::RectHull cvh((p.front()).getPoint()); - for (i = p.begin(); i != p.end(); i++) { + for (i = p.begin(); i != p.end(); ++i) { // these are the points we get back cvh.add((*i).getPoint()); } diff --git a/src/snap.cpp b/src/snap.cpp index 4ca1ec476..e059bbe13 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -85,7 +85,7 @@ bool SnapManager::someSnapperMightSnap() const SnapperList const s = getSnappers(); SnapperList::const_iterator i = s.begin(); while (i != s.end() && (*i)->ThisSnapperMightSnap() == false) { - i++; + ++i; } return (i != s.end()); @@ -100,7 +100,7 @@ bool SnapManager::gridSnapperMightSnap() const SnapperList const s = getGridSnappers(); SnapperList::const_iterator i = s.begin(); while (i != s.end() && (*i)->ThisSnapperMightSnap() == false) { - i++; + ++i; } return (i != s.end()); @@ -124,7 +124,7 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::SnapCandidatePoint const IntermSnapResults isr; SnapperList const snappers = getSnappers(); - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { (*i)->freeSnap(isr, p, bbox_to_snap, &_items_to_ignore, _unselected_nodes); } @@ -249,7 +249,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapCandidatePoint IntermSnapResults isr; SnapperList const snappers = getSnappers(); - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { (*i)->constrainedSnap(isr, p, bbox_to_snap, constraint, &_items_to_ignore, _unselected_nodes); } @@ -297,7 +297,7 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool snap_mouse = prefs->getBool("/options/snapmousepointer/value", false); - for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); c++) { + for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); ++c) { // Project the mouse pointer onto the constraint; In case we don't snap then we will // return the projection onto the constraint, such that the constraint is always enforced Geom::Point pp = (*c).projection(p.getPoint()); @@ -312,10 +312,10 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi result = freeSnap(p, bbox_to_snap); } else { // Iterate over the constraints - for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); c++) { + for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); ++c) { // Try to snap to the constraint if (!snapping_is_futile) { - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { (*i)->constrainedSnap(isr, p, bbox_to_snap, *c, &_items_to_ignore,_unselected_nodes); } } @@ -327,7 +327,7 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi if (snap_mouse) { // If "snap_mouse" then we still have to apply the constraint, because so far we only tried a freeSnap Geom::Point result_closest; - for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); c++) { + for (std::vector<Inkscape::Snapper::SnapConstraint>::const_iterator c = constraints.begin(); c != constraints.end(); ++c) { // Project the mouse pointer onto the constraint; In case we don't snap then we will // return the projection onto the constraint, such that the constraint is always enforced Geom::Point result_p = (*c).projection(result.getPoint()); @@ -342,7 +342,7 @@ Inkscape::SnappedPoint SnapManager::multipleConstrainedSnaps(Inkscape::SnapCandi // So we didn't snap, but we still need to return a point on one of the constraints // Find out which of the constraints yielded the closest projection of point p - for (std::vector<Geom::Point>::iterator pp = projections.begin(); pp != projections.end(); pp++) { + for (std::vector<Geom::Point>::iterator pp = projections.begin(); pp != projections.end(); ++pp) { if (pp != projections.begin()) { if (Geom::L2(*pp - p.getPoint()) < Geom::L2(no_snap.getPoint() - p.getPoint())) { no_snap.setPoint(*pp); @@ -412,7 +412,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point &origin_or_vector, b IntermSnapResults isr; SnapperList snappers = getSnappers(); - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { (*i)->freeSnap(isr, candidate, Geom::OptRect(), NULL, NULL); } @@ -440,7 +440,7 @@ void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) Inkscape::Snapper::SnapConstraint cl(guideline.point_on_line, Geom::rot90(guideline.normal_to_line)); SnapperList snappers = getSnappers(); - for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); ++i) { (*i)->constrainedSnap(isr, candidate, Geom::OptRect(), cl, NULL, NULL); } @@ -472,7 +472,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( Geom::Rect bbox; long source_num = 0; - for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); i++) { + for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); ++i) { /* Work out the transformed version of this point */ Geom::Point transformed = _transformPoint(*i, transformation_type, transformation, origin, dim, uniform); @@ -520,7 +520,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( // std::cout << std::endl; bool first_free_snap = true; - for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); i++) { + for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); ++i) { /* Snap it */ Inkscape::SnappedPoint snapped_point; @@ -704,7 +704,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( } } - j++; + ++j; } Geom::Coord best_metric; @@ -826,7 +826,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapSkew(std::vector<Inkscape::Sn // NOT the case for example when rotating or skewing. The bounding box itself cannot possibly rotate or skew, // so it's corners have a different transformation. The snappers cannot handle this, therefore snapping // of bounding boxes is not allowed here. - if (p.size() > 0) { + if (!p.empty()) { g_assert(!(p.at(0).getSourceType() & Inkscape::SNAPSOURCE_BBOX_CATEGORY)); } @@ -977,7 +977,7 @@ Inkscape::SnappedPoint SnapManager::findBestSnap(Inkscape::SnapCandidatePoint co // now let's see which snapped point gets a thumbs up Inkscape::SnappedPoint bestSnappedPoint(p.getPoint()); // std::cout << "Finding the best snap..." << std::endl; - for (std::list<Inkscape::SnappedPoint>::const_iterator i = sp_list.begin(); i != sp_list.end(); i++) { + for (std::list<Inkscape::SnappedPoint>::const_iterator i = sp_list.begin(); i != sp_list.end(); ++i) { // std::cout << "sp = " << (*i).getPoint() << " | source = " << (*i).getSource() << " | target = " << (*i).getTarget(); bool onScreen = _desktop->get_display_area().contains((*i).getPoint()); if (onScreen || allowOffScreen) { // Only snap to points which are not off the screen diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp index 8f8b64386..80a1cce33 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -74,10 +74,10 @@ static bool try_get_intersect_point_with_item_recursive(Geom::PathVector& conn_p const Geom::PathVector& curve_pv = item_curve->get_pathvector(); Geom::CrossingSet cross = crossings(conn_pv, curve_pv); // iterate over all Crossings - for (Geom::CrossingSet::const_iterator i = cross.begin(); i != cross.end(); i++) { + for (Geom::CrossingSet::const_iterator i = cross.begin(); i != cross.end(); ++i) { const Geom::Crossings& cr = *i; - for (Geom::Crossings::const_iterator i = cr.begin(); i != cr.end(); i++) { + for (Geom::Crossings::const_iterator i = cr.begin(); i != cr.end(); ++i) { const Geom::Crossing& cr_pt = *i; if ( intersect_pos < cr_pt.ta) intersect_pos = cr_pt.ta; diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 5b2c94b7f..b39694b3a 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -543,7 +543,7 @@ gchar const *sp_filter_name_for_image(SPFilter const *filter, int const image) { default: for (map<gchar *, int, ltstr>::const_iterator i = filter->_image_name->begin() ; - i != filter->_image_name->end() ; i++) { + i != filter->_image_name->end() ; ++i) { if (i->second == image) { return i->first; } diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index ebcfcdc2f..649193c33 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -111,7 +111,7 @@ static void sp_flowregion_dispose(GObject *object) { SPFlowregion *group=(SPFlowregion *)object; - for (std::vector<Shape*>::iterator it = group->computed.begin() ; it != group->computed.end() ; it++) + for (std::vector<Shape*>::iterator it = group->computed.begin() ; it != group->computed.end() ; ++it) delete *it; group->computed.~vector<Shape*>(); } @@ -182,7 +182,7 @@ static void sp_flowregion_update(SPObject *object, SPCtx *ctx, unsigned int flag void SPFlowregion::UpdateComputed(void) { - for (std::vector<Shape*>::iterator it = computed.begin() ; it != computed.end() ; it++) { + for (std::vector<Shape*>::iterator it = computed.begin() ; it != computed.end() ; ++it) { delete *it; } computed.clear(); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index e7dcc559f..dc5b1d8bd 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -460,7 +460,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, } } else if (SP_IS_FLOWREGION(child)) { std::vector<Shape*> const &computed = SP_FLOWREGION(child)->computed; - for (std::vector<Shape*>::const_iterator it = computed.begin() ; it != computed.end() ; it++) { + for (std::vector<Shape*>::const_iterator it = computed.begin() ; it != computed.end() ; ++it) { shapes->push_back(Shape()); if (exclusion_shape->hasEdges()) { shapes->back().Booleen(*it, const_cast<Shape*>(exclusion_shape), bool_op_diff); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 89ff92035..f7f957a6f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -882,7 +882,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap clips_and_masks.push_back(mask_ref->getObject()); SPDesktop *desktop = inkscape_active_desktop(); - for (std::list<SPObject const *>::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); o++) { + for (std::list<SPObject const *>::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); ++o) { if (*o) { // obj is a group object, the children are the actual clippers for (SPObject *child = (*o)->children ; child ; child = child->next) { @@ -891,7 +891,7 @@ void SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscap // Please note the recursive call here! SP_ITEM(child)->getSnappoints(p_clip_or_mask, snapprefs); // Take into account the transformation of the item being clipped or masked - for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); p_orig++) { + for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); ++p_orig) { // All snappoints are in desktop coordinates, but the item's transformation is // in document coordinates. Hence the awkward construction below Geom::Point pt = desktop->dt2doc((*p_orig).getPoint()) * i2dt_affine(); @@ -1248,7 +1248,7 @@ void SPItem::adjust_livepatheffect (Geom::Affine const &postmul, bool set) // now that all LPEs are forked_if_necessary, we can apply the transform PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem); - for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); it++) + for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; if (lpeobj && lpeobj->get_lpe()) { diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 4ddfc77ea..3ac4666e2 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -138,7 +138,7 @@ sp_path_description(SPItem * item) Glib::ustring s; PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(item)); - for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); it++) + for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; if (!lpeobj || !lpeobj->get_lpe()) diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index efd0ed20d..ad2bea77d 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -1197,8 +1197,8 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap Geom::Crossings cs; try { cs = self_crossings(*path_it); - if (cs.size() > 0) { // There might be multiple intersections... - for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) { + if (!cs.empty()) { // There might be multiple intersections... + for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); ++i) { Geom::Point p_ix = (*path_it).pointAt((*i).ta); p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2dt, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); } diff --git a/src/sp-text.cpp b/src/sp-text.cpp index a9c1b2a4b..21c380477 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -913,15 +913,15 @@ void TextTagAttributes::transform(Geom::Affine const &matrix, double scale_x, do attributes.y[i] = point[Geom::Y]; } } - for (std::vector<SVGLength>::iterator it = attributes.dx.begin() ; it != attributes.dx.end() ; it++) + for (std::vector<SVGLength>::iterator it = attributes.dx.begin() ; it != attributes.dx.end() ; ++it) *it = it->computed * scale_x; - for (std::vector<SVGLength>::iterator it = attributes.dy.begin() ; it != attributes.dy.end() ; it++) + for (std::vector<SVGLength>::iterator it = attributes.dy.begin() ; it != attributes.dy.end() ; ++it) *it = it->computed * scale_y; } double TextTagAttributes::getDx(unsigned index) { - if( attributes.dx.size() == 0 ) { + if( attributes.dx.empty()) { return 0.0; } if( index < attributes.dx.size() ) { @@ -934,7 +934,7 @@ double TextTagAttributes::getDx(unsigned index) double TextTagAttributes::getDy(unsigned index) { - if( attributes.dy.size() == 0 ) { + if( attributes.dy.empty() ) { return 0.0; } if( index < attributes.dy.size() ) { @@ -980,7 +980,7 @@ void TextTagAttributes::addToDxDy(unsigned index, Geom::Point const &adjust) double TextTagAttributes::getRotate(unsigned index) { - if( attributes.rotate.size() == 0 ) { + if( attributes.rotate.empty() ) { return 0.0; } if( index < attributes.rotate.size() ) { diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 2eac60258..938b7c7cc 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -348,27 +348,29 @@ static gchar * sp_tref_description(SPItem *item) { SPTRef *tref = SP_TREF(item); - - SPObject *referred = tref->getObjectReferredTo(); - - if (tref && tref->getObjectReferredTo()) { - char *child_desc; - - if (SP_IS_ITEM(referred)) { - child_desc = SP_ITEM(referred)->description(); - } else { - child_desc = g_strdup(""); + + if (tref) + { + SPObject *referred = tref->getObjectReferredTo(); + + if (tref->getObjectReferredTo()) { + char *child_desc; + + if (SP_IS_ITEM(referred)) { + child_desc = SP_ITEM(referred)->description(); + } else { + child_desc = g_strdup(""); + } + + char *ret = g_strdup_printf( + _("<b>Cloned character data</b>%s%s"), + (SP_IS_ITEM(referred) ? _(" from ") : ""), + child_desc); + g_free(child_desc); + return ret; } - - char *ret = g_strdup_printf( - _("<b>Cloned character data</b>%s%s"), - (SP_IS_ITEM(referred) ? _(" from ") : ""), - child_desc); - g_free(child_desc); - return ret; - } else { - return g_strdup(_("<b>Orphaned cloned character data</b>")); } + return g_strdup(_("<b>Orphaned cloned character data</b>")); } diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 7b032065b..e6ffb54de 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -409,7 +409,7 @@ Inkscape::Text::Layout::iterator sp_te_insert_line (SPItem *item, Inkscape::Text Glib::ustring *string = &SP_STRING(split_obj)->string; unsigned char_index = 0; - for (Glib::ustring::iterator it = string->begin() ; it != split_text_iter ; it++) + for (Glib::ustring::iterator it = string->begin() ; it != split_text_iter ; ++it) char_index++; // we need to split the entire text tree into two SPString *new_string = SP_STRING(split_text_object_tree_at(split_obj, char_index)); @@ -457,7 +457,7 @@ static void insert_into_spstring(SPString *string_item, Glib::ustring::iterator unsigned char_count = g_utf8_strlen(utf8, -1); Glib::ustring *string = &SP_STRING(string_item)->string; - for (Glib::ustring::iterator it = string->begin() ; it != iter_at ; it++) + for (Glib::ustring::iterator it = string->begin() ; it != iter_at ; ++it) char_index++; string->replace(iter_at, iter_at, utf8); @@ -503,7 +503,9 @@ sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gch } // Now the simple case can begin... - if (!cursor_at_start) iter_text++; + if (!cursor_at_start){ + ++iter_text; + } SPString *string_item = SP_STRING(source_obj); insert_into_spstring(string_item, cursor_at_end ? string_item->string.end() : iter_text, utf8); } else { @@ -685,10 +687,12 @@ static void erase_from_spstring(SPString *string_item, Glib::ustring::iterator i unsigned char_count = 0; Glib::ustring *string = &SP_STRING(string_item)->string; - for (Glib::ustring::iterator it = string->begin() ; it != iter_from ; it++) + for (Glib::ustring::iterator it = string->begin() ; it != iter_from ; ++it){ char_index++; - for (Glib::ustring::iterator it = iter_from ; it != iter_to ; it++) + } + for (Glib::ustring::iterator it = iter_from ; it != iter_to ; ++it){ char_count++; + } string->erase(iter_from, iter_to); string_item->getRepr()->setContent(string->c_str()); @@ -980,7 +984,7 @@ text_tag_attributes_at_position(SPItem *item, Inkscape::Text::Layout::iterator c } Glib::ustring *string = &SP_STRING(source_item)->string; *char_index = sum_sibling_text_lengths_before(source_item); - for (Glib::ustring::iterator it = string->begin() ; it != source_text_iter ; it++) { + for (Glib::ustring::iterator it = string->begin() ; it != source_text_iter ; ++it) { ++*char_index; } @@ -1290,7 +1294,7 @@ doesn't have a version that takes iterators as parameters. */ static unsigned char_index_of_iterator(Glib::ustring const &string, Glib::ustring::const_iterator text_iter) { unsigned n = 0; - for (Glib::ustring::const_iterator it = string.begin() ; it != string.end() && it != text_iter ; it++) + for (Glib::ustring::const_iterator it = string.begin() ; it != string.end() && it != text_iter ; ++it) n++; return n; } diff --git a/src/verbs.cpp b/src/verbs.cpp index 8d411b96a..f62b35751 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -609,7 +609,7 @@ SPAction *Verb::get_action(Inkscape::UI::View::View *view) } else { for (ActionTable::iterator cur_action = _actions->begin(); cur_action != _actions->end() && view != NULL; - cur_action++) { + ++cur_action) { if (cur_action->first != NULL && cur_action->first->doc() == view->doc()) { sp_action_set_sensitive(action, cur_action->second->sensitive); break; @@ -623,14 +623,13 @@ SPAction *Verb::get_action(Inkscape::UI::View::View *view) return action; } -void -Verb::sensitive(SPDocument *in_doc, bool in_sensitive) +void Verb::sensitive(SPDocument *in_doc, bool in_sensitive) { // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive); if (_actions != NULL) { for (ActionTable::iterator cur_action = _actions->begin(); cur_action != _actions->end(); - cur_action++) { + ++cur_action) { if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) { sp_action_set_sensitive(cur_action->second, in_sensitive ? 1 : 0); } @@ -679,7 +678,7 @@ Verb::name(SPDocument *in_doc, Glib::ustring in_name) if (_actions != NULL) { for (ActionTable::iterator cur_action = _actions->begin(); cur_action != _actions->end(); - cur_action++) { + ++cur_action) { if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) { sp_action_set_name(cur_action->second, in_name); } @@ -738,7 +737,7 @@ void Verb::delete_all_view(Inkscape::UI::View::View *view) if (!_verbs.empty()) { for (VerbTable::iterator thisverb = _verbs.begin(); - thisverb != _verbs.end(); thisverb++) { + thisverb != _verbs.end(); ++thisverb) { Inkscape::Verb *verbpntr = thisverb->second; // std::cout << "Delete In Verb: " << verbpntr->_name << std::endl; verbpntr->delete_view(view); @@ -2717,7 +2716,7 @@ Verb *Verb::_base_verbs[] = { void Verb::list (void) { // Go through the dynamic verb table - for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); iter++) { + for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); ++iter) { Verb * verb = iter->second; if (verb->get_code() == SP_VERB_INVALID || verb->get_code() == SP_VERB_NONE || |
