diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2014-10-16 22:42:34 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2014-10-16 22:42:34 +0000 |
| commit | 197f66062c6d6cc77539117526a9ecc30449bd61 (patch) | |
| tree | 14cd21f8af2a7b26dc443cd018272d72b8762b69 /src | |
| parent | Cleanup of unintialized and leaked values. (diff) | |
| download | inkscape-197f66062c6d6cc77539117526a9ecc30449bd61.tar.gz inkscape-197f66062c6d6cc77539117526a9ecc30449bd61.zip | |
Removed dangerous GTK-mimicking macros.
(bzr r13619)
Diffstat (limited to 'src')
| -rw-r--r-- | src/box3d-side.h | 4 | ||||
| -rw-r--r-- | src/box3d.cpp | 23 | ||||
| -rw-r--r-- | src/desktop-style.cpp | 6 |
3 files changed, 18 insertions, 15 deletions
diff --git a/src/box3d-side.h b/src/box3d-side.h index 04bd196c2..519ed495e 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -7,6 +7,7 @@ * Authors: * Maximilian Albert <Anhalter42@gmx.de> * Abhishek Sharma + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2007 Authors * @@ -17,9 +18,6 @@ #include "axis-manip.h" -#define SP_BOX3D_SIDE(obj) (dynamic_cast<Box3DSide*>((SPObject*)obj)) -#define SP_IS_BOX3D_SIDE(obj) (dynamic_cast<const Box3DSide*>((SPObject*)obj) != NULL) - class SPBox3D; class Persp3D; diff --git a/src/box3d.cpp b/src/box3d.cpp index eb82524dd..5f60766f4 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -6,6 +6,7 @@ * Lauris Kaplinski <lauris@kaplinski.com> * bulia byak <buliabyak@users.sf.net> * Abhishek Sharma + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2007 Authors * Copyright (C) 1999-2002 Lauris Kaplinski @@ -263,9 +264,10 @@ void box3d_position_set(SPBox3D *box) { /* This draws the curve and calls requestDisplayUpdate() for each side (the latter is done in box3d_side_position_set() to avoid update conflicts with the parent box) */ - for ( SPObject *child = box->firstChild(); child; child = child->getNext() ) { - if (SP_IS_BOX3D_SIDE(child)) { - box3d_side_position_set(SP_BOX3D_SIDE(child)); + for ( SPObject *obj = box->firstChild(); obj; obj = obj->getNext() ) { + Box3DSide *side = dynamic_cast<Box3DSide *>(obj); + if (side) { + box3d_side_position_set(side); } } } @@ -1079,10 +1081,10 @@ box3d_recompute_z_orders (SPBox3D *box) { static std::map<int, Box3DSide *> box3d_get_sides(SPBox3D *box) { std::map<int, Box3DSide *> sides; - for ( SPObject *side = box->firstChild(); side; side = side->getNext() ) { - if (SP_IS_BOX3D_SIDE(side)){ - Box3DSide *bside = SP_BOX3D_SIDE(side); - sides[Box3D::face_to_int(bside->getFaceId())] = bside; + for ( SPObject *obj = box->firstChild(); obj; obj = obj->getNext() ) { + Box3DSide *side = dynamic_cast<Box3DSide *>(obj); + if (side) { + sides[Box3D::face_to_int(side->getFaceId())] = side; } } sides.erase(-1); @@ -1280,9 +1282,10 @@ SPGroup *box3d_convert_to_group(SPBox3D *box) // create a new group and add the sides (converted to ordinary paths) as its children Inkscape::XML::Node *grepr = xml_doc->createElement("svg:g"); - for ( SPObject *child = box->firstChild(); child; child = child->getNext() ) { - if (SP_IS_BOX3D_SIDE(child)) { - Inkscape::XML::Node *repr = box3d_side_convert_to_path(SP_BOX3D_SIDE(child)); + for ( SPObject *obj = box->firstChild(); obj; obj = obj->getNext() ) { + Box3DSide *side = dynamic_cast<Box3DSide *>(obj); + if (side) { + Inkscape::XML::Node *repr = box3d_side_convert_to_path(side); grepr->appendChild(repr); } else { g_warning("Non-side item encountered as child of a 3D box."); diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 0b2e15d34..c2aa769f6 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -173,8 +173,10 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write for (const GSList *i = desktop->selection->itemList(); i != NULL; i = i->next) { /* last used styles for 3D box faces are stored separately */ - if (SP_IS_BOX3D_SIDE (i->data)) { - const char * descr = box3d_side_axes_string(SP_BOX3D_SIDE(i->data)); + SPObject *obj = reinterpret_cast<SPObject *>(i->data); // TODO unsafe until Selection is refactored. + Box3DSide *side = dynamic_cast<Box3DSide *>(obj); + if (side) { + const char * descr = box3d_side_axes_string(side); if (descr != NULL) { prefs->mergeStyle(Glib::ustring("/desktop/") + descr + "/style", css_write); } |
