diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2015-10-28 20:43:30 +0000 |
|---|---|---|
| committer | Kris De Gussem <Kris.De.Gussem@hotmail.com> | 2015-10-28 20:43:30 +0000 |
| commit | 2e1f86061452fc6cad648a3370236bf2cb1f1a7d (patch) | |
| tree | 7f6e9e38f320ecc3d6347c131c5aca866f8b7c0b | |
| parent | typo (diff) | |
| download | inkscape-2e1f86061452fc6cad648a3370236bf2cb1f1a7d.tar.gz inkscape-2e1f86061452fc6cad648a3370236bf2cb1f1a7d.zip | |
static code analysis
(bzr r14432)
| -rw-r--r-- | src/conn-avoid-ref.cpp | 2 | ||||
| -rw-r--r-- | src/desktop-style.cpp | 36 | ||||
| -rw-r--r-- | src/display/canvas-text.cpp | 6 | ||||
| -rw-r--r-- | src/display/curve.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-taperstroke.cpp | 3 | ||||
| -rw-r--r-- | src/sp-filter.cpp | 2 | ||||
| -rw-r--r-- | src/uri.cpp | 2 | ||||
| -rw-r--r-- | src/uri.h | 2 | ||||
| -rw-r--r-- | src/widgets/sp-xmlview-attr-list.cpp | 2 |
9 files changed, 31 insertions, 26 deletions
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index ec9aba793..4c9665fa0 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -253,7 +253,7 @@ static std::vector<Geom::Point> approxItemWithPoints(SPItem const *item, const G SPGroup* group = SP_GROUP(item); // consider all first-order children std::vector<SPItem*> itemlist = sp_item_group_item_list(group); - for (std::vector<SPItem*>::const_iterator i = itemlist.begin(); i != itemlist.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = itemlist.begin(); i != itemlist.end(); ++i) { SPItem* child_item = *i; std::vector<Geom::Point> child_points = approxItemWithPoints(child_item, item_transform * child_item->transform); poly_points.insert(poly_points.end(), child_points.begin(), child_points.end()); diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 02c18339b..e66da90fb 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -195,7 +195,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write sp_css_attr_unset_uris(css_write); prefs->mergeStyle("/desktop/style", css_write); std::vector<SPItem*> const itemlist = desktop->selection->itemList(); - for (std::vector<SPItem*>::const_iterator i = itemlist.begin(); i!= itemlist.end(); i++) { + 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 = *i; Box3DSide *side = dynamic_cast<Box3DSide *>(obj); @@ -235,7 +235,7 @@ sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change, bool write css_no_text = sp_css_attr_unset_text(css_no_text); std::vector<SPItem*> const itemlist = desktop->selection->itemList(); - for (std::vector<SPItem*>::const_iterator i = itemlist.begin(); i!= itemlist.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = itemlist.begin(); i!= itemlist.end(); ++i) { SPItem *item = *i; // If not text, don't apply text attributes (can a group have text attributes? Yes! FIXME) @@ -447,7 +447,7 @@ stroke_average_width (const std::vector<SPItem*> &objects) gdouble avgwidth = 0.0; bool notstroked = true; int n_notstroked = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPItem *item = *i; if (!item) { continue; @@ -513,7 +513,7 @@ objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_re prev[0] = prev[1] = prev[2] = 0.0; bool same_color = true; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i!= objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i!= objects.end(); ++i) { SPObject *obj = *i; if (!obj) { continue; @@ -697,7 +697,7 @@ objects_query_opacity (const std::vector<SPItem*> &objects, SPStyle *style_res) guint opacity_items = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!obj) { continue; @@ -753,7 +753,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++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!obj) { continue; @@ -827,7 +827,7 @@ objects_query_miterlimit (const std::vector<SPItem*> &objects, SPStyle *style_re gdouble prev_ml = -1; bool same_ml = true; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!dynamic_cast<SPItem *>(obj)) { continue; @@ -886,7 +886,7 @@ objects_query_strokecap (const std::vector<SPItem*> &objects, SPStyle *style_res bool same_cap = true; int n_stroked = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!dynamic_cast<SPItem *>(obj)) { continue; @@ -940,7 +940,7 @@ objects_query_strokejoin (const std::vector<SPItem*> &objects, SPStyle *style_re bool same_join = true; int n_stroked = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!dynamic_cast<SPItem *>(obj)) { continue; @@ -1003,7 +1003,7 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r int texts = 0; int no_size = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!isTextualItem(obj)) { @@ -1122,7 +1122,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++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!isTextualItem(obj)) { @@ -1192,7 +1192,7 @@ objects_query_fontvariants (const std::vector<SPItem*> &objects, SPStyle *style_ caps_res->value = 0; numeric_res->value = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!isTextualItem(obj)) { @@ -1268,7 +1268,7 @@ objects_query_fontfeaturesettings (const std::vector<SPItem*> &objects, SPStyle } style_res->font_feature_settings.set = FALSE; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl; @@ -1336,7 +1336,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++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!isTextualItem(obj)) { @@ -1424,7 +1424,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++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl; @@ -1480,7 +1480,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++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; // std::cout << " " << reinterpret_cast<SPObject*>(i->data)->getId() << std::endl; @@ -1538,7 +1538,7 @@ objects_query_blend (const std::vector<SPItem*> &objects, SPStyle *style_res) bool same_blend = true; guint items = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!obj) { continue; @@ -1628,7 +1628,7 @@ objects_query_blur (const std::vector<SPItem*> &objects, SPStyle *style_res) guint blur_items = 0; guint items = 0; - for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); i++) { + for (std::vector<SPItem*>::const_iterator i = objects.begin(); i != objects.end(); ++i) { SPObject *obj = *i; if (!obj) { continue; diff --git a/src/display/canvas-text.cpp b/src/display/canvas-text.cpp index 5ad87b4ef..2c29fc207 100644 --- a/src/display/canvas-text.cpp +++ b/src/display/canvas-text.cpp @@ -266,10 +266,14 @@ sp_canvastext_set_coords (SPCanvasText *ct, gdouble x0, gdouble y0) void sp_canvastext_set_coords (SPCanvasText *ct, const Geom::Point start) { - Geom::Point pos = ct->desktop->doc2dt(start); + Geom::Point pos; g_return_if_fail (ct != NULL); g_return_if_fail (SP_IS_CANVASTEXT (ct)); + + if (ct && ct->desktop) { + pos = ct->desktop->doc2dt(start); + } if (DIFFER (pos[0], ct->s[Geom::X]) || DIFFER (pos[1], ct->s[Geom::Y])) { ct->s[Geom::X] = pos[0]; diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 3024d1276..b6c387034 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -496,7 +496,7 @@ SPCurve::append(SPCurve const *curve2, _pathv.push_back( (*it) ); } - for (it++; it != curve2->_pathv.end(); ++it) { + for (++it; it != curve2->_pathv.end(); ++it) { _pathv.push_back( (*it) ); } } else { diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp index ef616f802..f2ddd4929 100644 --- a/src/live_effects/lpe-taperstroke.cpp +++ b/src/live_effects/lpe-taperstroke.cpp @@ -408,9 +408,8 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path n = force_continuity(remove_short_cuts(n,.1)); int nbCopies = 0; - double scaling = 1; + double scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); nbCopies = 1; - scaling = (uskeleton.domain().extent() - toffset)/pattBndsX->extent(); double pattWidth = pattBndsX->extent() * scaling; diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 1bde69dd1..c17c67fc5 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -246,7 +246,7 @@ void SPFilter::update(SPCtx *ctx, guint flags) { } childflags &= SP_OBJECT_MODIFIED_CASCADE; std::vector<SPObject*> l(this->childList(true, SPObject::ActionUpdate)); - for(std::vector<SPObject*>::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector<SPObject*>::const_iterator i=l.begin();i!=l.end();++i){ SPObject *child = *i; if( SP_IS_FILTER_PRIMITIVE( child ) ) { child->updateDisplay(ctx, childflags); diff --git a/src/uri.cpp b/src/uri.cpp index 2eaf4ecc1..49bdab63c 100644 --- a/src/uri.cpp +++ b/src/uri.cpp @@ -148,7 +148,7 @@ gchar *URI::to_native_filename(gchar const* uri) throw(BadURIException) * Does not check if the returned path is the local document's path (local) * and thus redundent. Caller is expected to check against the document's path. */ -const std::string URI::getFullPath(std::string const base) const { +const std::string URI::getFullPath(std::string const &base) const { if (!_impl->getPath()) { return ""; } @@ -104,7 +104,7 @@ public: static char *to_native_filename(char const* uri) throw(BadURIException); - const std::string getFullPath(std::string const base) const; + const std::string getFullPath(std::string const &base) const; char *toNativeFilename() const throw(BadURIException); diff --git a/src/widgets/sp-xmlview-attr-list.cpp b/src/widgets/sp-xmlview-attr-list.cpp index dd763aea5..a4c00db7c 100644 --- a/src/widgets/sp-xmlview-attr-list.cpp +++ b/src/widgets/sp-xmlview-attr-list.cpp @@ -145,6 +145,7 @@ void sp_xmlview_attr_list_select_row_by_key(SPXMLViewAttrList * list, const gcha break; } valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(list->store), &iter); + // cppcheck-suppress nullPointer // a string was copied in n by gtk_tree_model_get if (n) { g_free(n); } @@ -181,6 +182,7 @@ event_attr_changed (Inkscape::XML::Node * /*repr*/, } row++; valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(list->store), &iter); + // cppcheck-suppress nullPointer // a string was copied in n by gtk_tree_model_get if (n) { g_free(n); } |
