diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2013-08-03 21:30:12 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2013-08-03 21:30:12 +0000 |
| commit | 013e92537296f6ba2434e29a96d18eeb353d9560 (patch) | |
| tree | 9d818c704a01cc7158ab3d59f1a741f27420a032 /src | |
| parent | rename variable for clarity (diff) | |
| download | inkscape-013e92537296f6ba2434e29a96d18eeb353d9560.tar.gz inkscape-013e92537296f6ba2434e29a96d18eeb353d9560.zip | |
reduce scope of variables
(bzr r12463)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ege-select-one-action.cpp | 3 | ||||
| -rw-r--r-- | src/lpe-tool-context.cpp | 18 | ||||
| -rw-r--r-- | src/marker.cpp | 6 | ||||
| -rw-r--r-- | src/measure-context.cpp | 1 | ||||
| -rw-r--r-- | src/object-snapper.cpp | 3 | ||||
| -rw-r--r-- | src/rdf.cpp | 3 |
6 files changed, 13 insertions, 21 deletions
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 871b961bd..184d1afb4 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -640,7 +640,6 @@ GtkWidget* create_tool_item( GtkAction* action ) #endif GtkRadioAction* ract = 0; - GtkWidget* sub = 0; GSList* group = 0; GtkTreeIter iter; gboolean valid = FALSE; @@ -727,7 +726,7 @@ GtkWidget* create_tool_item( GtkAction* action ) } g_signal_connect( G_OBJECT(ract), "changed", G_CALLBACK( proxy_action_chagned_cb ), act ); - sub = gtk_action_create_tool_item( GTK_ACTION(ract) ); + GtkWidget* sub = gtk_action_create_tool_item( GTK_ACTION(ract) ); gtk_activatable_set_related_action( GTK_ACTIVATABLE (sub), GTK_ACTION(ract) ); gtk_tool_item_set_tooltip_text( GTK_TOOL_ITEM(sub), tip ); diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index feabfa02d..e7393b97b 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -482,21 +482,19 @@ void lpetool_update_measuring_items(SPLPEToolContext *lc) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - SPPath *path; - SPCurve *curve; - double lengthval; - gchar *arc_length; - std::map<SPPath *, SPCanvasItem*>::iterator i; - for (i = lc->measuring_items->begin(); i != lc->measuring_items->end(); ++i) { - path = i->first; - curve = SP_SHAPE(path)->getCurve(); + for ( std::map<SPPath *, SPCanvasItem*>::iterator i = lc->measuring_items->begin(); + i != lc->measuring_items->end(); + ++i ) + { + SPPath *path = i->first; + SPCurve *curve = SP_SHAPE(path)->getCurve(); Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = Geom::paths_to_pw(curve->get_pathvector()); SPUnitId unitid = static_cast<SPUnitId>(prefs->getInt("/tools/lpetool/unitid", SP_UNIT_PX)); SPUnit unit = sp_unit_get_by_id(unitid); - lengthval = Geom::length(pwd2); + double lengthval = Geom::length(pwd2); gboolean success; success = sp_convert_distance(&lengthval, &sp_unit_get_by_id(SP_UNIT_PX), &unit); - arc_length = g_strdup_printf("%.2f %s", lengthval, success ? sp_unit_get_abbreviation(&unit) : "px"); + gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, success ? sp_unit_get_abbreviation(&unit) : "px"); sp_canvastext_set_text (SP_CANVASTEXT(i->second), arc_length); set_pos_and_anchor(SP_CANVASTEXT(i->second), pwd2, 0.5, 10); // TODO: must we free arc_length? diff --git a/src/marker.cpp b/src/marker.cpp index b3b493b00..057fcbfbd 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -536,7 +536,6 @@ void sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size) { SPMarkerView *view; - unsigned int i; for (view = marker->views; view != NULL; view = view->next) { if (view->key == key) break; @@ -551,7 +550,7 @@ sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size) if (!view) { view = new SPMarkerView(); view->items.clear(); - for (i = 0; i < size; i++) { + for (unsigned int i = 0; i < size; i++) { view->items.push_back(NULL); } view->next = marker->views; @@ -645,7 +644,6 @@ sp_marker_hide (SPMarker *marker, unsigned int key) static void sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destroyitems) { - unsigned int i; if (view == marker->views) { marker->views = view->next; } else { @@ -654,7 +652,7 @@ sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destro v->next = view->next; } if (destroyitems) { - for (i = 0; i < view->items.size(); i++) { + for (unsigned int i = 0; i < view->items.size(); i++) { /* We have to walk through the whole array because there may be hidden items */ delete view->items[i]; } diff --git a/src/measure-context.cpp b/src/measure-context.cpp index dc23cf5c6..771125b7f 100644 --- a/src/measure-context.cpp +++ b/src/measure-context.cpp @@ -494,7 +494,6 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv } curve->transform(item->i2doc_affine()); - Geom::PathVector pathv = curve->get_pathvector(); calculate_intersections(desktop, item, lineseg, curve, intersections); diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index e6f6d87db..77ba3040f 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -106,12 +106,11 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, if (it == NULL || i == it->end()) { SPItem *item = SP_ITEM(o); if (item) { - SPObject *obj = NULL; if (!clip_or_mask) { // cannot clip or mask more than once // The current item is not a clipping path or a mask, but might // still be the subject of clipping or masking itself ; if so, then // we should also consider that path or mask for snapping to - obj = SP_OBJECT(item->clip_ref ? item->clip_ref->getObject() : NULL); + SPObject *obj = SP_OBJECT(item->clip_ref ? item->clip_ref->getObject() : NULL); if (obj && _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH_CLIP)) { _findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine()); } diff --git a/src/rdf.cpp b/src/rdf.cpp index a6842c31d..16344e520 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -563,7 +563,6 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, int i; Inkscape::XML::Node * temp=NULL; - Inkscape::XML::Node * child=NULL; Inkscape::XML::Node * parent=repr; Inkscape::XML::Document * xmldoc = parent->document(); @@ -669,7 +668,7 @@ unsigned int RDFImpl::setReprText( Inkscape::XML::Node * repr, parent->appendChild(temp); Inkscape::GC::release(temp); - child = xmldoc->createTextNode( g_strstrip(str) ); + Inkscape::XML::Node * child = xmldoc->createTextNode( g_strstrip(str) ); g_return_val_if_fail (child != NULL, 0); temp->appendChild(child); |
