diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-09-15 00:43:49 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-09-15 00:43:49 +0000 |
| commit | 5cf6efefbfd06d723973b6517b442f0ee64416b7 (patch) | |
| tree | da00f2c24881267859ab46843398cb10d8fe2ff2 /src | |
| parent | Modified SP_IS_ macros. (diff) | |
| download | inkscape-5cf6efefbfd06d723973b6517b442f0ee64416b7.tar.gz inkscape-5cf6efefbfd06d723973b6517b442f0ee64416b7.zip | |
Added runtime check in SP_-cast macros.
(bzr r11608.1.123)
Diffstat (limited to 'src')
100 files changed, 109 insertions, 109 deletions
diff --git a/src/arc-context.h b/src/arc-context.h index ec2dbb2bb..56eb02943 100644 --- a/src/arc-context.h +++ b/src/arc-context.h @@ -23,7 +23,7 @@ #include "sp-ellipse.h" -#define SP_ARC_CONTEXT(obj) ((SPArcContext*)obj) +#define SP_ARC_CONTEXT(obj) (dynamic_cast<SPArcContext*>((SPEventContext*)obj)) #define SP_IS_ARC_CONTEXT(obj) (dynamic_cast<const SPArcContext*>(const SPEventContext*(obj)) != NULL) class SPArcContext : public SPEventContext { diff --git a/src/box3d-context.h b/src/box3d-context.h index 308acba3d..044d79d7d 100644 --- a/src/box3d-context.h +++ b/src/box3d-context.h @@ -23,7 +23,7 @@ #include "box3d.h" -#define SP_BOX3D_CONTEXT(obj) ((Box3DContext*)obj) +#define SP_BOX3D_CONTEXT(obj) (dynamic_cast<Box3DContext*>((SPEventContext*)obj)) #define SP_IS_BOX3D_CONTEXT(obj) (dynamic_cast<const Box3DContext*>((const SPEventContext*)obj) != NULL) class Box3DContext : public SPEventContext { diff --git a/src/box3d-side.h b/src/box3d-side.h index 7306a1b44..04bd196c2 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -17,7 +17,7 @@ #include "axis-manip.h" -#define SP_BOX3D_SIDE(obj) ((Box3DSide*)obj) +#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; diff --git a/src/box3d.h b/src/box3d.h index 6df746c73..18d99d60a 100644 --- a/src/box3d.h +++ b/src/box3d.h @@ -21,7 +21,7 @@ #include "axis-manip.h" #define SP_TYPE_BOX3D (box3d_get_type ()) -#define SP_BOX3D(obj) ((SPBox3D*)obj) +#define SP_BOX3D(obj) (dynamic_cast<SPBox3D*>((SPObject*)obj)) #define SP_IS_BOX3D(obj) (dynamic_cast<const SPBox3D*>((SPObject*)obj) != NULL) class Persp3D; diff --git a/src/connector-context.h b/src/connector-context.h index 9b76fa5cd..1c4bfc34d 100644 --- a/src/connector-context.h +++ b/src/connector-context.h @@ -20,7 +20,7 @@ #include "libavoid/connector.h" #include <glibmm/i18n.h> -#define SP_CONNECTOR_CONTEXT(obj) ((SPConnectorContext*)obj) +#define SP_CONNECTOR_CONTEXT(obj) (dynamic_cast<SPConnectorContext*>((SPEventContext*)obj)) //#define SP_IS_CONNECTOR_CONTEXT(obj) (dynamic_cast<const SPConnectorContext*>((const SPEventContext*)obj) != NULL) struct SPKnot; diff --git a/src/draw-context.h b/src/draw-context.h index a9ad5c118..534c706d6 100644 --- a/src/draw-context.h +++ b/src/draw-context.h @@ -22,7 +22,7 @@ /* Freehand context */ -#define SP_DRAW_CONTEXT(obj) ((SPDrawContext*)obj) +#define SP_DRAW_CONTEXT(obj) (dynamic_cast<SPDrawContext*>((SPEventContext*)obj)) #define SP_IS_DRAW_CONTEXT(obj) (dynamic_cast<const SPDrawContext*>((const SPEventContext*)obj) != NULL) struct SPDrawAnchor; diff --git a/src/dropper-context.h b/src/dropper-context.h index 9c727902a..6e1015644 100644 --- a/src/dropper-context.h +++ b/src/dropper-context.h @@ -14,7 +14,7 @@ #include "event-context.h" -#define SP_DROPPER_CONTEXT(obj) ((SPDropperContext*)obj) +#define SP_DROPPER_CONTEXT(obj) (dynamic_cast<SPDropperContext*>((SPEventContext*)obj)) #define SP_IS_DROPPER_CONTEXT(obj) (dynamic_cast<const SPDropperContext*>((const SPEventContext*)obj) != NULL) enum { diff --git a/src/event-context.h b/src/event-context.h index 951d97160..33bab5e3e 100644 --- a/src/event-context.h +++ b/src/event-context.h @@ -33,7 +33,7 @@ namespace Inkscape { } } -#define SP_EVENT_CONTEXT(obj) ((SPEventContext*)obj) +#define SP_EVENT_CONTEXT(obj) (dynamic_cast<SPEventContext*>((SPEventContext*)obj)) #define SP_IS_EVENT_CONTEXT(obj) (dynamic_cast<const SPEventContext*>((const SPEventContext*)obj) != NULL) gboolean sp_event_context_snap_watchdog_callback(gpointer data); diff --git a/src/filters/blend.h b/src/filters/blend.h index 779eed3e0..d5af9fe7d 100644 --- a/src/filters/blend.h +++ b/src/filters/blend.h @@ -16,7 +16,7 @@ #include "sp-filter-primitive.h" #include "display/nr-filter-blend.h" -#define SP_FEBLEND(obj) ((SPFeBlend*)obj) +#define SP_FEBLEND(obj) (dynamic_cast<SPFeBlend*>((SPObject*)obj)) #define SP_IS_FEBLEND(obj) (dynamic_cast<const SPFeBlend*>((SPObject*)obj) != NULL) class SPFeBlend : public SPFilterPrimitive { diff --git a/src/filters/colormatrix.h b/src/filters/colormatrix.h index e109bbcdd..2a1c403f1 100644 --- a/src/filters/colormatrix.h +++ b/src/filters/colormatrix.h @@ -15,7 +15,7 @@ #include "sp-filter-primitive.h" #include "display/nr-filter-colormatrix.h" -#define SP_FECOLORMATRIX(obj) ((SPFeColorMatrix*)obj) +#define SP_FECOLORMATRIX(obj) (dynamic_cast<SPFeColorMatrix*>((SPObject*)obj)) #define SP_IS_FECOLORMATRIX(obj) (dynamic_cast<const SPFeColorMatrix*>((SPObject*)obj) != NULL) class SPFeColorMatrix : public SPFilterPrimitive { diff --git a/src/filters/componenttransfer-funcnode.h b/src/filters/componenttransfer-funcnode.h index 10eead379..a5f813e1e 100644 --- a/src/filters/componenttransfer-funcnode.h +++ b/src/filters/componenttransfer-funcnode.h @@ -29,7 +29,7 @@ //#define SP_IS_FEFUNCB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_FEFUNCB)) //#define SP_IS_FEFUNCA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_FEFUNCA)) -#define SP_FEFUNCNODE(obj) ((SPFeFuncNode*)obj) +#define SP_FEFUNCNODE(obj) (dynamic_cast<SPFeFuncNode*>((SPObject*)obj)) //#define SP_IS_FEFUNCR(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode))) //#define SP_IS_FEFUNCG(obj) (obj != NULL && static_cast<const SPObject*>(obj)->typeHierarchy.count(typeid(SPFeFuncNode))) diff --git a/src/filters/componenttransfer.h b/src/filters/componenttransfer.h index 14149171c..8dbe91db1 100644 --- a/src/filters/componenttransfer.h +++ b/src/filters/componenttransfer.h @@ -13,7 +13,7 @@ #include "sp-filter-primitive.h" -#define SP_FECOMPONENTTRANSFER(obj) ((SPFeComponentTransfer*)obj) +#define SP_FECOMPONENTTRANSFER(obj) (dynamic_cast<SPFeComponentTransfer*>((SPObject*)obj)) #define SP_IS_FECOMPONENTTRANSFER(obj) (dynamic_cast<const SPFeComponentTransfer*>((SPObject*)obj) != NULL) namespace Inkscape { diff --git a/src/filters/composite.h b/src/filters/composite.h index b3500ecaf..b8c0178d1 100644 --- a/src/filters/composite.h +++ b/src/filters/composite.h @@ -13,7 +13,7 @@ #include "sp-filter-primitive.h" -#define SP_FECOMPOSITE(obj) ((SPFeComposite*)obj) +#define SP_FECOMPOSITE(obj) (dynamic_cast<SPFeComposite*>((SPObject*)obj)) #define SP_IS_FECOMPOSITE(obj) (dynamic_cast<const SPFeComposite*>((SPObject*)obj) != NULL) enum FeCompositeOperator { diff --git a/src/filters/convolvematrix.h b/src/filters/convolvematrix.h index 6cbd63998..9783eaa47 100644 --- a/src/filters/convolvematrix.h +++ b/src/filters/convolvematrix.h @@ -18,7 +18,7 @@ #include "number-opt-number.h" #include "display/nr-filter-convolve-matrix.h" -#define SP_FECONVOLVEMATRIX(obj) ((SPFeConvolveMatrix*)obj) +#define SP_FECONVOLVEMATRIX(obj) (dynamic_cast<SPFeConvolveMatrix*>((SPObject*)obj)) #define SP_IS_FECONVOLVEMATRIX(obj) (dynamic_cast<const SPFeConvolveMatrix*>((SPObject*)obj) != NULL) class SPFeConvolveMatrix : public SPFilterPrimitive { diff --git a/src/filters/diffuselighting.h b/src/filters/diffuselighting.h index 701128158..f41c6c056 100644 --- a/src/filters/diffuselighting.h +++ b/src/filters/diffuselighting.h @@ -15,7 +15,7 @@ #include "sp-filter-primitive.h" #include "number-opt-number.h" -#define SP_FEDIFFUSELIGHTING(obj) ((SPFeDiffuseLighting*)obj) +#define SP_FEDIFFUSELIGHTING(obj) (dynamic_cast<SPFeDiffuseLighting*>((SPObject*)obj)) #define SP_IS_FEDIFFUSELIGHTING(obj) (dynamic_cast<const SPFeDiffuseLighting*>((SPObject*)obj) != NULL) struct SVGICCColor; diff --git a/src/filters/displacementmap.h b/src/filters/displacementmap.h index 66b0c8afc..85a6beaaa 100644 --- a/src/filters/displacementmap.h +++ b/src/filters/displacementmap.h @@ -14,7 +14,7 @@ #include "sp-filter-primitive.h" -#define SP_FEDISPLACEMENTMAP(obj) ((SPFeDisplacementMap*)obj) +#define SP_FEDISPLACEMENTMAP(obj) (dynamic_cast<SPFeDisplacementMap*>((SPObject*)obj)) #define SP_IS_FEDISPLACEMENTMAP(obj) (dynamic_cast<const SPFeDisplacementMap*>((SPObject*)obj) != NULL) enum FilterDisplacementMapChannelSelector { diff --git a/src/filters/distantlight.h b/src/filters/distantlight.h index bab49726e..0eebf768f 100644 --- a/src/filters/distantlight.h +++ b/src/filters/distantlight.h @@ -17,7 +17,7 @@ #include "sp-object.h" -#define SP_FEDISTANTLIGHT(obj) ((SPFeDistantLight*)obj) +#define SP_FEDISTANTLIGHT(obj) (dynamic_cast<SPFeDistantLight*>((SPObject*)obj)) #define SP_IS_FEDISTANTLIGHT(obj) (dynamic_cast<const SPFeDistantLight*>((SPObject*)obj) != NULL) /* Distant light class */ diff --git a/src/filters/flood.h b/src/filters/flood.h index d052dd8ff..75e332b73 100644 --- a/src/filters/flood.h +++ b/src/filters/flood.h @@ -15,7 +15,7 @@ #include "sp-filter-primitive.h" #include "svg/svg-icc-color.h" -#define SP_FEFLOOD(obj) ((SPFeFlood*)obj) +#define SP_FEFLOOD(obj) (dynamic_cast<SPFeFlood*>((SPObject*)obj)) #define SP_IS_FEFLOOD(obj) (dynamic_cast<const SPFeFlood*>((SPObject*)obj) != NULL) class SPFeFlood : public SPFilterPrimitive { diff --git a/src/filters/gaussian-blur.h b/src/filters/gaussian-blur.h index 7aa293b93..00de8a95f 100644 --- a/src/filters/gaussian-blur.h +++ b/src/filters/gaussian-blur.h @@ -15,7 +15,7 @@ #include "sp-filter-primitive.h" #include "number-opt-number.h" -#define SP_GAUSSIANBLUR(obj) ((SPGaussianBlur*)obj) +#define SP_GAUSSIANBLUR(obj) (dynamic_cast<SPGaussianBlur*>((SPObject*)obj)) #define SP_IS_GAUSSIANBLUR(obj) (dynamic_cast<const SPGaussianBlur*>((SPObject*)obj) != NULL) class SPGaussianBlur : public SPFilterPrimitive { diff --git a/src/filters/image.h b/src/filters/image.h index 055e4e31a..452e08134 100644 --- a/src/filters/image.h +++ b/src/filters/image.h @@ -18,7 +18,7 @@ #include "sp-item.h" #include "uri-references.h" -#define SP_FEIMAGE(obj) ((SPFeImage*)obj) +#define SP_FEIMAGE(obj) (dynamic_cast<SPFeImage*>((SPObject*)obj)) #define SP_IS_FEIMAGE(obj) (dynamic_cast<const SPFeImage*>((SPObject*)obj) != NULL) class SPFeImage : public SPFilterPrimitive { diff --git a/src/filters/merge.h b/src/filters/merge.h index 55f0b0be7..68257c38e 100644 --- a/src/filters/merge.h +++ b/src/filters/merge.h @@ -12,7 +12,7 @@ #include "sp-filter-primitive.h" -#define SP_FEMERGE(obj) ((SPFeMerge*)obj) +#define SP_FEMERGE(obj) (dynamic_cast<SPFeMerge*>((SPObject*)obj)) #define SP_IS_FEMERGE(obj) (dynamic_cast<const SPFeMerge*>((SPObject*)obj) != NULL) class SPFeMerge : public SPFilterPrimitive { diff --git a/src/filters/mergenode.h b/src/filters/mergenode.h index 3fd5e890b..408b3bbb8 100644 --- a/src/filters/mergenode.h +++ b/src/filters/mergenode.h @@ -17,7 +17,7 @@ #include "sp-object.h" -#define SP_FEMERGENODE(obj) ((SPFeMergeNode*)obj) +#define SP_FEMERGENODE(obj) (dynamic_cast<SPFeMergeNode*>((SPObject*)obj)) #define SP_IS_FEMERGENODE(obj) (dynamic_cast<const SPFeMergeNode*>((SPObject*)obj) != NULL) class SPFeMergeNode : public SPObject { diff --git a/src/filters/morphology.h b/src/filters/morphology.h index ebcdfc28f..f84a7271e 100644 --- a/src/filters/morphology.h +++ b/src/filters/morphology.h @@ -16,7 +16,7 @@ #include "number-opt-number.h" #include "display/nr-filter-morphology.h" -#define SP_FEMORPHOLOGY(obj) ((SPFeMorphology*)obj) +#define SP_FEMORPHOLOGY(obj) (dynamic_cast<SPFeMorphology*>((SPObject*)obj)) #define SP_IS_FEMORPHOLOGY(obj) (dynamic_cast<const SPFeMorphology*>((SPObject*)obj) != NULL) class SPFeMorphology : public SPFilterPrimitive { diff --git a/src/filters/offset.h b/src/filters/offset.h index 43407c3a9..0d26f6f90 100644 --- a/src/filters/offset.h +++ b/src/filters/offset.h @@ -14,7 +14,7 @@ #include "sp-filter-primitive.h" -#define SP_FEOFFSET(obj) ((SPFeOffset*)obj) +#define SP_FEOFFSET(obj) (dynamic_cast<SPFeOffset*>((SPObject*)obj)) #define SP_IS_FEOFFSET(obj) (dynamic_cast<const SPFeOffset*>((SPObject*)obj) != NULL) class SPFeOffset : public SPFilterPrimitive { diff --git a/src/filters/pointlight.h b/src/filters/pointlight.h index 2d092bd1c..3819d8ff5 100644 --- a/src/filters/pointlight.h +++ b/src/filters/pointlight.h @@ -17,7 +17,7 @@ #include "sp-object.h" -#define SP_FEPOINTLIGHT(obj) ((SPFePointLight*)obj) +#define SP_FEPOINTLIGHT(obj) (dynamic_cast<SPFePointLight*>((SPObject*)obj)) #define SP_IS_FEPOINTLIGHT(obj) (dynamic_cast<const SPFePointLight*>((SPObject*)obj) != NULL) class SPFePointLight : public SPObject { diff --git a/src/filters/specularlighting.h b/src/filters/specularlighting.h index f99dbd9ce..1de32ec58 100644 --- a/src/filters/specularlighting.h +++ b/src/filters/specularlighting.h @@ -17,7 +17,7 @@ #include "sp-filter-primitive.h" #include "number-opt-number.h" -#define SP_FESPECULARLIGHTING(obj) ((SPFeSpecularLighting*)obj) +#define SP_FESPECULARLIGHTING(obj) (dynamic_cast<SPFeSpecularLighting*>((SPObject*)obj)) #define SP_IS_FESPECULARLIGHTING(obj) (dynamic_cast<const SPFeSpecularLighting*>((SPObject*)obj) != NULL) struct SVGICCColor; diff --git a/src/filters/spotlight.h b/src/filters/spotlight.h index 55717ac5d..8caf12858 100644 --- a/src/filters/spotlight.h +++ b/src/filters/spotlight.h @@ -17,7 +17,7 @@ #include "sp-object.h" -#define SP_FESPOTLIGHT(obj) ((SPFeSpotLight*)obj) +#define SP_FESPOTLIGHT(obj) (dynamic_cast<SPFeSpotLight*>((SPObject*)obj)) #define SP_IS_FESPOTLIGHT(obj) (dynamic_cast<const SPFeSpotLight*>((SPObject*)obj) != NULL) class SPFeSpotLight : public SPObject { diff --git a/src/filters/tile.h b/src/filters/tile.h index 9b2199adc..cc1a006dd 100644 --- a/src/filters/tile.h +++ b/src/filters/tile.h @@ -14,7 +14,7 @@ #include "sp-filter-primitive.h" -#define SP_FETILE(obj) ((SPFeTile*)obj) +#define SP_FETILE(obj) (dynamic_cast<SPFeTile*>((SPObject*)obj)) #define SP_IS_FETILE(obj) (dynamic_cast<const SPFeTile*>((SPObject*)obj) != NULL) /* FeTile base class */ diff --git a/src/filters/turbulence.h b/src/filters/turbulence.h index d0bb6f878..89e6d4a19 100644 --- a/src/filters/turbulence.h +++ b/src/filters/turbulence.h @@ -17,7 +17,7 @@ #include "number-opt-number.h" #include "display/nr-filter-turbulence.h" -#define SP_FETURBULENCE(obj) ((SPFeTurbulence*)obj) +#define SP_FETURBULENCE(obj) (dynamic_cast<SPFeTurbulence*>((SPObject*)obj)) #define SP_IS_FETURBULENCE(obj) (dynamic_cast<const SPFeTurbulence*>((SPObject*)obj) != NULL) /* FeTurbulence base class */ diff --git a/src/flood-context.h b/src/flood-context.h index 26fc03a3f..48bf36f85 100644 --- a/src/flood-context.h +++ b/src/flood-context.h @@ -16,7 +16,7 @@ #include <gtk/gtk.h> #include "event-context.h" -#define SP_FLOOD_CONTEXT(obj) ((SPFloodContext*)obj) +#define SP_FLOOD_CONTEXT(obj) (dynamic_cast<SPFloodContext*>((SPEventContext*)obj)) #define SP_IS_FLOOD_CONTEXT(obj) (dynamic_cast<const SPFloodContext*>((const SPEventContext*)obj) != NULL) diff --git a/src/gradient-context.h b/src/gradient-context.h index a49ea305a..7a2918f3d 100644 --- a/src/gradient-context.h +++ b/src/gradient-context.h @@ -19,7 +19,7 @@ #include <sigc++/sigc++.h> #include "event-context.h" -#define SP_GRADIENT_CONTEXT(obj) ((SPGradientContext*)obj) +#define SP_GRADIENT_CONTEXT(obj) (dynamic_cast<SPGradientContext*>((SPEventContext*)obj)) #define SP_IS_GRADIENT_CONTEXT(obj) (dynamic_cast<const SPGradientContext*>((const SPEventContext*)obj) != NULL) class SPGradientContext : public SPEventContext { diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index 1097b12c8..0e9851cdb 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -17,7 +17,7 @@ #include "pen-context.h" -#define SP_LPETOOL_CONTEXT(obj) ((SPLPEToolContext*)obj) +#define SP_LPETOOL_CONTEXT(obj) (dynamic_cast<SPLPEToolContext*>((SPEventContext*)obj)) #define SP_IS_LPETOOL_CONTEXT(obj) (dynamic_cast<const SPLPEToolContext*>((const SPEventContext*)obj) != NULL) /* This is the list of subtools from which the toolbar of the LPETool is built automatically */ diff --git a/src/marker.h b/src/marker.h index 3da12af08..aae4e020f 100644 --- a/src/marker.h +++ b/src/marker.h @@ -19,7 +19,7 @@ */ #define SP_TYPE_MARKER (sp_marker_get_type ()) -#define SP_MARKER(obj) ((SPMarker*)obj) +#define SP_MARKER(obj) (dynamic_cast<SPMarker*>((SPObject*)obj)) #define SP_IS_MARKER(obj) (dynamic_cast<const SPMarker*>((SPObject*)obj) != NULL) struct SPMarkerView; diff --git a/src/measure-context.h b/src/measure-context.h index 7dd8a59b4..e42265045 100644 --- a/src/measure-context.h +++ b/src/measure-context.h @@ -14,7 +14,7 @@ #include "event-context.h" -#define SP_MEASURE_CONTEXT(obj) ((SPMeasureContext*)obj) +#define SP_MEASURE_CONTEXT(obj) (dynamic_cast<SPMeasureContext*>((SPEventContext*)obj)) #define SP_IS_MEASURE_CONTEXT(obj) (dynamic_cast<const SPMeasureContext*>((const SPEventContext*)obj) != NULL) class SPMeasureContext : public SPEventContext { diff --git a/src/mesh-context.h b/src/mesh-context.h index 384aca0ff..531587654 100644 --- a/src/mesh-context.h +++ b/src/mesh-context.h @@ -21,7 +21,7 @@ #include <sigc++/sigc++.h> #include "event-context.h" -#define SP_MESH_CONTEXT(obj) ((SPMeshContext*)obj) +#define SP_MESH_CONTEXT(obj) (dynamic_cast<SPMeshContext*>((SPEventContext*)obj)) #define SP_IS_MESH_CONTEXT(obj) (dynamic_cast<const SPMeshContext*>((const SPEventContext*)obj) != NULL) class SPMeshContext : public SPEventContext { diff --git a/src/pen-context.h b/src/pen-context.h index 0e318f66b..c096865f1 100644 --- a/src/pen-context.h +++ b/src/pen-context.h @@ -8,7 +8,7 @@ #include "draw-context.h" #include "live_effects/effect.h" -#define SP_PEN_CONTEXT(obj) ((SPPenContext*)obj) +#define SP_PEN_CONTEXT(obj) (dynamic_cast<SPPenContext*>((SPEventContext*)obj)) #define SP_IS_PEN_CONTEXT(obj) (dynamic_cast<const SPPenContext*>((const SPEventContext*)obj) != NULL) struct SPCtrlLine; diff --git a/src/pencil-context.h b/src/pencil-context.h index ff13a5ac0..b3ded0242 100644 --- a/src/pencil-context.h +++ b/src/pencil-context.h @@ -7,7 +7,7 @@ #include "draw-context.h" -#define SP_PENCIL_CONTEXT(obj) ((SPPencilContext*)obj) +#define SP_PENCIL_CONTEXT(obj) (dynamic_cast<SPPencilContext*>((SPEventContext*)obj)) #define SP_IS_PENCIL_CONTEXT(obj) (dynamic_cast<const SPPencilContext*>((const SPEventContext*)obj) != NULL) enum PencilState { diff --git a/src/persp3d.h b/src/persp3d.h index 450d41d11..cb7e7f900 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -12,7 +12,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#define SP_PERSP3D(obj) ((Persp3D*)obj) +#define SP_PERSP3D(obj) (dynamic_cast<Persp3D*>((SPObject*)obj)) #define SP_IS_PERSP3D(obj) (dynamic_cast<const Persp3D*>((SPObject*)obj) != NULL) #include <list> diff --git a/src/rect-context.h b/src/rect-context.h index f381fcba2..a85968b1c 100644 --- a/src/rect-context.h +++ b/src/rect-context.h @@ -21,7 +21,7 @@ #include "sp-rect.h" -#define SP_RECT_CONTEXT(obj) ((SPRectContext*)obj) +#define SP_RECT_CONTEXT(obj) (dynamic_cast<SPRectContext*>((SPEventContext*)obj)) #define SP_IS_RECT_CONTEXT(obj) (dynamic_cast<const SPRectContext*>((const SPEventContext*)obj) != NULL) class SPRectContext : public SPEventContext { diff --git a/src/select-context.h b/src/select-context.h index 3a601aa7a..bcea8537a 100644 --- a/src/select-context.h +++ b/src/select-context.h @@ -15,7 +15,7 @@ #include "event-context.h" #include <gtk/gtk.h> -#define SP_SELECT_CONTEXT(obj) ((SPSelectContext*)obj) +#define SP_SELECT_CONTEXT(obj) (dynamic_cast<SPSelectContext*>((SPEventContext*)obj)) #define SP_IS_SELECT_CONTEXT(obj) (dynamic_cast<const SPSelectContext*>((const SPEventContext*)obj) != NULL) struct SPCanvasItem; diff --git a/src/sp-anchor.h b/src/sp-anchor.h index e1f7d708a..cada9665e 100644 --- a/src/sp-anchor.h +++ b/src/sp-anchor.h @@ -15,7 +15,7 @@ #include "sp-item-group.h" -#define SP_ANCHOR(obj) ((SPAnchor*)obj) +#define SP_ANCHOR(obj) (dynamic_cast<SPAnchor*>((SPObject*)obj)) #define SP_IS_ANCHOR(obj) (dynamic_cast<const SPAnchor*>((SPObject*)obj) != NULL) class SPAnchor : public SPGroup { diff --git a/src/sp-clippath.h b/src/sp-clippath.h index e5b65b1b8..ba7a90a57 100644 --- a/src/sp-clippath.h +++ b/src/sp-clippath.h @@ -15,7 +15,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#define SP_CLIPPATH(obj) ((SPClipPath*)obj) +#define SP_CLIPPATH(obj) (dynamic_cast<SPClipPath*>((SPObject*)obj)) #define SP_IS_CLIPPATH(obj) (dynamic_cast<const SPClipPath*>((SPObject*)obj) != NULL) struct SPClipPathView; diff --git a/src/sp-defs.h b/src/sp-defs.h index dbe0df280..6efdea1f3 100644 --- a/src/sp-defs.h +++ b/src/sp-defs.h @@ -15,7 +15,7 @@ #include "sp-object.h" -#define SP_DEFS(obj) ((SPDefs*)obj) +#define SP_DEFS(obj) (dynamic_cast<SPDefs*>((SPObject*)obj)) #define SP_IS_DEFS(obj) (dynamic_cast<const SPDefs*>((SPObject*)obj) != NULL) class SPDefs : public SPObject { diff --git a/src/sp-desc.h b/src/sp-desc.h index 7a89aa7e6..2bb42b333 100644 --- a/src/sp-desc.h +++ b/src/sp-desc.h @@ -14,7 +14,7 @@ #include "sp-object.h" -#define SP_DESC(obj) ((SPDesc*)obj) +#define SP_DESC(obj) (dynamic_cast<SPDesc*>((SPObject*)obj)) #define SP_IS_DESC(obj) (dynamic_cast<const SPDesc*>((SPObject*)obj) != NULL) class SPDesc : public SPObject { diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h index 32cf58623..67e12006a 100644 --- a/src/sp-ellipse.h +++ b/src/sp-ellipse.h @@ -18,7 +18,7 @@ #include "sp-shape.h" /* Common parent class */ -#define SP_GENERICELLIPSE(obj) ((SPGenericEllipse*)obj) +#define SP_GENERICELLIPSE(obj) (dynamic_cast<SPGenericEllipse*>((SPObject*)obj)) #define SP_IS_GENERICELLIPSE(obj) (dynamic_cast<const SPGenericEllipse*>((SPObject*)obj) != NULL) class SPGenericEllipse : public SPShape { @@ -47,7 +47,7 @@ public: void sp_genericellipse_normalize (SPGenericEllipse *ellipse); /* SVG <ellipse> element */ -#define SP_ELLIPSE(obj) ((SPEllipse*)obj) +#define SP_ELLIPSE(obj) (dynamic_cast<SPEllipse*>((SPObject*)obj)) #define SP_IS_ELLIPSE(obj) (dynamic_cast<const SPEllipse*>((SPObject*)obj) != NULL) class SPEllipse : public SPGenericEllipse { @@ -64,7 +64,7 @@ public: void sp_ellipse_position_set (SPEllipse * ellipse, gdouble x, gdouble y, gdouble rx, gdouble ry); /* SVG <circle> element */ -#define SP_CIRCLE(obj) ((SPCircle*)obj) +#define SP_CIRCLE(obj) (dynamic_cast<SPCircle*>((SPObject*)obj)) #define SP_IS_CIRCLE(obj) (dynamic_cast<const SPCircle*>((SPObject*)obj) != NULL) class SPCircle : public SPGenericEllipse { @@ -79,7 +79,7 @@ public: }; /* <path sodipodi:type="arc"> element */ -#define SP_ARC(obj) ((SPArc*)obj) +#define SP_ARC(obj) (dynamic_cast<SPArc*>((SPObject*)obj)) #define SP_IS_ARC(obj) (dynamic_cast<const SPArc*>((SPObject*)obj) != NULL) class SPArc : public SPGenericEllipse { diff --git a/src/sp-filter-primitive.h b/src/sp-filter-primitive.h index e4dda2e06..040e2f31f 100644 --- a/src/sp-filter-primitive.h +++ b/src/sp-filter-primitive.h @@ -17,7 +17,7 @@ #include "sp-object.h" #include "svg/svg-length.h" -#define SP_FILTER_PRIMITIVE(obj) ((SPFilterPrimitive*)obj) +#define SP_FILTER_PRIMITIVE(obj) (dynamic_cast<SPFilterPrimitive*>((SPObject*)obj)) #define SP_IS_FILTER_PRIMITIVE(obj) (dynamic_cast<const SPFilterPrimitive*>((SPObject*)obj) != NULL) namespace Inkscape { diff --git a/src/sp-filter.h b/src/sp-filter.h index 29f1fb9f2..0d087c5bf 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -21,7 +21,7 @@ #include <glibmm/ustring.h> -#define SP_FILTER(obj) ((SPFilter*)obj) +#define SP_FILTER(obj) (dynamic_cast<SPFilter*>((SPObject*)obj)) #define SP_IS_FILTER(obj) (dynamic_cast<const SPFilter*>((SPObject*)obj) != NULL) #define SP_FILTER_FILTER_UNITS(f) (SP_FILTER(f)->filterUnits) diff --git a/src/sp-flowdiv.h b/src/sp-flowdiv.h index 756d211e9..d00cfc51b 100644 --- a/src/sp-flowdiv.h +++ b/src/sp-flowdiv.h @@ -7,19 +7,19 @@ #include "sp-object.h" #include "sp-item.h" -#define SP_FLOWDIV(obj) ((SPFlowdiv*)obj) +#define SP_FLOWDIV(obj) (dynamic_cast<SPFlowdiv*>((SPObject*)obj)) #define SP_IS_FLOWDIV(obj) (dynamic_cast<const SPFlowdiv*>((SPObject*)obj) != NULL) -#define SP_FLOWTSPAN(obj) ((SPFlowtspan*)obj) +#define SP_FLOWTSPAN(obj) (dynamic_cast<SPFlowtspan*>((SPObject*)obj)) #define SP_IS_FLOWTSPAN(obj) (dynamic_cast<const SPFlowtspan*>((SPObject*)obj) != NULL) -#define SP_FLOWPARA(obj) ((SPFlowpara*)obj) +#define SP_FLOWPARA(obj) (dynamic_cast<SPFlowpara*>((SPObject*)obj)) #define SP_IS_FLOWPARA(obj) (dynamic_cast<const SPFlowpara*>((SPObject*)obj) != NULL) -#define SP_FLOWLINE(obj) ((SPFlowline*)obj) +#define SP_FLOWLINE(obj) (dynamic_cast<SPFlowline*>((SPObject*)obj)) #define SP_IS_FLOWLINE(obj) (dynamic_cast<const SPFlowline*>((SPObject*)obj) != NULL) -#define SP_FLOWREGIONBREAK(obj) ((SPFlowregionbreak*)obj) +#define SP_FLOWREGIONBREAK(obj) (dynamic_cast<SPFlowregionbreak*>((SPObject*)obj)) #define SP_IS_FLOWREGIONBREAK(obj) (dynamic_cast<const SPFlowregionbreak*>((SPObject*)obj) != NULL) // these 3 are derivatives of SPItem to get the automatic style handling diff --git a/src/sp-flowregion.h b/src/sp-flowregion.h index 2a17b1309..59818651a 100644 --- a/src/sp-flowregion.h +++ b/src/sp-flowregion.h @@ -6,10 +6,10 @@ #include "sp-item.h" -#define SP_FLOWREGION(obj) ((SPFlowregion*)obj) +#define SP_FLOWREGION(obj) (dynamic_cast<SPFlowregion*>((SPObject*)obj)) #define SP_IS_FLOWREGION(obj) (dynamic_cast<const SPFlowregion*>((SPObject*)obj) != NULL) -#define SP_FLOWREGIONEXCLUDE(obj) ((SPFlowregionExclude*)obj) +#define SP_FLOWREGIONEXCLUDE(obj) (dynamic_cast<SPFlowregionExclude*>((SPObject*)obj)) #define SP_IS_FLOWREGIONEXCLUDE(obj) (dynamic_cast<const SPFlowregionExclude*>((SPObject*)obj) != NULL) class Path; diff --git a/src/sp-flowtext.h b/src/sp-flowtext.h index b1e2ccf8f..bd7c5990a 100644 --- a/src/sp-flowtext.h +++ b/src/sp-flowtext.h @@ -9,7 +9,7 @@ #include <2geom/forward.h> #include "libnrtype/Layout-TNG.h" -#define SP_FLOWTEXT(obj) ((SPFlowtext*)obj) +#define SP_FLOWTEXT(obj) (dynamic_cast<SPFlowtext*>((SPObject*)obj)) #define SP_IS_FLOWTEXT(obj) (dynamic_cast<const SPFlowtext*>((SPObject*)obj) != NULL) diff --git a/src/sp-font-face.h b/src/sp-font-face.h index c44692871..531dd5843 100644 --- a/src/sp-font-face.h +++ b/src/sp-font-face.h @@ -24,7 +24,7 @@ #include "sp-object.h" -#define SP_FONTFACE(obj) ((SPFontFace*)obj) +#define SP_FONTFACE(obj) (dynamic_cast<SPFontFace*>((SPObject*)obj)) #define SP_IS_FONTFACE(obj) (dynamic_cast<const SPFontFace*>((SPObject*)obj) != NULL) enum FontFaceStyleType{ diff --git a/src/sp-font.h b/src/sp-font.h index d90ee67f1..6e6f4eec2 100644 --- a/src/sp-font.h +++ b/src/sp-font.h @@ -18,7 +18,7 @@ #include "sp-object.h" -#define SP_FONT(obj) ((SPFont*)obj) +#define SP_FONT(obj) (dynamic_cast<SPFont*>((SPObject*)obj)) #define SP_IS_FONT(obj) (dynamic_cast<const SPFont*>((SPObject*)obj) != NULL) class SPFont : public SPObject { diff --git a/src/sp-glyph-kerning.h b/src/sp-glyph-kerning.h index c8cf6a0b6..5cae6b9dd 100644 --- a/src/sp-glyph-kerning.h +++ b/src/sp-glyph-kerning.h @@ -24,7 +24,7 @@ //#define SP_IS_HKERN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_HKERN)) //#define SP_IS_HKERN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_HKERN)) -#define SP_HKERN(obj) ((SPHkern*)obj) +#define SP_HKERN(obj) (dynamic_cast<SPHkern*>((SPObject*)obj)) #define SP_IS_HKERN(obj) (dynamic_cast<const SPHkern*>((SPObject*)obj) != NULL) //#define SP_VKERN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_VKERN, SPVkern)) @@ -32,7 +32,7 @@ //#define SP_IS_VKERN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_VKERN)) //#define SP_IS_VKERN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_VKERN)) -#define SP_VKERN(obj) ((SPVkern*)obj) +#define SP_VKERN(obj) (dynamic_cast<SPVkern*>((SPObject*)obj)) #define SP_IS_VKERN(obj) (dynamic_cast<const SPVkern*>((SPObject*)obj) != NULL) // CPPIFY: These casting macros are buggy, as Vkern and Hkern aren't "real" classes. diff --git a/src/sp-glyph.h b/src/sp-glyph.h index 7734efdb0..798d9ff2f 100644 --- a/src/sp-glyph.h +++ b/src/sp-glyph.h @@ -18,7 +18,7 @@ #include "sp-object.h" -#define SP_GLYPH(obj) ((SPGlyph*)obj) +#define SP_GLYPH(obj) (dynamic_cast<SPGlyph*>((SPObject*)obj)) #define SP_IS_GLYPH(obj) (dynamic_cast<const SPGlyph*>((SPObject*)obj) != NULL) enum glyphArabicForm { diff --git a/src/sp-gradient.h b/src/sp-gradient.h index 157edf669..46eb41cdb 100644 --- a/src/sp-gradient.h +++ b/src/sp-gradient.h @@ -41,7 +41,7 @@ class SPGradientReference; class SPStop; -#define SP_GRADIENT(obj) ((SPGradient*)obj) +#define SP_GRADIENT(obj) (dynamic_cast<SPGradient*>((SPObject*)obj)) #define SP_IS_GRADIENT(obj) (dynamic_cast<const SPGradient*>((SPObject*)obj) != NULL) enum SPGradientType { diff --git a/src/sp-guide.h b/src/sp-guide.h index 83a5e8349..fa4f0033b 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -23,7 +23,7 @@ struct SPCanvas; struct SPCanvasGroup; class SPDesktop; -#define SP_GUIDE(obj) ((SPGuide*)obj) +#define SP_GUIDE(obj) (dynamic_cast<SPGuide*>((SPObject*)obj)) #define SP_IS_GUIDE(obj) (dynamic_cast<const SPGuide*>((SPObject*)obj) != NULL) /* Represents the constraint on p that dot(g.direction, p) == g.position. */ diff --git a/src/sp-image.h b/src/sp-image.h index d18a4ca6e..9a229e5f5 100644 --- a/src/sp-image.h +++ b/src/sp-image.h @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#define SP_IMAGE(obj) ((SPImage*)obj) +#define SP_IMAGE(obj) (dynamic_cast<SPImage*>((SPObject*)obj)) #define SP_IS_IMAGE(obj) (dynamic_cast<const SPImage*>((SPObject*)obj) != NULL) /* SPImage */ diff --git a/src/sp-item-group.h b/src/sp-item-group.h index ae77ed809..88ca9657a 100644 --- a/src/sp-item-group.h +++ b/src/sp-item-group.h @@ -16,7 +16,7 @@ #include <map> #include "sp-lpe-item.h" -#define SP_GROUP(obj) ((SPGroup*)obj) +#define SP_GROUP(obj) (dynamic_cast<SPGroup*>((SPObject*)obj)) #define SP_IS_GROUP(obj) (dynamic_cast<const SPGroup*>((SPObject*)obj) != NULL) #define SP_IS_LAYER(obj) (SP_IS_GROUP(obj) && SP_GROUP(obj)->layerMode() == SPGroup::LAYER) diff --git a/src/sp-item.h b/src/sp-item.h index 1523f9a62..8dfb4142a 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -99,7 +99,7 @@ public: Geom::Affine i2vp; }; -#define SP_ITEM(obj) ((SPItem*)obj) +#define SP_ITEM(obj) (dynamic_cast<SPItem*>((SPObject*)obj)) #define SP_IS_ITEM(obj) (dynamic_cast<const SPItem*>((SPObject*)obj) != NULL) /** Abstract base class for all visible shapes. */ diff --git a/src/sp-line.h b/src/sp-line.h index 66131f2c8..ebdfc9f04 100644 --- a/src/sp-line.h +++ b/src/sp-line.h @@ -17,7 +17,7 @@ #include "svg/svg-length.h" #include "sp-shape.h" -#define SP_LINE(obj) ((SPLine*)obj) +#define SP_LINE(obj) (dynamic_cast<SPLine*>((SPObject*)obj)) #define SP_IS_LINE(obj) (dynamic_cast<const SPLine*>((SPObject*)obj) != NULL) class SPLine : public SPShape { diff --git a/src/sp-linear-gradient.h b/src/sp-linear-gradient.h index 4f75d7ca8..ac3fdb04a 100644 --- a/src/sp-linear-gradient.h +++ b/src/sp-linear-gradient.h @@ -8,7 +8,7 @@ #include "sp-gradient.h" #include "svg/svg-length.h" -#define SP_LINEARGRADIENT(obj) ((SPLinearGradient*)obj) +#define SP_LINEARGRADIENT(obj) (dynamic_cast<SPLinearGradient*>((SPObject*)obj)) #define SP_IS_LINEARGRADIENT(obj) (dynamic_cast<const SPLinearGradient*>((SPObject*)obj) != NULL) /** Linear gradient. */ diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index 0aac8f057..925ff34d8 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -18,7 +18,7 @@ #include <list> -#define SP_LPE_ITEM(obj) ((SPLPEItem*)obj) +#define SP_LPE_ITEM(obj) (dynamic_cast<SPLPEItem*>((SPObject*)obj)) #define SP_IS_LPE_ITEM(obj) (dynamic_cast<const SPLPEItem*>((SPObject*)obj) != NULL) class CLPEItem; diff --git a/src/sp-mask.h b/src/sp-mask.h index 16f967419..e08d1e81e 100644 --- a/src/sp-mask.h +++ b/src/sp-mask.h @@ -18,7 +18,7 @@ #include "uri-references.h" #include "xml/node.h" -#define SP_MASK(obj) ((SPMask*)obj) +#define SP_MASK(obj) (dynamic_cast<SPMask*>((SPObject*)obj)) #define SP_IS_MASK(obj) (dynamic_cast<const SPMask*>((SPObject*)obj) != NULL) struct SPMaskView; diff --git a/src/sp-mesh-gradient.h b/src/sp-mesh-gradient.h index fb59ad802..0b570c4dd 100644 --- a/src/sp-mesh-gradient.h +++ b/src/sp-mesh-gradient.h @@ -8,7 +8,7 @@ #include "svg/svg-length.h" #include "sp-gradient.h" -#define SP_MESHGRADIENT(obj) ((SPMeshGradient*)obj) +#define SP_MESHGRADIENT(obj) (dynamic_cast<SPMeshGradient*>((SPObject*)obj)) #define SP_IS_MESHGRADIENT(obj) (dynamic_cast<const SPMeshGradient*>((SPObject*)obj) != NULL) /** Mesh gradient. */ diff --git a/src/sp-mesh-patch.h b/src/sp-mesh-patch.h index fe9f2d071..ddade6503 100644 --- a/src/sp-mesh-patch.h +++ b/src/sp-mesh-patch.h @@ -17,7 +17,7 @@ //#include "svg/svg-length.h" #include "sp-object.h" -#define SP_MESHPATCH(obj) ((SPMeshPatch*)obj) +#define SP_MESHPATCH(obj) (dynamic_cast<SPMeshPatch*>((SPObject*)obj)) #define SP_IS_MESHPATCH(obj) (dynamic_cast<const SPMeshPatch*>((SPObject*)obj) != NULL) /** Gradient MeshPatch. */ diff --git a/src/sp-mesh-row.h b/src/sp-mesh-row.h index a9f8bfd31..e39bdc631 100644 --- a/src/sp-mesh-row.h +++ b/src/sp-mesh-row.h @@ -14,7 +14,7 @@ #include <glib.h> #include "sp-object.h" -#define SP_MESHROW(obj) ((SPMeshRow*)obj) +#define SP_MESHROW(obj) (dynamic_cast<SPMeshRow*>((SPObject*)obj)) #define SP_IS_MESHROW(obj) (dynamic_cast<const SPMeshRow*>((SPObject*)obj) != NULL) /** Gradient MeshRow. */ diff --git a/src/sp-metadata.h b/src/sp-metadata.h index a667b214a..2a9d58e11 100644 --- a/src/sp-metadata.h +++ b/src/sp-metadata.h @@ -17,7 +17,7 @@ /* Metadata base class */ -#define SP_METADATA(obj) ((SPMetadata*)obj) +#define SP_METADATA(obj) (dynamic_cast<SPMetadata*>((SPObject*)obj)) #define SP_IS_METADATA(obj) (dynamic_cast<const SPMetadata*>((SPObject*)obj) != NULL) class SPMetadata : public SPObject { diff --git a/src/sp-missing-glyph.h b/src/sp-missing-glyph.h index 291ea626f..a72ed0e99 100644 --- a/src/sp-missing-glyph.h +++ b/src/sp-missing-glyph.h @@ -18,7 +18,7 @@ #include "sp-object.h" -#define SP_MISSING_GLYPH(obj) ((SPMissingGlyph*)obj) +#define SP_MISSING_GLYPH(obj) (dynamic_cast<SPMissingGlyph*>((SPObject*)obj)) #define SP_IS_MISSING_GLYPH(obj) (dynamic_cast<const SPMissingGlyph*>((SPObject*)obj) != NULL) class SPMissingGlyph : public SPObject { diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 92a31b11b..30f962d9f 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -14,7 +14,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#define SP_NAMEDVIEW(obj) ((SPNamedView*)obj) +#define SP_NAMEDVIEW(obj) (dynamic_cast<SPNamedView*>((SPObject*)obj)) #define SP_IS_NAMEDVIEW(obj) (dynamic_cast<const SPNamedView*>((SPObject*)obj) != NULL) #include "sp-object-group.h" diff --git a/src/sp-object-group.h b/src/sp-object-group.h index 552b321b1..4df346228 100644 --- a/src/sp-object-group.h +++ b/src/sp-object-group.h @@ -16,7 +16,7 @@ #include "sp-object.h" -#define SP_OBJECTGROUP(obj) ((SPObjectGroup*)obj) +#define SP_OBJECTGROUP(obj) (dynamic_cast<SPObjectGroup*>((SPObject*)obj)) #define SP_IS_OBJECTGROUP(obj) (dynamic_cast<const SPObjectGroup*>((SPObject*)obj) != NULL) class SPObjectGroup : public SPObject { diff --git a/src/sp-object.h b/src/sp-object.h index 077633400..4e9a6c938 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -17,7 +17,7 @@ class SPObject; -#define SP_OBJECT(obj) ((SPObject*)obj) +#define SP_OBJECT(obj) (dynamic_cast<SPObject*>((SPObject*)obj)) #define SP_IS_OBJECT(obj) (dynamic_cast<const SPObject*>((SPObject*)obj) != NULL) /* Async modification flags */ diff --git a/src/sp-offset.h b/src/sp-offset.h index 9d173b66a..7fe6a8a24 100644 --- a/src/sp-offset.h +++ b/src/sp-offset.h @@ -16,7 +16,7 @@ #include <stddef.h> #include <sigc++/sigc++.h> -#define SP_OFFSET(obj) ((SPOffset*)obj) +#define SP_OFFSET(obj) (dynamic_cast<SPOffset*>((SPObject*)obj)) #define SP_IS_OFFSET(obj) (dynamic_cast<const SPOffset*>((SPObject*)obj) != NULL) class SPUseReference; diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h index 4c77bdaa6..89c4f6b1b 100644 --- a/src/sp-paint-server.h +++ b/src/sp-paint-server.h @@ -20,7 +20,7 @@ #include "sp-object.h" #include "uri-references.h" -#define SP_PAINT_SERVER(obj) ((SPPaintServer*)obj) +#define SP_PAINT_SERVER(obj) (dynamic_cast<SPPaintServer*>((SPObject*)obj)) #define SP_IS_PAINT_SERVER(obj) (dynamic_cast<const SPPaintServer*>((SPObject*)obj) != NULL) class SPPaintServer : public SPObject { diff --git a/src/sp-path.h b/src/sp-path.h index be3a1b03d..42c0f22c8 100644 --- a/src/sp-path.h +++ b/src/sp-path.h @@ -21,7 +21,7 @@ class SPCurve; -#define SP_PATH(obj) ((SPPath*)obj) +#define SP_PATH(obj) (dynamic_cast<SPPath*>((SPObject*)obj)) #define SP_IS_PATH(obj) (dynamic_cast<const SPPath*>((SPObject*)obj) != NULL) /** diff --git a/src/sp-pattern.h b/src/sp-pattern.h index c7a2a96c3..4e3657ccf 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -17,7 +17,7 @@ #include "sp-item.h" -#define SP_PATTERN(obj) ((SPPattern*)obj) +#define SP_PATTERN(obj) (dynamic_cast<SPPattern*>((SPObject*)obj)) #define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj) != NULL) class SPPatternReference; diff --git a/src/sp-polygon.h b/src/sp-polygon.h index bac632a95..f9c93ac8f 100644 --- a/src/sp-polygon.h +++ b/src/sp-polygon.h @@ -16,7 +16,7 @@ #include "sp-shape.h" -#define SP_POLYGON(obj) ((SPPolygon*)obj) +#define SP_POLYGON(obj) (dynamic_cast<SPPolygon*>((SPObject*)obj)) #define SP_IS_POLYGON(obj) (dynamic_cast<const SPPolygon*>((SPObject*)obj) != NULL) class SPPolygon : public SPShape { diff --git a/src/sp-polyline.h b/src/sp-polyline.h index 75c2217b5..f8b7e9b49 100644 --- a/src/sp-polyline.h +++ b/src/sp-polyline.h @@ -3,7 +3,7 @@ #include "sp-shape.h" -#define SP_POLYLINE(obj) ((SPPolyLine*)obj) +#define SP_POLYLINE(obj) (dynamic_cast<SPPolyLine*>((SPObject*)obj)) #define SP_IS_POLYLINE(obj) (dynamic_cast<const SPPolyLine*>((SPObject*)obj) != NULL) class SPPolyLine : public SPShape { diff --git a/src/sp-radial-gradient.h b/src/sp-radial-gradient.h index e0be01b9b..42ff109aa 100644 --- a/src/sp-radial-gradient.h +++ b/src/sp-radial-gradient.h @@ -9,7 +9,7 @@ #include "sp-gradient.h" #include "svg/svg-length.h" -#define SP_RADIALGRADIENT(obj) ((SPRadialGradient*)obj) +#define SP_RADIALGRADIENT(obj) (dynamic_cast<SPRadialGradient*>((SPObject*)obj)) #define SP_IS_RADIALGRADIENT(obj) (dynamic_cast<const SPRadialGradient*>((SPObject*)obj) != NULL) /** Radial gradient. */ diff --git a/src/sp-rect.h b/src/sp-rect.h index 04026e051..28f74f9f9 100644 --- a/src/sp-rect.h +++ b/src/sp-rect.h @@ -19,7 +19,7 @@ #include <2geom/forward.h> -#define SP_RECT(obj) ((SPRect*)obj) +#define SP_RECT(obj) (dynamic_cast<SPRect*>((SPObject*)obj)) #define SP_IS_RECT(obj) (dynamic_cast<const SPRect*>((SPObject*)obj) != NULL) class SPRect : public SPShape { diff --git a/src/sp-root.h b/src/sp-root.h index 6853a8c8a..a9f64a53b 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -19,7 +19,7 @@ #include "enums.h" #include "sp-item-group.h" -#define SP_ROOT(obj) ((SPRoot*)obj) +#define SP_ROOT(obj) (dynamic_cast<SPRoot*>((SPObject*)obj)) #define SP_IS_ROOT(obj) (dynamic_cast<const SPRoot*>((SPObject*)obj) != NULL) class SPDefs; diff --git a/src/sp-script.h b/src/sp-script.h index f6ef9d5fd..95b56e79c 100644 --- a/src/sp-script.h +++ b/src/sp-script.h @@ -14,7 +14,7 @@ #include "sp-item.h" -#define SP_SCRIPT(obj) ((SPScript*)obj) +#define SP_SCRIPT(obj) (dynamic_cast<SPScript*>((SPObject*)obj)) #define SP_IS_SCRIPT(obj) (dynamic_cast<const SPScript*>((SPObject*)obj) != NULL) /* SPScript */ diff --git a/src/sp-shape.h b/src/sp-shape.h index 806615606..bc51f3d45 100644 --- a/src/sp-shape.h +++ b/src/sp-shape.h @@ -22,7 +22,7 @@ #include <stddef.h> #include <sigc++/connection.h> -#define SP_SHAPE(obj) ((SPShape*)obj) +#define SP_SHAPE(obj) (dynamic_cast<SPShape*>((SPObject*)obj)) #define SP_IS_SHAPE(obj) (dynamic_cast<const SPShape*>((SPObject*)obj) != NULL) #define SP_SHAPE_WRITE_PATH (1 << 2) diff --git a/src/sp-spiral.h b/src/sp-spiral.h index 6066b6157..1e9c2d2b4 100644 --- a/src/sp-spiral.h +++ b/src/sp-spiral.h @@ -24,7 +24,7 @@ #define SAMPLE_SIZE 8 ///< sample size per one bezier -#define SP_SPIRAL(obj) ((SPSpiral*)obj) +#define SP_SPIRAL(obj) (dynamic_cast<SPSpiral*>((SPObject*)obj)) #define SP_IS_SPIRAL(obj) (dynamic_cast<const SPSpiral*>((SPObject*)obj) != NULL) /** diff --git a/src/sp-star.h b/src/sp-star.h index fc6de84e1..0f1280139 100644 --- a/src/sp-star.h +++ b/src/sp-star.h @@ -17,7 +17,7 @@ #include "sp-polygon.h" -#define SP_STAR(obj) ((SPStar*)obj) +#define SP_STAR(obj) (dynamic_cast<SPStar*>((SPObject*)obj)) #define SP_IS_STAR(obj) (dynamic_cast<const SPStar*>((SPObject*)obj) != NULL) typedef enum { diff --git a/src/sp-stop.h b/src/sp-stop.h index b0bae50d1..b1996e054 100644 --- a/src/sp-stop.h +++ b/src/sp-stop.h @@ -16,7 +16,7 @@ namespace Glib { class ustring; } -#define SP_STOP(obj) ((SPStop*)obj) +#define SP_STOP(obj) (dynamic_cast<SPStop*>((SPObject*)obj)) #define SP_IS_STOP(obj) (dynamic_cast<const SPStop*>((SPObject*)obj) != NULL) /** Gradient stop. */ diff --git a/src/sp-string.h b/src/sp-string.h index d7634a719..eabf76353 100644 --- a/src/sp-string.h +++ b/src/sp-string.h @@ -10,7 +10,7 @@ #include "sp-object.h" -#define SP_STRING(obj) ((SPString*)obj) +#define SP_STRING(obj) (dynamic_cast<SPString*>((SPObject*)obj)) #define SP_IS_STRING(obj) (dynamic_cast<const SPString*>((SPObject*)obj) != NULL) class SPString : public SPObject { diff --git a/src/sp-style-elem.h b/src/sp-style-elem.h index 83fe2ea5e..8e8a2b3a8 100644 --- a/src/sp-style-elem.h +++ b/src/sp-style-elem.h @@ -4,7 +4,7 @@ #include "sp-object.h" #include "media.h" -#define SP_STYLE_ELEM(obj) ((SPStyleElem*)obj) +#define SP_STYLE_ELEM(obj) (dynamic_cast<SPStyleElem*>((SPObject*)obj)) #define SP_IS_STYLE_ELEM(obj) (dynamic_cast<const SPStyleElem*>((SPObject*)obj) != NULL) class SPStyleElem : public SPObject { diff --git a/src/sp-switch.h b/src/sp-switch.h index 3323617f9..210cd0ddc 100644 --- a/src/sp-switch.h +++ b/src/sp-switch.h @@ -17,7 +17,7 @@ #include <stddef.h> #include <sigc++/connection.h> -#define SP_SWITCH(obj) ((SPSwitch*)obj) +#define SP_SWITCH(obj) (dynamic_cast<SPSwitch*>((SPObject*)obj)) #define SP_IS_SWITCH(obj) (dynamic_cast<const SPSwitch*>((SPObject*)obj) != NULL) class SPSwitch : public SPGroup { diff --git a/src/sp-symbol.h b/src/sp-symbol.h index 67e68d2e8..952ba00df 100644 --- a/src/sp-symbol.h +++ b/src/sp-symbol.h @@ -18,7 +18,7 @@ */ #define SP_TYPE_SYMBOL (sp_symbol_get_type ()) -#define SP_SYMBOL(obj) ((SPSymbol*)obj) +#define SP_SYMBOL(obj) (dynamic_cast<SPSymbol*>((SPObject*)obj)) #define SP_IS_SYMBOL(obj) (dynamic_cast<const SPSymbol*>((SPObject*)obj) != NULL) #include <2geom/affine.h> diff --git a/src/sp-text.h b/src/sp-text.h index b23865855..12f773ded 100644 --- a/src/sp-text.h +++ b/src/sp-text.h @@ -21,7 +21,7 @@ #include "text-tag-attributes.h" #include "libnrtype/Layout-TNG.h" -#define SP_TEXT(obj) ((SPText*)obj) +#define SP_TEXT(obj) (dynamic_cast<SPText*>((SPObject*)obj)) #define SP_IS_TEXT(obj) (dynamic_cast<const SPText*>((SPObject*)obj) != NULL) /* Text specific flags */ diff --git a/src/sp-textpath.h b/src/sp-textpath.h index 1191a59f6..075743d8e 100644 --- a/src/sp-textpath.h +++ b/src/sp-textpath.h @@ -9,7 +9,7 @@ class SPUsePath; class Path; -#define SP_TEXTPATH(obj) ((SPTextPath*)obj) +#define SP_TEXTPATH(obj) (dynamic_cast<SPTextPath*>((SPObject*)obj)) #define SP_IS_TEXTPATH(obj) (dynamic_cast<const SPTextPath*>((SPObject*)obj) != NULL) class SPTextPath : public SPItem { diff --git a/src/sp-title.h b/src/sp-title.h index 671527bc1..14faf4b0a 100644 --- a/src/sp-title.h +++ b/src/sp-title.h @@ -14,7 +14,7 @@ #include "sp-object.h" -#define SP_TITLE(obj) ((SPTitle*)obj) +#define SP_TITLE(obj) (dynamic_cast<SPTitle*>((SPObject*)obj)) #define SP_IS_TITLE(obj) (dynamic_cast<const SPTitle*>((SPObject*)obj) != NULL) class SPTitle : public SPObject { diff --git a/src/sp-tref.h b/src/sp-tref.h index f38a76e57..451c6cb58 100644 --- a/src/sp-tref.h +++ b/src/sp-tref.h @@ -22,7 +22,7 @@ /* tref base class */ -#define SP_TREF(obj) ((SPTRef*)obj) +#define SP_TREF(obj) (dynamic_cast<SPTRef*>((SPObject*)obj)) #define SP_IS_TREF(obj) (dynamic_cast<const SPTRef*>((SPObject*)obj) != NULL) class SPTRef : public SPItem { diff --git a/src/sp-tspan.h b/src/sp-tspan.h index c86095273..d1c6ec4bc 100644 --- a/src/sp-tspan.h +++ b/src/sp-tspan.h @@ -9,7 +9,7 @@ #include "sp-item.h" #include "text-tag-attributes.h" -#define SP_TSPAN(obj) ((SPTSpan*)obj) +#define SP_TSPAN(obj) (dynamic_cast<SPTSpan*>((SPObject*)obj)) #define SP_IS_TSPAN(obj) (dynamic_cast<const SPTSpan*>((SPObject*)obj) != NULL) enum { diff --git a/src/sp-use.h b/src/sp-use.h index b90c98ad2..37ff2cf66 100644 --- a/src/sp-use.h +++ b/src/sp-use.h @@ -18,7 +18,7 @@ #include "svg/svg-length.h" #include "sp-item.h" -#define SP_USE(obj) ((SPUse*)obj) +#define SP_USE(obj) (dynamic_cast<SPUse*>((SPObject*)obj)) #define SP_IS_USE(obj) (dynamic_cast<const SPUse*>((SPObject*)obj) != NULL) class SPUseReference; diff --git a/src/spiral-context.h b/src/spiral-context.h index 21b109f07..d5bd15941 100644 --- a/src/spiral-context.h +++ b/src/spiral-context.h @@ -23,7 +23,7 @@ #include "sp-spiral.h" -#define SP_SPIRAL_CONTEXT(obj) ((SPSpiralContext*)obj) +#define SP_SPIRAL_CONTEXT(obj) (dynamic_cast<SPSpiralContext*>((SPEventContext*)obj)) #define SP_IS_SPIRAL_CONTEXT(obj) (dynamic_cast<const SPSpiralContext*>((const SPEventContext*)obj) != NULL) class SPSpiralContext : public SPEventContext { diff --git a/src/spray-context.h b/src/spray-context.h index 2b20ae13d..4e1ab9dc0 100644 --- a/src/spray-context.h +++ b/src/spray-context.h @@ -21,7 +21,7 @@ #include <2geom/point.h> #include "event-context.h" -#define SP_SPRAY_CONTEXT(obj) ((SPSprayContext*)obj) +#define SP_SPRAY_CONTEXT(obj) (dynamic_cast<SPSprayContext*>((SPEventContext*)obj)) #define SP_IS_SPRAY_CONTEXT(obj) (dynamic_cast<const SPSprayContext*>((const SPEventContext*)obj) != NULL) namespace Inkscape { diff --git a/src/text-context.h b/src/text-context.h index 196ecf576..95b812c2b 100644 --- a/src/text-context.h +++ b/src/text-context.h @@ -23,7 +23,7 @@ #include <2geom/point.h> #include "libnrtype/Layout-TNG.h" -#define SP_TEXT_CONTEXT(obj) ((SPTextContext*)obj) +#define SP_TEXT_CONTEXT(obj) (dynamic_cast<SPTextContext*>((SPEventContext*)obj)) #define SP_IS_TEXT_CONTEXT(obj) (dynamic_cast<const SPTextContext*>((const SPEventContext*)obj) != NULL) struct SPCtrlLine; diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index 779cf98e6..ce022cec6 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -30,7 +30,7 @@ namespace Inkscape { } } -#define INK_NODE_TOOL(obj) ((InkNodeTool*)obj) +#define INK_NODE_TOOL(obj) (dynamic_cast<InkNodeTool*>((SPEventContext*)obj)) #define INK_IS_NODE_TOOL(obj) (dynamic_cast<const InkNodeTool*>((const SPEventContext*)obj)) class InkNodeTool : public SPEventContext { diff --git a/src/zoom-context.h b/src/zoom-context.h index 70e9e04f5..3e98915af 100644 --- a/src/zoom-context.h +++ b/src/zoom-context.h @@ -15,7 +15,7 @@ #include "event-context.h" -#define SP_ZOOM_CONTEXT(obj) ((SPZoomContext*)obj) +#define SP_ZOOM_CONTEXT(obj) (dynamic_cast<SPZoomContext*>((SPEventContext*)obj)) #define SP_IS_ZOOM_CONTEXT(obj) (dynamic_cast<const SPZoomContext*>((const SPEventContext*)obj) != NULL) class SPZoomContext : public SPEventContext { |
