diff options
| author | Marc Jeanmougin <mc@localhost.localdomain> | 2015-02-27 03:21:48 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <mc@localhost.localdomain> | 2015-02-27 03:21:48 +0000 |
| commit | 9bdc157f705ca61516e599cb416580283d21ec35 (patch) | |
| tree | 59cc0dbb46445c8741913922bf7d983f35d5c11d /src | |
| parent | corrected the casts (hopefully) (diff) | |
| download | inkscape-9bdc157f705ca61516e599cb416580283d21ec35.tar.gz inkscape-9bdc157f705ca61516e599cb416580283d21ec35.zip | |
more cast cleanup
(bzr r13922.1.11)
Diffstat (limited to 'src')
28 files changed, 86 insertions, 89 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 82f66dcdf..afdc3064a 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -197,7 +197,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write std::vector<SPItem*> const itemlist = desktop->selection->itemList(); for (std::vector<SPItem*>::const_iterator i = itemlist.begin(); i!= itemlist.end(); i++) { /* last used styles for 3D box faces are stored separately */ - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; Box3DSide *side = dynamic_cast<Box3DSide *>(obj); if (side) { const char * descr = box3d_side_axes_string(side); @@ -448,7 +448,6 @@ stroke_average_width (const std::vector<SPItem*> &objects) bool notstroked = true; int n_notstroked = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); SPItem *item = *i; if (!item) { continue; @@ -515,7 +514,7 @@ objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_re bool same_color = true; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i!= objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!obj) { continue; } @@ -699,7 +698,7 @@ objects_query_opacity (const std::vector<SPItem*> &objects, SPStyle *style_res) for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!obj) { continue; } @@ -755,7 +754,7 @@ objects_query_strokewidth (const std::vector<SPItem*> &objects, SPStyle *style_r int n_stroked = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!obj) { continue; } @@ -829,7 +828,7 @@ objects_query_miterlimit (const std::vector<SPItem*> &objects, SPStyle *style_re bool same_ml = true; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!dynamic_cast<SPItem *>(obj)) { continue; } @@ -888,7 +887,7 @@ objects_query_strokecap (const std::vector<SPItem*> &objects, SPStyle *style_res int n_stroked = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!dynamic_cast<SPItem *>(obj)) { continue; } @@ -942,7 +941,7 @@ objects_query_strokejoin (const std::vector<SPItem*> &objects, SPStyle *style_re int n_stroked = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!dynamic_cast<SPItem *>(obj)) { continue; } @@ -1005,7 +1004,7 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r int no_size = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!isTextualItem(obj)) { continue; @@ -1124,7 +1123,7 @@ objects_query_fontstyle (const std::vector<SPItem*> &objects, SPStyle *style_res int texts = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!isTextualItem(obj)) { continue; @@ -1193,7 +1192,7 @@ objects_query_baselines (const std::vector<SPItem*> &objects, SPStyle *style_res int texts = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!isTextualItem(obj)) { continue; @@ -1281,7 +1280,7 @@ objects_query_fontfamily (const std::vector<SPItem*> &objects, SPStyle *style_re style_res->font_family.set = FALSE; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl; if (!isTextualItem(obj)) { @@ -1337,7 +1336,7 @@ objects_query_fontspecification (const std::vector<SPItem*> &objects, SPStyle *s style_res->font_specification.set = FALSE; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl; if (!isTextualItem(obj)) { @@ -1395,7 +1394,7 @@ objects_query_blend (const std::vector<SPItem*> &objects, SPStyle *style_res) guint items = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!obj) { continue; } @@ -1485,7 +1484,7 @@ objects_query_blur (const std::vector<SPItem*> &objects, SPStyle *style_res) guint items = 0; for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { - SPObject *obj = reinterpret_cast<SPObject *>(*i); + SPObject *obj = *i; if (!obj) { continue; } diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 11c494b18..717ca3310 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -51,7 +51,7 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { - const SPItem * item = selected.front(); + const SPItem * item = selected[0]; first_select = item->getRepr(); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index b30c8892e..a2cea014b 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -296,8 +296,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) std::vector<SPObject*> l(group->childList(false)); for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); x++){ - SPObject *o = reinterpret_cast<SPObject *>(*x); - SPItem *item = dynamic_cast<SPItem *>(o); + SPItem *item = static_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 831a8d030..ab863f8b1 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -230,8 +230,7 @@ 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++){ - SPObject *o = *x; - SPItem *item = dynamic_cast<SPItem *>(o); + SPItem *item = static_cast<SPItem*>(*x); if (item) { renderItem(item); } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 7a1d391a3..6ec4b969b 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -507,7 +507,7 @@ collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector<Geom::Path> &paths, if (SP_IS_GROUP(lpeitem)) { std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( std::vector<SPItem*>::const_iterator iter = item_list.begin(); iter != item_list.end(); iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; if (SP_IS_LPE_ITEM(subitem)) { collectPathsAndWidths(SP_LPE_ITEM(subitem), paths, stroke_widths); } diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 53ad96596..b128535bc 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -48,7 +48,7 @@ using Inkscape::DocumentUndo; inline bool less_than_items(SPItem const *first, SPItem const *second) { return sp_repr_compare_position(first->getRepr(), - second->getRepr())>0; + second->getRepr())<0; } void @@ -615,7 +615,7 @@ sp_selected_path_reverse(SPDesktop *desktop) for (std::vector<SPItem*>::const_iterator i = items.begin(); i != items.end(); i++){ - SPPath *path = dynamic_cast<SPPath *>(static_cast<SPObject *>(*i)); + SPPath *path = dynamic_cast<SPPath *>(*i); if (!path) { continue; } diff --git a/src/selcue.cpp b/src/selcue.cpp index 76eae3fa8..c73219b7d 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -203,7 +203,7 @@ void Inkscape::SelCue::_newTextBaselines() std::vector<SPItem*> ll = _selection->itemList(); for (std::vector<SPItem*>::const_iterator l=ll.begin();l!=ll.end();l++) { - SPItem *item = static_cast<SPItem *>(*l); + SPItem *item = *l; SPCanvasItem* baseline_point = NULL; if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index d6f8b8a37..0100e1040 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -555,7 +555,7 @@ void sp_edit_clear_all(Inkscape::Selection *selection) std::vector<SPItem*> items = sp_item_group_item_list(group); for(unsigned int i = 0; i < items.size(); i++){ - reinterpret_cast<SPObject*>(items[i])->deleteObject(); + items[i]->deleteObject(); } DocumentUndo::done(doc, SP_VERB_EDIT_CLEAR_ALL, @@ -627,7 +627,7 @@ static void sp_edit_select_all_full(SPDesktop *dt, bool force_all_layers, bool i std::vector<SPItem*> all_items = sp_item_group_item_list(dynamic_cast<SPGroup *>(dt->currentLayer())); for (std::vector<SPItem*>::const_reverse_iterator i=all_items.rbegin();i!=all_items.rend();i++) { - SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(*i)); + SPItem *item = *i; if (item && (!onlysensitive || !item->isLocked())) { if (!onlyvisible || !dt->itemIsHidden(item)) { @@ -683,8 +683,8 @@ static void sp_selection_group_impl(std::vector<Inkscape::XML::Node*> p, Inkscap sort(p.begin(),p.end(),sp_repr_compare_position); // Remember the position and parent of the topmost object. - gint topmost = (dynamic_cast<Inkscape::XML::Node *>(p.back()))->position(); - Inkscape::XML::Node *topmost_parent = (dynamic_cast<Inkscape::XML::Node *>(p.back()))->parent(); + gint topmost = p.back()->position(); + Inkscape::XML::Node *topmost_parent = p.back()->parent(); for(std::vector<Inkscape::XML::Node*>::const_iterator i = p.begin(); i != p.end(); i++){ Inkscape::XML::Node *current = *i; @@ -791,7 +791,7 @@ void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) std::vector<SPItem*> new_select; GSList *groups = NULL; for (std::vector<SPItem*>::const_iterator item = old_select.begin(); item!=old_select.end(); item++) { - SPItem *obj = static_cast<SPItem*>(*item); + SPItem *obj = *item; if (dynamic_cast<SPGroup *>(obj)) { groups = g_slist_prepend(groups, obj); } @@ -810,7 +810,7 @@ void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop) // in the items list. GSList *clones_to_unlink = NULL; for (std::vector<SPItem*>::const_iterator item = items.begin(); item != items.end(); item++) { - SPUse *use = dynamic_cast<SPUse *>(static_cast<SPItem *>(*item)); + SPUse *use = dynamic_cast<SPUse *>(*item); SPItem *original = use; while (dynamic_cast<SPUse *>(original)) { @@ -864,7 +864,7 @@ sp_degroup_list(std::vector<SPItem*> &items) std::vector<SPItem*> out; bool has_groups = false; for (std::vector<SPItem*>::const_iterator item=items.begin();item!=items.end();item++) { - SPGroup *group = dynamic_cast<SPGroup *>(static_cast<SPObject *>(*item)); + SPGroup *group = dynamic_cast<SPGroup *>(*item); if (!group) { out.push_back(*item); } else { @@ -915,7 +915,7 @@ enclose_items(std::vector<SPItem*> const &items) Geom::OptRect r; for (std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++) { - r.unionWith(static_cast<SPItem *>(*i)->desktopVisualBounds()); + r.unionWith((*i)->desktopVisualBounds()); } return r; } @@ -963,7 +963,7 @@ sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop) // Iterate over all objects in the selection (starting from top). if (selected) { for (std::vector<SPItem*>::const_iterator item=rev.begin();item!=rev.end();item++) { - SPObject *child = reinterpret_cast<SPObject*>(*item); + SPObject *child = *item; // for each selected object, find the next sibling for (SPObject *newref = child->next; newref; newref = newref->next) { // if the sibling is an item AND overlaps our selection, @@ -1042,7 +1042,7 @@ void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) // Iterate over all objects in the selection (starting from top). if (selected) { for (std::vector<SPItem*>::const_reverse_iterator item=rev.rbegin();item!=rev.rend();item++) { - SPObject *child = reinterpret_cast<SPObject*>(*item); + SPObject *child = *item; // for each selected object, find the prev sibling for (SPObject *newref = prev_sibling(child); newref; newref = prev_sibling(newref)) { // if the sibling is an item AND overlaps our selection, @@ -2053,7 +2053,7 @@ std::vector<SPItem*> sp_get_same_style(SPItem *sel, std::vector<SPItem*> &src, S } bool match_g; for (std::vector<SPItem*>::const_iterator i=src.begin();i!=src.end();i++) { - SPItem *iter = dynamic_cast<SPItem *>(static_cast<SPObject *>(*i)); + SPItem *iter = *i; if (iter) { match_g=true; SPStyle *iter_style = iter->style; @@ -2356,7 +2356,7 @@ SPItem *next_item_from_list(SPDesktop *desktop, std::vector<SPItem*> const items { SPObject *current=root; for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++) { - SPItem *item = dynamic_cast<SPItem *>(static_cast<SPObject *>(*i)); + SPItem *item = *i; if ( root->isAncestorOf(item) && ( !only_in_viewport || desktop->isWithinViewport(item) ) ) { @@ -2925,7 +2925,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) // Delete objects so that their clones don't get alerted; // the objects will be restored inside the marker element. for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPObject *item = reinterpret_cast<SPObject*>(*i); + SPObject *item = *i; item->deleteObject(false); } } @@ -3280,7 +3280,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) if (apply) { // delete objects so that their clones don't get alerted; this object will be restored shortly for (std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPObject *item = reinterpret_cast<SPObject*>(*i); + SPObject *item = *i; item->deleteObject(false); } } @@ -3354,7 +3354,7 @@ void sp_selection_untile(SPDesktop *desktop) std::vector<SPItem*> items(selection->itemList()); for (std::vector<SPItem*>::const_reverse_iterator i=items.rbegin();i!=items.rend();i++){ - SPItem *item = static_cast<SPItem *>(*i); + SPItem *item = *i; SPStyle *style = item->style; @@ -3864,7 +3864,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::XML::Node *dup = SP_OBJECT(*i)->getRepr()->duplicate(xml_doc); mask_items = g_slist_prepend(mask_items, dup); - SPObject *item = reinterpret_cast<SPObject*>(*i); + SPObject *item = *i; if (remove_original) { items_to_delete = g_slist_prepend(items_to_delete, item); } @@ -3878,7 +3878,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ mask_items = g_slist_prepend(mask_items, dup); if (remove_original) { - SPObject *item = reinterpret_cast<SPObject*>(items.front()); + SPObject *item = items.front(); items_to_delete = g_slist_prepend(items_to_delete, item); } @@ -4055,7 +4055,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { SP_OBJECT(*i)->getRepr()->setAttribute(attributeName, "none"); - SPGroup *group = dynamic_cast<SPGroup *>(static_cast<SPObject *>(*i)); + SPGroup *group = dynamic_cast<SPGroup *>(*i); if (ungroup_masked && group) { // if we had previously enclosed masked object in group, // add it to list so we can ungroup it later diff --git a/src/selection.cpp b/src/selection.cpp index 19e78512b..7e8190237 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -309,7 +309,7 @@ std::vector<XML::Node*> const &Selection::reprList() { if (!_reprs.empty()) { return _reprs; } std::vector<SPItem*> list = itemList(); for ( std::vector<SPItem*>::const_iterator iter=list.begin();iter!=list.end();iter++ ) { - SPObject *obj=reinterpret_cast<SPObject *>(*iter); + SPObject *obj = *iter; _reprs.push_back(obj->getRepr()); } return _reprs; diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 61d8a1ab1..bfb8d53f1 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -271,7 +271,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s std::vector<SPItem*> items=_desktop->selection->itemList(); for ( std::vector<SPItem*>::const_iterator iter=items.begin();iter!=items.end();iter++ ) { - SPItem *it = reinterpret_cast<SPItem*>(sp_object_ref(SP_ITEM(*iter), NULL)); + SPItem *it = static_cast<SPItem*>(sp_object_ref(*iter, NULL)); _items.push_back(it); _items_const.push_back(it); _items_affines.push_back(it->i2dt_affine()); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 620c0b70f..64ad9ff43 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -818,7 +818,7 @@ void SPGroup::update_patheffect(bool write) { std::vector<SPItem*> const item_list = sp_item_group_item_list(this); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; SPLPEItem *lpeItem = dynamic_cast<SPLPEItem *>(subitem); if (lpeItem) { @@ -846,7 +846,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) std::vector<SPItem*> const item_list = sp_item_group_item_list(group); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; SPGroup *subGroup = dynamic_cast<SPGroup *>(subitem); if (subGroup) { diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 1f4704e22..6228f3692 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -355,7 +355,7 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) if (SP_IS_GROUP(lpeitem)) { std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; if (SP_IS_LPE_ITEM(subitem)) { sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(subitem)); } @@ -389,7 +389,7 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) } std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; if (SP_IS_LPE_ITEM(subitem)) { sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(subitem)); } @@ -682,7 +682,7 @@ SPLPEItem::apply_to_clippath(SPItem *item) if(SP_IS_GROUP(item)){ std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(item)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; apply_to_clippath(SP_ITEM(subitem)); } } @@ -734,7 +734,7 @@ SPLPEItem::apply_to_mask(SPItem *item) if(SP_IS_GROUP(item)){ std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(item)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; apply_to_mask(SP_ITEM(subitem)); } } @@ -748,7 +748,7 @@ SPLPEItem::apply_to_clip_or_mask_group(SPItem *group, SPItem *item) } std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(group)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { - SPObject *subitem = static_cast<SPObject *>(*iter); + SPObject *subitem = *iter; if (SP_IS_GROUP(subitem)) { apply_to_clip_or_mask_group(SP_ITEM(subitem), item); } else if (SP_IS_SHAPE(subitem)) { diff --git a/src/splivarot.cpp b/src/splivarot.cpp index bc09802f0..c668199c0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -667,7 +667,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool { // only one command, presumably a moveto: it isn't a path for (std::vector<SPItem*>::const_iterator l = il.begin(); l != il.end(); l++){ - SP_OBJECT(*l)->deleteObject(); + (*l)->deleteObject(); } DocumentUndo::done(doc, SP_VERB_NONE, description); selection->clear(); @@ -680,9 +680,9 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool SPObject *source; if ( bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { if (reverseOrderForOp) { - source = SP_OBJECT(il[0]); + source = il[0]; } else { - source = SP_OBJECT(il.back()); + source = il.back(); } } else { // find out the bottom object @@ -719,10 +719,10 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // if this is the bottommost object, if (!strcmp(reinterpret_cast<SPObject *>(*l)->getRepr()->attribute("id"), id)) { // delete it so that its clones don't get alerted; this object will be restored shortly, with the same id - SP_OBJECT(*l)->deleteObject(false); + (*l)->deleteObject(false); } else { // delete the object for real, so that its clones can take appropriate action - SP_OBJECT(*l)->deleteObject(); + (*l)->deleteObject(); } } diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index eadab90dd..5d57ac020 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -198,7 +198,7 @@ text_remove_from_path() bool did = false; std::vector<SPItem*> items(selection->itemList()); for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPObject *obj = SP_OBJECT(*i); + SPObject *obj = *i; if (SP_IS_TEXT_TEXTPATH(obj)) { SPObject *tp = obj->firstChild(); @@ -262,7 +262,7 @@ text_remove_all_kerns() std::vector<SPItem*> items = selection->itemList(); for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPObject *obj = SP_OBJECT(*i); + SPObject *obj = *i; if (!SP_IS_TEXT(obj) && !SP_IS_TSPAN(obj) && !SP_IS_FLOWTEXT(obj)) { continue; @@ -322,7 +322,7 @@ text_flow_into_shape() /* Add clones */ std::vector<SPItem*> items = selection->itemList(); for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPItem *item = SP_ITEM(*i); + SPItem *item = *i; if (SP_IS_SHAPE(item)){ Inkscape::XML::Node *clone = xml_doc->createElement("svg:use"); clone->setAttribute("x", "0"); @@ -398,7 +398,7 @@ text_unflow () std::vector<SPItem*> items = selection->itemList(); for(std::vector<SPItem*>::const_reverse_iterator i=items.rbegin();i!=items.rend();i++){ - if (!SP_IS_FLOWTEXT(SP_OBJECT(*i))) { + if (!SP_IS_FLOWTEXT(*i)) { continue; } diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index a38a52371..3fe935e7d 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -706,7 +706,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) // copy style for Paste Style action if (!sorted_items.empty()) { - SPObject *object = static_cast<SPObject *>(sorted_items[0]); + SPObject *object = sorted_items[0]; SPItem *item = dynamic_cast<SPItem *>(object); if (item) { SPCSSAttr *style = take_style_from_item(item); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 45c8ce68a..cb2771503 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1467,7 +1467,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) std::set<SPObject*> used; std::vector<SPItem*> itemlist=sel->itemList(); for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPStyle *style = obj->style; if (!style || !SP_IS_ITEM(obj)) { continue; diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index dde040036..173acca93 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -562,7 +562,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b if (check_searchin_text.get_active()) { for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_text_match(item, text, exact, casematch)) { @@ -585,7 +585,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b if (ids) { for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); if (item_id_match(item, text, exact, casematch)) { if (out.end()==find(out.begin(),out.end(), *i)) { @@ -601,7 +601,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b if (style) { for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_style_match(item, text, exact, casematch)) { @@ -618,7 +618,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b if (attrname) { for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_attr_match(item, text, exact, casematch)) { @@ -635,7 +635,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b if (attrvalue) { for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_attrvalue_match(item, text, exact, casematch)) { @@ -652,7 +652,7 @@ std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, b if (font) { for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_font_match(item, text, exact, casematch)) { @@ -719,7 +719,7 @@ std::vector<SPItem*> Find::filter_types (std::vector<SPItem*> &l) { std::vector<SPItem*> n; for(std::vector<SPItem*>::const_reverse_iterator i=l.rbegin(); l.rend() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_type_match(item)) { @@ -763,7 +763,7 @@ std::vector<SPItem*> &Find::all_selection_items (Inkscape::Selection *s, std::ve { std::vector<SPItem*> itemlist=s->itemList(); for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) { - SPObject *obj = SP_OBJECT (*i); + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item && !item->cloned && !desktop->isLayer(item)) { @@ -857,7 +857,7 @@ void Find::onAction() Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); selection->setList(n); - SPObject *obj = reinterpret_cast<SPObject *>(n[0]); + SPObject *obj = n[0]; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); scroll_to_show_item(desktop, item); diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 8bd130c2e..4465d73a9 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -210,7 +210,7 @@ void GridArrangeTab::arrange() cnt=0; const std::vector<SPItem*> sizes(sorted); for (std::vector<SPItem*>::const_iterator i = sizes.begin();i!=sizes.end();i++) { - SPItem *item = SP_ITEM(*i); + SPItem *item = *i; Geom::OptRect b = item->documentVisualBounds(); if (b) { width = b->dimensions()[Geom::X]; diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index 5fab9fcfc..ed71c826f 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -652,7 +652,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) bool wasadded = false; std::vector<SPItem*> items=_desktop->selection->itemList(); for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPObject *newobj = reinterpret_cast<SPObject *>(*i); + SPObject *newobj = *i; bool addchild = true; for ( SPObject *child = obj->children; child != NULL; child = child->next) { if (SP_IS_TAG_USE(child) && SP_TAG_USE(child)->ref->getObject() == newobj) { diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 9c4790379..815aa12ef 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -549,7 +549,7 @@ void TextEdit::onApply() if (SP_IS_TEXT (*i)) { // backwards compatibility: - reinterpret_cast<SPObject*>(*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); + (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); ++items; } diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 21ad18c26..a9e109b5c 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -934,7 +934,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta sp_item_gradient_set_coords (*i, POINT_RG_CENTER, 0, rc.origin, fill_or_stroke, true, false); sp_item_gradient_set_coords (*i, POINT_RG_R1, 0, pt, fill_or_stroke, true, false); } - SP_OBJECT(*i)->requestModified(SP_OBJECT_MODIFIED_FLAG); + (*i)->requestModified(SP_OBJECT_MODIFIED_FLAG); } if (ec->_grdrag) { ec->_grdrag->updateDraggers(); diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index c8e032089..2c817694e 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -965,13 +965,13 @@ static void sp_mesh_drag(MeshTool &rc, Geom::Point const /*pt*/, guint /*state*/ for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above - sp_repr_css_change_recursive(SP_OBJECT(*i)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); - sp_item_set_gradient(SP_ITEM(*i), vector, (SPGradientType) type, fill_or_stroke); + sp_item_set_gradient(*i, vector, (SPGradientType) type, fill_or_stroke); // We don't need to do anything. Mesh is already sized appropriately. - SP_OBJECT(*i)->requestModified(SP_OBJECT_MODIFIED_FLAG); + (*i)->requestModified(SP_OBJECT_MODIFIED_FLAG); } // if (ec->_grdrag) { // ec->_grdrag->updateDraggers(); diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 6ddb379cc..374386686 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -422,7 +422,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { std::vector<SPItem*> items=sel->itemList(); for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - SPObject *obj = static_cast<SPObject*>(*i); + SPObject *obj = *i; if (SP_IS_ITEM(obj)) { gather_items(this, NULL, static_cast<SPItem*>(obj), SHAPE_ROLE_NORMAL, shapes); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 1ded546dd..95b89bf5f 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -114,7 +114,7 @@ void StyleSubject::CurrentLayer::_setLayer(SPObject *layer) { _layer_release.disconnect(); _layer_modified.disconnect(); if (_element) { - sp_object_unref(static_cast<SPObject *>(_element), NULL); + sp_object_unref(_element, NULL); } _element = layer; if (layer) { @@ -126,7 +126,7 @@ void StyleSubject::CurrentLayer::_setLayer(SPObject *layer) { } SPObject *StyleSubject::CurrentLayer::_getLayer() const { - return static_cast<SPObject *>(_element); + return _element; } SPObject *StyleSubject::CurrentLayer::_getLayerSList() const { diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 7d5a89cf5..1d258bbb0 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -579,7 +579,7 @@ void FillNStroke::updateFromPaint() for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(*i)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); } if (!vector) { @@ -605,7 +605,7 @@ void FillNStroke::updateFromPaint() for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ //FIXME: see above if (kind == FILL) { - sp_repr_css_change_recursive(reinterpret_cast<SPObject*>(*i)->getRepr(), css, "style"); + sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); } SPGradient *gr = sp_item_set_gradient(*i, vector, gradient_type, (kind == FILL) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE); @@ -649,11 +649,11 @@ void FillNStroke::updateFromPaint() // objects who already have the same root pattern but through a different href // chain. FIXME: move this to a sp_item_set_pattern for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ - Inkscape::XML::Node *selrepr = reinterpret_cast<SPObject*>(*i)->getRepr(); + Inkscape::XML::Node *selrepr = (*i)->getRepr(); if ( (kind == STROKE) && !selrepr) { continue; } - SPObject *selobj = reinterpret_cast<SPObject*>(*i); + SPObject *selobj = *i; SPStyle *style = selobj->style; if (style && ((kind == FILL) ? style->fill : style->stroke).isPaintserver()) { diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 2b07dd3b9..37ffd7553 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -112,7 +112,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * if (gtk_adjustment_get_value(adj) != 0) { (SP_RECT(*i)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, desktop->getNamedView()->svg_units)); } else { - SP_OBJECT(*i)->getRepr()->setAttribute(value_name, NULL); + (*i)->getRepr()->setAttribute(value_name, NULL); } modmade = true; } diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index c05ef93e7..481fa0609 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -983,7 +983,7 @@ StrokeStyle::scaleLine() if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { width = Inkscape::Util::Quantity::convert(width_typed, unit, "px"); } else { // percentage - gdouble old_w = SP_OBJECT(*i)->style->stroke_width.computed; + gdouble old_w = (*i)->style->stroke_width.computed; width = old_w * width_typed / 100; } @@ -1167,7 +1167,7 @@ StrokeStyle::updateAllMarkers(std::vector<SPItem*> const &objects) // We show markers of the first object in the list only // FIXME: use the first in the list that has the marker of each type, if any - SPObject *object = SP_OBJECT(objects[0]); + SPObject *object = objects[0]; for (unsigned i = 0; i < G_N_ELEMENTS(keyloc); ++i) { // For all three marker types, diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 6b0fb34e6..2160cad2e 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -522,7 +522,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) std::vector<SPItem*> itemlist=selection->itemList(); for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){ if (SP_IS_TEXT (*i)) { - SP_OBJECT(*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); + (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); modmade = true; } } |
