summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2019-10-05 12:19:04 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2019-10-05 12:19:04 +0000
commit67d61b662f9c7f8cd39ea78335efb709bade4549 (patch)
tree1df7203973194293cb2e338fed03094b746fd502 /src
parentMatch default for star tool and star toolbar (diff)
downloadinkscape-67d61b662f9c7f8cd39ea78335efb709bade4549.tar.gz
inkscape-67d61b662f9c7f8cd39ea78335efb709bade4549.zip
Fix various minor code problems
Diffstat (limited to 'src')
-rw-r--r--src/ege-color-prof-tracker.cpp2
-rw-r--r--src/extension/internal/wmf-print.cpp3
-rw-r--r--src/gradient-drag.cpp2
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp4
-rw-r--r--src/live_effects/lpe-offset.cpp2
-rw-r--r--src/live_effects/lpe-powerclip.cpp2
-rw-r--r--src/live_effects/lpe-powerstroke-interpolators.h2
-rw-r--r--src/object/sp-text.cpp11
-rw-r--r--src/ui/dialog/paint-servers.cpp2
-rw-r--r--src/ui/tools/pencil-tool.cpp2
-rw-r--r--src/widgets/sp-xmlview-tree.cpp4
11 files changed, 17 insertions, 19 deletions
diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp
index 853cc11c8..0b118f1a5 100644
--- a/src/ege-color-prof-tracker.cpp
+++ b/src/ege-color-prof-tracker.cpp
@@ -207,7 +207,7 @@ void ege_color_prof_tracker_get_profile( EgeColorProfTracker const * tracker, gp
guint dataLen = 0;
if (tracker) {
if (priv->_target ) {
- GdkScreen* screen = gtk_widget_get_screen(priv->_target);
+ //GdkScreen* screen = gtk_widget_get_screen(priv->_target);
if ( tracked_screen ) {
if ( priv->_monitor >= 0 && priv->_monitor < (static_cast<gint>(tracked_screen->profiles->len))) {
GByteArray* gba = static_cast<GByteArray*>(g_ptr_array_index(tracked_screen->profiles, priv->_monitor));
diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp
index 6b8bcf242..147a6369f 100644
--- a/src/extension/internal/wmf-print.cpp
+++ b/src/extension/internal/wmf-print.cpp
@@ -1372,7 +1372,8 @@ unsigned int PrintWmf::text(Inkscape::Extension::Print * /*mod*/, char const *te
double ky;
// the dx array is smuggled in like: text<nul>w1 w2 w3 ...wn<nul><nul>, where the widths are floats 7 characters wide, including the space
- int ndx, rtl;
+ int ndx = 0;
+ int rtl = 0;
int16_t *adx;
smuggle_adxky_out(text, &adx, &ky, &rtl, &ndx, PX2WORLD * std::min(tf.expansionX(), tf.expansionY())); // side effect: free() adx
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 47b032c2a..71ae65f50 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -1444,6 +1444,8 @@ GrDragger::moveMeshHandles ( Geom::Point pc_old, MeshNodeOperation op )
*/
void GrDragger::updateTip()
{
+ g_return_if_fail(this->knot != nullptr);
+
if (this->knot && this->knot->tip) {
g_free (this->knot->tip);
this->knot->tip = nullptr;
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 57b793993..7a21c2a2c 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -120,7 +120,6 @@ LPECopyRotate::doAfterEffect (SPLPEItem const* lpeitem)
}
items.clear();
container = dynamic_cast<SPObject *>(sp_lpe_item->parent);
- Inkscape::XML::Node *root = getSPDoc()->getReprRoot();
if (previous_num_copies != num_copies) {
gint numcopies_gap = previous_num_copies - num_copies;
if (numcopies_gap > 0 && num_copies != 0) {
@@ -209,7 +208,6 @@ LPECopyRotate::cloneD(SPObject *orig, SPObject *dest, Geom::Affine transform, bo
if (!document) {
return;
}
- Inkscape::XML::Document *xml_doc = document->getReprDoc();
if ( SP_IS_GROUP(orig) && SP_IS_GROUP(dest) && SP_GROUP(orig)->getItemCount() == SP_GROUP(dest)->getItemCount() ) {
if (reset) {
cloneStyle(orig, dest);
@@ -578,7 +576,7 @@ LPECopyRotate::doEffect_path_post (Geom::PathVector const & path_in)
if (method != RM_NORMAL) {
Geom::PathVector join_pv = original_pathv * t;
join_pv *= Geom::Translate(half_dir * rot * gap);
- Geom::PathIntersectionGraph *pig = new Geom::PathIntersectionGraph(output_pv, join_pv);
+ std::unique_ptr<Geom::PathIntersectionGraph> pig(new Geom::PathIntersectionGraph(output_pv, join_pv));
if (pig) {
if (!output_pv.empty()) {
output_pv = pig->getUnion();
diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp
index 72d29d0c1..bcaf15062 100644
--- a/src/live_effects/lpe-offset.cpp
+++ b/src/live_effects/lpe-offset.cpp
@@ -352,7 +352,7 @@ LPEOffset::doEffect_path(Geom::PathVector const & path_in)
if (offset > 0 &&
((original_width < against_dir_width &&
original_width < with_dir_width) ||
- (original_height < against_dir_width &&
+ (original_height < against_dir_height &&
original_height < with_dir_height)))
{
diff --git a/src/live_effects/lpe-powerclip.cpp b/src/live_effects/lpe-powerclip.cpp
index cb444149c..7e3f8edb7 100644
--- a/src/live_effects/lpe-powerclip.cpp
+++ b/src/live_effects/lpe-powerclip.cpp
@@ -111,6 +111,7 @@ LPEPowerClip::doBeforeEffect (SPLPEItem const* lpeitem){
if(!strcmp(is_inverse_str,"false") && inverse && isVisible()) {
SPCurve * clipcurve = new SPCurve();
addInverse(SP_ITEM(clip_data), clipcurve, Geom::Affine::identity(), true);
+ clipcurve->unref();
} else if((!strcmp(is_inverse_str,"true") && !inverse && isVisible()) ||
(inverse && !is_visible && is_inverse_str == (Glib::ustring)"true"))
{
@@ -335,7 +336,6 @@ LPEPowerClip::doOnVisibilityToggled(SPLPEItem const* lpeitem)
void
LPEPowerClip::flattenClip(SPItem * clip_data, Geom::PathVector &path_in)
{
- SPClipPath *clip_path = SP_ITEM(sp_lpe_item)->clip_ref->getObject();
if (SP_IS_GROUP(clip_data)) {
std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(clip_data));
for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) {
diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h
index 65bee9a63..940d97e4f 100644
--- a/src/live_effects/lpe-powerstroke-interpolators.h
+++ b/src/live_effects/lpe-powerstroke-interpolators.h
@@ -199,7 +199,7 @@ public:
Spiro::spiro_run(controlpoints, len, fit);
fit *= Scale(1,scale_y);
- delete controlpoints;
+ g_free(controlpoints);
return fit;
};
diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp
index 7786bf69c..0da5eccf4 100644
--- a/src/object/sp-text.cpp
+++ b/src/object/sp-text.cpp
@@ -392,7 +392,6 @@ void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
void SPText::hide_shape_inside()
{
SPText *text = dynamic_cast<SPText *>(this);
- SPObject *object = dynamic_cast<SPObject *>(this);
SPStyle *item_style = this->style;
if (item_style && text && item_style->shape_inside.set) {
SPCSSAttr *css_unset = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET);
@@ -408,7 +407,6 @@ void SPText::hide_shape_inside()
void SPText::show_shape_inside()
{
SPText *text = dynamic_cast<SPText *>(this);
- SPObject *object = dynamic_cast<SPObject *>(this);
if (text && css) {
this->changeCSS(css, "style");
}
@@ -569,7 +567,6 @@ void SPText::_buildLayoutInit()
copy->Copy(uncross);
}
layout.appendWrapShape( copy );
- //delete exclusion_shape;
continue;
}
@@ -584,6 +581,7 @@ void SPText::_buildLayoutInit()
}
}
}
+ delete exclusion_shape;
} else if (has_inline_size()) {
@@ -931,6 +929,9 @@ void SPText::_adjustCoordsRecursive(SPItem *item, Geom::Affine const &m, double
SP_TEXTPATH(item)->attributes.transform(m, ex, ex, is_root);
else if (SP_IS_TREF(item)) {
SP_TREF(item)->attributes.transform(m, ex, ex, is_root);
+ } else {
+ g_warning("element is not text");
+ return;
}
for(auto& o: item->children) {
@@ -970,7 +971,7 @@ Geom::OptRect SPText::get_frame()
if (has_inline_size()) {
double inline_size = style->inline_size.computed;
- unsigned mode = style->writing_mode.computed;
+ //unsigned mode = style->writing_mode.computed;
unsigned anchor = style->text_anchor.computed;
unsigned direction = style->direction.computed;
@@ -1099,8 +1100,6 @@ SPItem *create_text_with_inline_size (SPDesktop *desktop, Geom::Point p0, Geom::
text_object->updateRepr();
- SPCSSAttr* css = sp_repr_css_attr (text_repr, "style");
-
Inkscape::GC::release(text_repr);
Inkscape::GC::release(text_node);
diff --git a/src/ui/dialog/paint-servers.cpp b/src/ui/dialog/paint-servers.cpp
index b34eeb67a..d98403a38 100644
--- a/src/ui/dialog/paint-servers.cpp
+++ b/src/ui/dialog/paint-servers.cpp
@@ -196,6 +196,8 @@ Glib::ustring get_url(Glib::ustring paint)
void recurse_find_paint(SPObject* in, std::vector<Glib::ustring>& list)
{
+ g_return_if_fail(in != nullptr);
+
// Add paint servers in <defs> section.
if (dynamic_cast<SPPaintServer *>(in)) {
if (in->getId()) {
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index d7837c9c2..d3e226a84 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -733,7 +733,6 @@ void PencilTool::addPowerStrokePencil()
Geom::Affine transform_coordinate = SP_ITEM(SP_ACTIVE_DESKTOP->currentLayer())->i2dt_affine().inverse();
curvepressure->transform(transform_coordinate);
Geom::Path path = curvepressure->get_pathvector()[0];
- int original_size = path.size();
if (!path.empty()) {
Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *pp = nullptr;
@@ -936,7 +935,6 @@ void PencilTool::powerStrokeInterpolate(Geom::Path const path)
using Geom::X;
using Geom::Y;
- gint points_size = this->_wps.size();
gint path_size = path.size();
std::vector<Geom::Point> tmp_points;
Geom::Point previous = Geom::Point(Geom::infinity(), 0);
diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp
index fa8b6745e..5e3ba0859 100644
--- a/src/widgets/sp-xmlview-tree.cpp
+++ b/src/widgets/sp-xmlview-tree.cpp
@@ -313,19 +313,17 @@ void element_order_changed(Inkscape::XML::Node * /*repr*/, Inkscape::XML::Node *
Glib::ustring sp_remove_newlines_and_tabs(Glib::ustring val)
{
- int pos = 0;
+ int pos;
Glib::ustring newlinesign = "␤";
Glib::ustring tabsign = "⇥";
while ((pos = val.find("\r\n")) != std::string::npos) {
val.erase(pos, 2);
val.insert(pos, newlinesign);
}
- pos = 0;
while ((pos = val.find('\n')) != std::string::npos) {
val.erase(pos, 1);
val.insert(pos, newlinesign);
}
- pos = 0;
while ((pos = val.find('\t')) != std::string::npos) {
val.erase(pos, 1);
val.insert(pos, tabsign);