From 3329f64342c406b1a508e985f0d6ce302888f9e3 Mon Sep 17 00:00:00 2001 From: joncruz Date: Fri, 5 Dec 2008 06:21:29 +0000 Subject: [PATCH] Warning cleanup. --- src/display/nr-filter-gaussian.cpp | 8 +++ src/lpe-tool-context.cpp | 4 +- src/sp-ellipse.cpp | 18 +++--- src/sp-item.cpp | 90 +++++++++++++++--------------- src/sp-rect.cpp | 10 ++-- src/sp-text.cpp | 4 +- 6 files changed, 69 insertions(+), 65 deletions(-) diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index c1b534b77..e5cc35deb 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -38,6 +38,10 @@ #include "util/fixed_point.h" #include "preferences.h" +#ifndef INK_UNUSED +#define INK_UNUSED(x) ((void)(x)) +#endif + // IIR filtering method based on: // L.J. van Vliet, I.T. Young, and P.W. Verbeek, Recursive Gaussian Derivative Filters, // in: A.K. Jain, S. Venkatesh, B.C. Lovell (eds.), @@ -282,6 +286,8 @@ filter2D_IIR(PT *const dest, int const dstr1, int const dstr2, { #if HAVE_OPENMP #pragma omp parallel for num_threads(num_threads) +#else + INK_UNUSED(num_threads); #endif // HAVE_OPENMP for ( int c2 = 0 ; c2 < n2 ; c2++ ) { #if HAVE_OPENMP @@ -351,6 +357,8 @@ filter2D_FIR(PT *const dst, int const dstr1, int const dstr2, #if HAVE_OPENMP #pragma omp parallel for num_threads(num_threads) private(history) +#else + INK_UNUSED(num_threads); #endif // HAVE_OPENMP for ( int c2 = 0 ; c2 < n2 ; c2++ ) { diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 5c6575cca..0f96c6ed2 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -375,7 +375,7 @@ lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type) { * Checks whether an item has a construction applied as LPE and if so returns the index in * lpesubtools of this construction */ -int lpetool_item_has_construction(SPLPEToolContext *lc, SPItem *item) +int lpetool_item_has_construction(SPLPEToolContext */*lc*/, SPItem *item) { if (!SP_IS_LPE_ITEM(item)) { return -1; @@ -467,7 +467,7 @@ lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc) static void set_pos_and_anchor(SPCanvasText *canvas_text, const Geom::Piecewise > &pwd2, - const double t, const double length, bool use_curvature = false) + const double t, const double length, bool /*use_curvature*/ = false) { using namespace Geom; diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index b6f510201..bee7e1b5d 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -257,11 +257,11 @@ static void sp_genericellipse_set_shape(SPShape *shape) curve->unref(); } -static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs) +static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const */*snapprefs*/) { g_assert(item != NULL); g_assert(SP_IS_GENERICELLIPSE(item)); - + SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item); sp_genericellipse_normalize(ellipse); NR::Matrix const i2d = sp_item_i2d_affine(item); @@ -278,10 +278,10 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, I } double rx = ellipse->rx.computed; - double ry = ellipse->ry.computed; + double ry = ellipse->ry.computed; double cx = ellipse->cx.computed; double cy = ellipse->cy.computed; - + // Snap to the 4 quadrant points of the ellipse, but only if the arc // spans far enough to include them double angle = 0; @@ -290,19 +290,19 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, I *p = NR::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2d; } } - - // And if we have a slice, also snap to the endpoints and the centre point + + // And if we have a slice, also snap to the endpoints and the centre point if (slice) { // Add the centre, if we have a closed slice if (ellipse->closed) { *p = NR::Point(cx, cy) * i2d; } // Add the start point, if it's not coincident with a quadrant point - if (fmod(ellipse->start, M_PI_2) != 0.0 ) { + if (fmod(ellipse->start, M_PI_2) != 0.0 ) { *p = NR::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2d; - } + } // Add the end point, if it's not coincident with a quadrant point - if (fmod(ellipse->end, M_PI_2) != 0.0 ) { + if (fmod(ellipse->end, M_PI_2) != 0.0 ) { *p = NR::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2d; } } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 8868b7875..01f266594 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1,5 +1,3 @@ -#define __SP_ITEM_C__ - /** \file * Base class for visual SVG elements */ @@ -166,13 +164,13 @@ void SPItem::init() { this->display = NULL; this->clip_ref = new SPClipPathReference(this); - sigc::signal cs1=this->clip_ref->changedSignal(); - sigc::slot2 sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this); + sigc::signal cs1=this->clip_ref->changedSignal(); + sigc::slot2 sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this); _clip_ref_connection = cs1.connect(sl1); this->mask_ref = new SPMaskReference(this); - sigc::signal cs2=this->mask_ref->changedSignal(); - sigc::slot2 sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), this); + sigc::signal cs2=this->mask_ref->changedSignal(); + sigc::slot2 sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), this); _mask_ref_connection = cs2.connect(sl2); this->avoidRef = new SPAvoidRef(this); @@ -271,7 +269,7 @@ bool SPItem::isExplicitlyHidden() const { return (this->style->display.set - && this->style->display.value == SP_CSS_DISPLAY_NONE); + && this->style->display.value == SP_CSS_DISPLAY_NONE); } /** @@ -663,7 +661,7 @@ sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape SPObject *child; SPItem *item = SP_ITEM(object); - // in the case of SP_OBJECT_WRITE_BUILD, the item should always be newly created, + // in the case of SP_OBJECT_WRITE_BUILD, the item should always be newly created, // so we need to add any children from the underlying object to the new repr if (flags & SP_OBJECT_WRITE_BUILD) { Inkscape::XML::Node *crepr; @@ -749,7 +747,7 @@ sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transf /** Calls \a item's subclass' bounding box method; clips it by the bbox of clippath, if any; and * unions the resulting bbox with \a bbox. If \a clear is true, empties \a bbox first. Passes the * transform and the flags to the actual bbox methods. Note that many of subclasses (e.g. groups, - * clones), in turn, call this function in their bbox methods. + * clones), in turn, call this function in their bbox methods. * \retval bbox Note that there is no guarantee that bbox will contain a rectangle when the * function returns. If this item does not have a boundingbox, this might well be empty. */ @@ -792,7 +790,7 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c y = SP_FILTER(filter)->y.computed; if (SP_FILTER(filter)->width._set) w = SP_FILTER(filter)->width.computed; - if (SP_FILTER(filter)->height._set) + if (SP_FILTER(filter)->height._set) h = SP_FILTER(filter)->height.computed; double dx0 = 0; @@ -800,7 +798,7 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c double dy0 = 0; double dy1 = 0; if (filter_is_single_gaussian_blur(SP_FILTER(filter))) { - // if this is a single blur, use 2.4*radius + // if this is a single blur, use 2.4*radius // which may be smaller than the default area; // see set_filter_area for why it's 2.4 double r = get_single_gaussian_blur_radius (SP_FILTER(filter)); @@ -838,11 +836,11 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c } if (temp_bbox.x0 > temp_bbox.x1 || temp_bbox.y0 > temp_bbox.y1) { - // Either the bbox hasn't been touched by the SPItemClass' bbox method + // Either the bbox hasn't been touched by the SPItemClass' bbox method // (it still has its initial values, see above: x0 = y0 = NR_HUGE and x1 = y1 = -NR_HUGE) // or it has explicitely been set to be like this (e.g. in sp_shape_bbox) - - // When x0 > x1 or y0 > y1, the bbox is considered to be "nothing", although it has not been + + // When x0 > x1 or y0 > y1, the bbox is considered to be "nothing", although it has not been // explicitely defined this way for NRRects (as opposed to Geom::OptRect) // So union bbox with nothing = do nothing, just return return; @@ -937,15 +935,15 @@ Geom::OptRect sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type) return rect; } -static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs) +static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const */*snapprefs*/) { - /* This will only be called if the derived class doesn't override this. - * see for example sp_genericellipse_snappoints in sp-ellipse.cpp - * We don't know what shape we could be dealing with here, so we'll just - * return the corners of the bounding box */ + /* This will only be called if the derived class doesn't override this. + * see for example sp_genericellipse_snappoints in sp-ellipse.cpp + * We don't know what shape we could be dealing with here, so we'll just + * return the corners of the bounding box */ + + Geom::OptRect bbox = item->getBounds(sp_item_i2d_affine(item)); - Geom::OptRect bbox = item->getBounds(sp_item_i2d_affine(item)); - if (bbox) { Geom::Point p1, p2; p1 = bbox->min(); @@ -955,12 +953,12 @@ static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p, Ink *p = p2; *p = Geom::Point(p1[Geom::Y], p2[Geom::X]); } - + } void sp_item_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs) { - g_assert (item != NULL); + g_assert (item != NULL); g_assert (SP_IS_ITEM(item)); // Get the snappoints of the item @@ -971,32 +969,32 @@ void sp_item_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPref // Get the snappoints at the item's center if (snapprefs != NULL && snapprefs->getIncludeItemCenter()) { - *p = item->getCenter(); - } - + *p = item->getCenter(); + } + // Get the snappoints of clipping paths and mask, if any std::list clips_and_masks; - + clips_and_masks.push_back(SP_OBJECT(item->clip_ref->getObject())); clips_and_masks.push_back(SP_OBJECT(item->mask_ref->getObject())); - + for (std::list::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) { - if (SP_IS_ITEM(child)) { - std::vector p_clip_or_mask; - // Please note the recursive call here! - sp_item_snappoints(SP_ITEM(child), SnapPointsIter(p_clip_or_mask), snapprefs); - // Take into account the transformation of the item being clipped or masked - for (std::vector::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 - *p = (*p_orig) * matrix_to_desktop (matrix_from_desktop (item->transform, item), item); - } - } - } - } + if (*o) { + // obj is a group object, the children are the actual clippers + for (SPObject *child = (*o)->children ; child ; child = child->next) { + if (SP_IS_ITEM(child)) { + std::vector p_clip_or_mask; + // Please note the recursive call here! + sp_item_snappoints(SP_ITEM(child), SnapPointsIter(p_clip_or_mask), snapprefs); + // Take into account the transformation of the item being clipped or masked + for (std::vector::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 + *p = (*p_orig) * matrix_to_desktop (matrix_from_desktop (item->transform, item), item); + } + } + } + } } } @@ -1368,7 +1366,7 @@ sp_item_adjust_livepatheffect (SPItem *item, Geom::Matrix const &postmul, bool s if (new_lpeobj != lpeobj) { sp_lpe_item_replace_path_effect(lpeitem, lpeobj, new_lpeobj); } - + if (lpeobj->get_lpe()) { Inkscape::LivePathEffect::Effect * effect = lpeobj->get_lpe(); effect->transform_multiply(postmul, set); @@ -1735,7 +1733,7 @@ sp_item_convert_to_guides(SPItem *item) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getInt("/tools/bounding_box", 0); - SPItem::BBoxType bbox_type = (prefs_bbox ==0)? + SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; Geom::OptRect bbox = sp_item_bbox_desktop(item, bbox_type); diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index c568b44be..6030991e2 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -1,5 +1,3 @@ -#define __SP_RECT_C__ - /* * SVG implementation * @@ -546,15 +544,15 @@ sp_rect_get_visible_height(SPRect *rect) /** * Sets the snappoint p to the unrounded corners of the rectangle */ -static void sp_rect_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs) +static void sp_rect_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const */*snapprefs*/) { /* This method overrides sp_shape_snappoints, which is the default for any shape. The default method returns all eight points along the path of a rounded rectangle, but not the real corners. Snapping - the startpoint and endpoint of each rounded corner is not very usefull and really confusing. Instead + the startpoint and endpoint of each rounded corner is not very usefull and really confusing. Instead we could snap either the real corners, or not snap at all. Bulia Byak opted to snap the real corners, - but it should be noted that this might be confusing in some cases with relatively large radii. With + but it should be noted that this might be confusing in some cases with relatively large radii. With small radii though the user will easily understand which point is snapping. */ - + g_assert(item != NULL); g_assert(SP_IS_RECT(item)); diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 9266297be..8627e179f 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -407,7 +407,7 @@ sp_text_description(SPItem *item) SPStyle *style = SP_OBJECT_STYLE(text); font_instance *tf = font_factory::Default()->FaceFromStyle(style); - + char name_buf[256]; char *n; if (tf) { @@ -428,7 +428,7 @@ sp_text_description(SPItem *item) return ret; } -static void sp_text_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs) +static void sp_text_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const */*snapprefs*/) { // the baseline anchor of the first char Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item); -- 2.30.2