summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-08-04 13:19:52 +0000
committerMarkus Engel <markus.engel@tum.de>2013-08-04 13:19:52 +0000
commitc87f9bac5947a51cac43d3487c76aac005d81af8 (patch)
treee4ee49c51388a490fa9cf789df32f2a97ef49e58 /src
parentCleaned up once more. (diff)
parentcatch exception by reference (diff)
downloadinkscape-c87f9bac5947a51cac43d3487c76aac005d81af8.tar.gz
inkscape-c87f9bac5947a51cac43d3487c76aac005d81af8.zip
Merged from trunk (r12465).
(bzr r11608.1.119)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am13
-rw-r--r--src/Makefile_insert2
-rw-r--r--src/attributes-test.h15
-rw-r--r--src/color-profile.cpp2
-rw-r--r--src/ege-select-one-action.cpp3
-rw-r--r--src/extension/internal/pdfinput/svg-builder.cpp20
-rw-r--r--src/libcroco/cr-attr-sel.c5
-rw-r--r--src/libcroco/cr-om-parser.c43
-rw-r--r--src/libcroco/cr-parser.c5
-rw-r--r--src/libcroco/cr-prop-list.c2
-rw-r--r--src/libcroco/cr-simple-sel.c9
-rw-r--r--src/libcroco/cr-statement.c13
-rw-r--r--src/libcroco/cr-term.c7
-rw-r--r--src/libgdl/gdl-switcher.c97
-rw-r--r--src/livarot/Path.cpp16
-rw-r--r--src/livarot/PathConversion.cpp21
-rw-r--r--src/livarot/PathCutting.cpp6
-rw-r--r--src/livarot/PathOutline.cpp3
-rw-r--r--src/livarot/Shape.cpp14
-rw-r--r--src/livarot/ShapeRaster.cpp6
-rw-r--r--src/livarot/ShapeSweep.cpp6
-rw-r--r--src/lpe-tool-context.cpp18
-rw-r--r--src/marker.cpp6
-rw-r--r--src/measure-context.cpp1
-rw-r--r--src/object-snapper.cpp3
-rw-r--r--src/rdf.cpp3
-rw-r--r--src/selection-describer.cpp3
-rw-r--r--src/selection.cpp6
-rw-r--r--src/shape-editor.cpp4
-rw-r--r--src/sp-lpe-item.cpp2
-rw-r--r--src/style.cpp10
-rw-r--r--src/syseq.h2
-rw-r--r--src/trace/pool.h18
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp6
-rw-r--r--src/ui/widget/registered-widget.h1
-rw-r--r--src/widgets/desktop-widget.h1
36 files changed, 212 insertions, 180 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index cff9ac69f..44175af26 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -247,7 +247,18 @@ check_PROGRAMS = cxxtests
# List of all tests to be run.
TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests
-XFAIL_TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests
+
+# FIXME: Currently, a number of cxxtest tests fail. These should be fixed and
+# the XFAIL_TESTS build target should be removed.
+# See the following Launchpad bugs:
+#
+# LP #1202271 <cxxtest: preferences-test.h fails>
+# LP #1208013 <cxxtest: curve-test.h fails>
+# LP #1208002 <cxxtest: svg-length-test.h fails>
+# LP #1208005 <cxxtest: svg-path-geom-test.h fails>
+# LP #1207502 <cxxtest: svg-affine-test.h fails>
+
+XFAIL_TESTS = $(check_PROGRAMS)
# including the the testsuites here ensures that they get distributed
cxxtests_SOURCES = cxxtests.cpp $(CXXTEST_TESTSUITES)
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 0fa7069ef..b3a66111a 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -281,8 +281,8 @@ CXXTEST_TESTSUITES += \
$(srcdir)/extract-uri-test.h \
$(srcdir)/marker-test.h \
$(srcdir)/mod360-test.h \
+ $(srcdir)/preferences-test.h \
$(srcdir)/round-test.h \
- $(srcdir)/preferences-test.h \
$(srcdir)/sp-gradient-test.h \
$(srcdir)/sp-style-elem-test.h \
$(srcdir)/style-test.h \
diff --git a/src/attributes-test.h b/src/attributes-test.h
index 78e0ea48f..295ad618c 100644
--- a/src/attributes-test.h
+++ b/src/attributes-test.h
@@ -214,7 +214,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"overline-position", true},
{"overline-thickness", true},
{"panose-1", true},
- {"path", false},
+ {"path", true},
{"pathLength", false},
{"patternContentUnits", true},
{"patternTransform", true},
@@ -354,7 +354,6 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"inkscape:snap-bbox", true},
{"inkscape:snap-nodes", true},
{"inkscape:snap-others", true},
- {"inkscape:snap-from-guide", true},
{"inkscape:snap-center", true},
{"inkscape:snap-smooth-nodes", true},
{"inkscape:snap-midpoints", true},
@@ -383,6 +382,9 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"inkscape:connector-type", true},
{"inkscape:connection-start", true},
{"inkscape:connection-end", true},
+ {"inkscape:connection-points", true},
+ {"inkscape:connection-start-point", true},
+ {"inkscape:connection-end-point", true},
{"inkscape:connector-curvature", true},
{"inkscape:connector-avoid", true},
{"inkscape:connector-spacing", true},
@@ -429,8 +431,17 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
{"inkscape:dstColumn", true},
{"inkscape:excludeShape", true},
{"inkscape:layoutOptions", true},
+ {"osb:paint", true},
+
+ /* SPMeshPatch */
+ {"tensor", true},
/* SPNamedView */
+ {"fit-margin-top", true},
+ {"fit-margin-left", true},
+ {"fit-margin-right", true},
+ {"fit-margin-bottom", true},
+ {"units", true},
{"viewonly", true},
{"showgrid", true},
// {"gridtype", true},
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 61442b11a..e8a6a9c98 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -4,8 +4,8 @@
#define noDEBUG_LCMS
-#include <glibmm/checksum.h>
#include <gdkmm/color.h>
+#include <glibmm/checksum.h>
#include <glib/gstdio.h>
#include <fcntl.h>
#include <glib/gi18n.h>
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/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 75849f6cc..165dd38fe 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -676,7 +676,25 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern,
Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern");
// Set pattern transform matrix
double *p2u = tiling_pattern->getMatrix();
- Geom::Affine pat_matrix(p2u[0], p2u[1], p2u[2], p2u[3], p2u[4], p2u[5]);
+ double m[6] = {1, 0, 0, 1, 0, 0};
+ double det;
+ det = ttm[0] * ttm[3] - ttm[1] * ttm[2]; // see LP Bug 1168908
+ if (det) {
+ double ittm[6]; // invert ttm
+ ittm[0] = ttm[3] / det;
+ ittm[1] = -ttm[1] / det;
+ ittm[2] = -ttm[2] / det;
+ ittm[3] = ttm[0] / det;
+ ittm[4] = (ttm[2] * ttm[5] - ttm[3] * ttm[4]) / det;
+ ittm[5] = (ttm[1] * ttm[4] - ttm[0] * ttm[5]) / det;
+ m[0] = p2u[0] * ittm[0] + p2u[1] * ittm[2];
+ m[1] = p2u[0] * ittm[1] + p2u[1] * ittm[3];
+ m[2] = p2u[2] * ittm[0] + p2u[3] * ittm[2];
+ m[3] = p2u[2] * ittm[1] + p2u[3] * ittm[3];
+ m[4] = p2u[4] * ittm[0] + p2u[5] * ittm[2] + ittm[4];
+ m[5] = p2u[4] * ittm[1] + p2u[5] * ittm[3] + ittm[5];
+ }
+ Geom::Affine pat_matrix(m[0], m[1], m[2], m[3], m[4], m[5]);
gchar *transform_text = sp_svg_transform_write(pat_matrix);
pattern_node->setAttribute("patternTransform", transform_text);
g_free(transform_text);
diff --git a/src/libcroco/cr-attr-sel.c b/src/libcroco/cr-attr-sel.c
index 3c4800e66..0726f0f3e 100644
--- a/src/libcroco/cr-attr-sel.c
+++ b/src/libcroco/cr-attr-sel.c
@@ -208,8 +208,5 @@ cr_attr_sel_destroy (CRAttrSel * a_this)
a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL;
- }
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-om-parser.c b/src/libcroco/cr-om-parser.c
index b8d70e35a..c9ce032af 100644
--- a/src/libcroco/cr-om-parser.c
+++ b/src/libcroco/cr-om-parser.c
@@ -217,9 +217,9 @@ start_font_face (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt == NULL);
@@ -316,9 +316,9 @@ charset (CRDocHandler * a_this, CRString * a_charset,
ParsingContext **ctxtptr = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
@@ -352,9 +352,9 @@ start_page (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt == NULL);
@@ -395,8 +395,11 @@ end_page (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
CRStatement *stmt = NULL;
+ UNUSED(a_page);
+ UNUSED(a_pseudo_page);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt
@@ -416,8 +419,6 @@ end_page (CRDocHandler * a_this,
cr_statement_destroy (ctxt->cur_stmt);
ctxt->cur_stmt = NULL;
}
- a_page = NULL; /*keep compiler happy */
- a_pseudo_page = NULL; /*keep compiler happy */
}
static void
@@ -431,9 +432,9 @@ start_media (CRDocHandler * a_this,
GList *media_list = NULL;
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
@@ -443,12 +444,10 @@ start_media (CRDocHandler * a_this,
&& ctxt->stylesheet);
if (a_media_list) {
/*duplicate the media_list */
- media_list = cr_utils_dup_glist_of_cr_string
- (a_media_list);
+ media_list = cr_utils_dup_glist_of_cr_string(a_media_list);
}
ctxt->cur_media_stmt =
- cr_statement_new_at_media_rule
- (ctxt->stylesheet, NULL, media_list);
+ cr_statement_new_at_media_rule(ctxt->stylesheet, NULL, media_list);
}
@@ -460,8 +459,10 @@ end_media (CRDocHandler * a_this, GList * a_media_list)
ParsingContext **ctxtptr = NULL;
CRStatement *stmts = NULL;
+ UNUSED(a_media_list);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt
@@ -481,7 +482,6 @@ end_media (CRDocHandler * a_this, GList * a_media_list)
ctxt->cur_stmt = NULL ;
ctxt->cur_media_stmt = NULL ;
- a_media_list = NULL;
}
static void
@@ -499,10 +499,11 @@ import_style (CRDocHandler * a_this,
ParsingContext **ctxtptr = NULL;
GList *media_list = NULL ;
+ UNUSED(a_uri_default_ns);
UNUSED(a_location);
-
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->stylesheet);
@@ -574,8 +575,10 @@ end_selector (CRDocHandler * a_this, CRSelector * a_selector_list)
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
+ UNUSED(a_selector_list);
g_return_if_fail (a_this);
- ctxtptr = &ctxt;
+
+ ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
g_return_if_fail (status == CR_OK && ctxt);
g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet);
diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c
index a8e2de5a3..917c5cb60 100644
--- a/src/libcroco/cr-parser.c
+++ b/src/libcroco/cr-parser.c
@@ -4402,8 +4402,5 @@ cr_parser_destroy (CRParser * a_this)
PRIVATE (a_this) = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL; /*useless. Just for the sake of coherence */
- }
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-prop-list.c b/src/libcroco/cr-prop-list.c
index 076837905..551f0b8ee 100644
--- a/src/libcroco/cr-prop-list.c
+++ b/src/libcroco/cr-prop-list.c
@@ -48,7 +48,7 @@ cr_prop_list_allocate (void)
}
memset (result, 0, sizeof (CRPropList));
PRIVATE (result) = (CRPropListPriv *)g_try_malloc (sizeof (CRPropListPriv));
- if (!result) {
+ if (!PRIVATE (result)) {
cr_utils_trace_info ("could not allocate CRPropListPriv");
g_free (result);
return NULL;
diff --git a/src/libcroco/cr-simple-sel.c b/src/libcroco/cr-simple-sel.c
index 18dd340d8..6a51a9526 100644
--- a/src/libcroco/cr-simple-sel.c
+++ b/src/libcroco/cr-simple-sel.c
@@ -275,12 +275,12 @@ cr_simple_sel_compute_specificity (CRSimpleSel * a_this)
/**
*The destructor of the current instance of
- *#CRSimpleSel.
+ *#CRSimpleSel. Recursively calls the destructor of #CRSimpleSel->next
*@param a_this the this pointer of the current instance of #CRSimpleSel.
*
*/
void
-cr_simple_sel_destroy (CRSimpleSel * a_this)
+cr_simple_sel_destroy (CRSimpleSel * const a_this)
{
g_return_if_fail (a_this);
@@ -296,9 +296,8 @@ cr_simple_sel_destroy (CRSimpleSel * a_this)
if (a_this->next) {
cr_simple_sel_destroy (a_this->next);
+ a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- }
+ g_free (a_this);
}
diff --git a/src/libcroco/cr-statement.c b/src/libcroco/cr-statement.c
index 40df49878..2b2c1836c 100644
--- a/src/libcroco/cr-statement.c
+++ b/src/libcroco/cr-statement.c
@@ -604,7 +604,10 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
g_return_val_if_fail (a_this && a_this->type == RULESET_STMT, NULL);
- GString *stringue = (GString *)g_string_new (NULL);
+ GString * stringue = (GString *)g_string_new (NULL);
+ if (!stringue) {
+ return result;
+ }
if (a_this->kind.ruleset->sel_list) {
if (a_indent)
@@ -635,10 +638,9 @@ cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
g_string_append (stringue, "}");
result = stringue->str;
- if (stringue) {
- g_string_free (stringue, FALSE);
- stringue = NULL;
- }
+ g_string_free (stringue, FALSE);
+ stringue = NULL;
+
if (tmp_str) {
g_free (tmp_str);
tmp_str = NULL;
@@ -1377,7 +1379,6 @@ cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
}
if (media_list) {
GList *cur = NULL;
-
for (cur = media_list; media_list;
media_list = g_list_next (media_list)) {
if (media_list->data) {
diff --git a/src/libcroco/cr-term.c b/src/libcroco/cr-term.c
index d95c4979f..635577334 100644
--- a/src/libcroco/cr-term.c
+++ b/src/libcroco/cr-term.c
@@ -771,7 +771,7 @@ cr_term_unref (CRTerm * a_this)
*of #CRTerm.
*/
void
-cr_term_destroy (CRTerm * a_this)
+cr_term_destroy (CRTerm * const a_this)
{
g_return_if_fail (a_this);
@@ -782,8 +782,5 @@ cr_term_destroy (CRTerm * a_this)
a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- }
-
+ g_free (a_this);
}
diff --git a/src/libgdl/gdl-switcher.c b/src/libgdl/gdl-switcher.c
index 60d53dd5f..daacebf20 100644
--- a/src/libgdl/gdl-switcher.c
+++ b/src/libgdl/gdl-switcher.c
@@ -370,62 +370,65 @@ layout_buttons (GdlSwitcher *switcher)
if (last_buttons_height > switcher->priv->buttons_height_request)
{
gtk_widget_queue_resize (GTK_WIDGET (switcher));
- return -1;
+ y = -1; // set return value
}
-
- /* Layout the buttons. */
- for (i = row_last; i >= 0; i --) {
- int len, extra_width;
-
- y -= max_btn_height;
-
- /* Check for possible size over flow (taking into account client
- * requisition
- */
- if (y < (allocation.y + client_requisition.height)) {
- /* We have an overflow: Insufficient allocation */
- if (last_buttons_height < switcher->priv->buttons_height_request) {
- /* Request for a new resize */
- gtk_widget_queue_resize (GTK_WIDGET (switcher));
- return -1;
- }
- }
- x = H_PADDING + allocation.x;
- len = g_slist_length (rows[i]);
- if (switcher_style == GDL_SWITCHER_STYLE_TEXT ||
- switcher_style == GDL_SWITCHER_STYLE_BOTH)
- extra_width = (allocation.width - (len * max_btn_width )
- - (len * H_PADDING)) / len;
- else
- extra_width = 0;
- for (p = rows [i]; p != NULL; p = p->next) {
- GtkAllocation child_allocation;
+ else
+ {
+ /* Layout the buttons. */
+ for (i = row_last; i >= 0; i --) {
+ int len, extra_width;
- child_allocation.x = x;
- child_allocation.y = y;
- if (rows_count == 1 && row_number == 0)
- {
- GtkRequisition child_requisition;
- gtk_widget_size_request (GTK_WIDGET (p->data),
- &child_requisition);
- child_allocation.width = child_requisition.width;
+ y -= max_btn_height;
+
+ /* Check for possible size over flow (taking into account client
+ * requisition
+ */
+ if (y < (allocation.y + client_requisition.height)) {
+ /* We have an overflow: Insufficient allocation */
+ if (last_buttons_height < switcher->priv->buttons_height_request) {
+ /* Request for a new resize */
+ gtk_widget_queue_resize (GTK_WIDGET (switcher));
+ return -1;
+ }
}
+ x = H_PADDING + allocation.x;
+ len = g_slist_length (rows[i]);
+ if (switcher_style == GDL_SWITCHER_STYLE_TEXT ||
+ switcher_style == GDL_SWITCHER_STYLE_BOTH)
+ extra_width = (allocation.width - (len * max_btn_width )
+ - (len * H_PADDING)) / len;
else
- {
- child_allocation.width = max_btn_width + extra_width;
+ extra_width = 0;
+ for (p = rows [i]; p != NULL; p = p->next) {
+ GtkAllocation child_allocation;
+
+ child_allocation.x = x;
+ child_allocation.y = y;
+ if (rows_count == 1 && row_number == 0)
+ {
+ GtkRequisition child_requisition;
+ gtk_widget_size_request (GTK_WIDGET (p->data),
+ &child_requisition);
+ child_allocation.width = child_requisition.width;
+ }
+ else
+ {
+ child_allocation.width = max_btn_width + extra_width;
+ }
+ child_allocation.height = max_btn_height;
+
+ gtk_widget_size_allocate (GTK_WIDGET (p->data), &child_allocation);
+
+ x += child_allocation.width + H_PADDING;
}
- child_allocation.height = max_btn_height;
-
- gtk_widget_size_allocate (GTK_WIDGET (p->data), &child_allocation);
- x += child_allocation.width + H_PADDING;
+ y -= V_PADDING;
}
-
- y -= V_PADDING;
}
-
- for (i = 0; i <= row_last; i ++)
+
+ for (i = 0; i <= row_last; i ++) {
g_slist_free (rows [i]);
+ }
g_free (rows);
return y;
diff --git a/src/livarot/Path.cpp b/src/livarot/Path.cpp
index 88d397864..68891e4aa 100644
--- a/src/livarot/Path.cpp
+++ b/src/livarot/Path.cpp
@@ -28,7 +28,7 @@ Path::Path()
Path::~Path()
{
- for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); i++) {
+ for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); ++i) {
delete *i;
}
}
@@ -37,7 +37,7 @@ Path::~Path()
void Path::Affiche()
{
std::cout << "path: " << descr_cmd.size() << " commands." << std::endl;
- for (std::vector<PathDescr*>::const_iterator i = descr_cmd.begin(); i != descr_cmd.end(); i++) {
+ for (std::vector<PathDescr*>::const_iterator i = descr_cmd.begin(); i != descr_cmd.end(); ++i) {
(*i)->dump(std::cout);
std::cout << std::endl;
}
@@ -47,7 +47,7 @@ void Path::Affiche()
void Path::Reset()
{
- for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); i++) {
+ for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); ++i) {
delete *i;
}
@@ -61,7 +61,7 @@ void Path::Copy(Path * who)
{
ResetPoints();
- for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); i++) {
+ for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); ++i) {
delete *i;
}
@@ -69,7 +69,7 @@ void Path::Copy(Path * who)
for (std::vector<PathDescr*>::const_iterator i = who->descr_cmd.begin();
i != who->descr_cmd.end();
- i++)
+ ++i)
{
descr_cmd.push_back((*i)->clone());
}
@@ -496,9 +496,9 @@ void Path::PolylineBoundingBox(double &l, double &t, double &r, double &b)
std::vector<path_lineto>::const_iterator i = pts.begin();
l = r = i->p[Geom::X];
t = b = i->p[Geom::Y];
- i++;
+ ++i;
- for (; i != pts.end(); i++) {
+ for (; i != pts.end(); ++i) {
r = std::max(r, i->p[Geom::X]);
l = std::min(l, i->p[Geom::X]);
b = std::max(b, i->p[Geom::Y]);
@@ -701,7 +701,7 @@ void Path::PointAndTangentAt(int piece, double at, Geom::Point &pos, Geom::Point
void Path::Transform(const Geom::Affine &trans)
{
- for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); i++) {
+ for (std::vector<PathDescr*>::iterator i = descr_cmd.begin(); i != descr_cmd.end(); ++i) {
(*i)->transform(trans);
}
}
diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp
index ed5f03f80..8d36dca4c 100644
--- a/src/livarot/PathConversion.cpp
+++ b/src/livarot/PathConversion.cpp
@@ -119,15 +119,12 @@ void Path::ConvertWithBackData(double treshhold)
if ( nbInterm >= 1 ) {
Geom::Point bx = curX;
- Geom::Point cx = curX;
- Geom::Point dx = curX;
+ Geom::Point dx = nData->p;
+ Geom::Point cx = 2 * bx - dx;
- dx = nData->p;
ip++;
nData = dynamic_cast<PathDescrIntermBezierTo *>(descr_cmd[ip]);
- cx = 2 * bx - dx;
-
for (int k = 0; k < nbInterm - 1; k++) {
bx = cx;
cx = dx;
@@ -323,15 +320,12 @@ void Path::Convert(double treshhold)
RecBezierTo(midX, curX, nextX, treshhold, 8);
} else if ( nbInterm > 1 ) {
Geom::Point bx = curX;
- Geom::Point cx = curX;
- Geom::Point dx = curX;
+ Geom::Point dx = nData->p;
+ Geom::Point cx = 2 * bx - dx;
- dx = nData->p;
ip++;
nData = dynamic_cast<PathDescrIntermBezierTo *>(descr_cmd[ip]);
- cx = 2 * bx - dx;
-
for (int k = 0; k < nbInterm - 1; k++) {
bx = cx;
cx = dx;
@@ -565,15 +559,12 @@ void Path::ConvertEvenLines(double treshhold)
RecBezierTo(midX, curX, nextX, treshhold, 8, 4 * treshhold);
} else if ( nbInterm > 1 ) {
Geom::Point bx = curX;
- Geom::Point cx = curX;
- Geom::Point dx = curX;
+ Geom::Point dx = nData->p;
+ Geom::Point cx = 2 * bx - dx;
- dx = nData->p;
ip++;
nData = dynamic_cast<PathDescrIntermBezierTo *>(descr_cmd[ip]);
- cx = 2 * bx - dx;
-
for (int k = 0; k < nbInterm - 1; k++) {
bx = cx;
cx = dx;
diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp
index 848d8daa8..3ce907bf3 100644
--- a/src/livarot/PathCutting.cpp
+++ b/src/livarot/PathCutting.cpp
@@ -482,7 +482,7 @@ double Path::Length()
Geom::Point lastP = pts[0].p;
double len = 0;
- for (std::vector<path_lineto>::const_iterator i = pts.begin(); i != pts.end(); i++) {
+ for (std::vector<path_lineto>::const_iterator i = pts.begin(); i != pts.end(); ++i) {
if ( i->isMoveTo != polyline_moveto ) {
len += Geom::L2(i->p - lastP);
@@ -505,7 +505,7 @@ double Path::Surface()
Geom::Point lastP = lastM;
double surf = 0;
- for (std::vector<path_lineto>::const_iterator i = pts.begin(); i != pts.end(); i++) {
+ for (std::vector<path_lineto>::const_iterator i = pts.begin(); i != pts.end(); ++i) {
if ( i->isMoveTo == polyline_moveto ) {
surf += Geom::cross(lastM - lastP, lastM);
@@ -900,7 +900,7 @@ Path::cut_position* Path::CurvilignToPosition(int nbCv, double *cvAbs, int &nbCu
Geom::Point lastM = pts[0].p;
Geom::Point lastP = lastM;
- for (std::vector<path_lineto>::const_iterator i = pts.begin(); i != pts.end(); i++) {
+ for (std::vector<path_lineto>::const_iterator i = pts.begin(); i != pts.end(); ++i) {
if ( i->isMoveTo == polyline_moveto ) {
diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp
index 7f8853e31..3b5ce79f9 100644
--- a/src/livarot/PathOutline.cpp
+++ b/src/livarot/PathOutline.cpp
@@ -709,9 +709,8 @@ void Path::SubContractOutline(int off, int num_pd,
} else if (nbInterm > 1) {
Geom::Point bx=curX;
Geom::Point cx=curX;
- Geom::Point dx=curX;
+ Geom::Point dx=nData->p;
- dx = nData->p;
TangentOnBezAt (0.0, curX, *nData, *nBData, false, stPos, stTgt, stTle, stRad);
stNor=stTgt.cw();
diff --git a/src/livarot/Shape.cpp b/src/livarot/Shape.cpp
index c29444a33..628e0fe9f 100644
--- a/src/livarot/Shape.cpp
+++ b/src/livarot/Shape.cpp
@@ -20,7 +20,12 @@
*/
Shape::Shape()
- : qrsData(NULL),
+ : nbQRas(0),
+ firstQRas(-1),
+ lastQRas(-1),
+ qrsData(NULL),
+ nbInc(0),
+ maxInc(0),
iData(NULL),
sTree(NULL),
sEvts(NULL),
@@ -130,7 +135,12 @@ Shape::MakeQuickRasterData (bool nVal)
if (_has_quick_raster_data == false)
{
_has_quick_raster_data = true;
- qrsData = (quick_raster_data*)realloc(qrsData, maxAr * sizeof(quick_raster_data));
+ quick_raster_data* new_qrsData = static_cast<quick_raster_data*>(realloc(qrsData, maxAr * sizeof(quick_raster_data)));
+ if (!new_qrsData) {
+ g_error("Not enough memory available for reallocating Shape::qrsData");
+ } else {
+ qrsData = new_qrsData;
+ }
}
}
else
diff --git a/src/livarot/ShapeRaster.cpp b/src/livarot/ShapeRaster.cpp
index b7b087fba..4c5bdc1ac 100644
--- a/src/livarot/ShapeRaster.cpp
+++ b/src/livarot/ShapeRaster.cpp
@@ -1131,8 +1131,7 @@ void Shape::Scan(float &pos, int &curP, float to, AlphaLigne *line, bool exact,
int curPt = curP;
while ( curPt < numberOfPoints() && getPoint(curPt).x[1] <= to ) {
- int nPt = -1;
- nPt = curPt++;
+ int nPt = curPt++;
int nbUp;
int nbDn;
@@ -1435,8 +1434,7 @@ void Shape::QuickScan(float &pos, int &curP, float to, FillRule directed, BitLig
int curPt = curP;
while ( curPt < numberOfPoints() && getPoint(curPt).x[1] <= to ) {
- int nPt = -1;
- nPt = curPt++;
+ int nPt = curPt++;
int nbUp;
int nbDn;
diff --git a/src/livarot/ShapeSweep.cpp b/src/livarot/ShapeSweep.cpp
index c2fd83e31..ff58b4a71 100644
--- a/src/livarot/ShapeSweep.cpp
+++ b/src/livarot/ShapeSweep.cpp
@@ -252,8 +252,7 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert)
Geom::Point rPtX;
rPtX[0]= Round (ptX[0]);
rPtX[1]= Round (ptX[1]);
- int lastPointNo = -1;
- lastPointNo = AddPoint (rPtX);
+ int lastPointNo = AddPoint (rPtX);
pData[lastPointNo].rx = rPtX;
if (rPtX[1] > lastChange)
@@ -1053,8 +1052,7 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID)
Geom::Point rPtX;
rPtX[0]= Round (ptX[0]);
rPtX[1]= Round (ptX[1]);
- int lastPointNo = -1;
- lastPointNo = AddPoint (rPtX);
+ int lastPointNo = AddPoint (rPtX);
pData[lastPointNo].rx = rPtX;
if (rPtX[1] > lastChange)
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index 0ae5058d7..f0846b306 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -443,21 +443,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 518895a57..730985b01 100644
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -571,7 +571,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;
@@ -587,7 +586,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;
@@ -681,7 +680,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 {
@@ -690,7 +688,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 9ee728bc8..031dbe800 100644
--- a/src/measure-context.cpp
+++ b/src/measure-context.cpp
@@ -484,7 +484,6 @@ bool SPMeasureContext::root_handler(GdkEvent* event) {
}
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);
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp
index 1490bc6a6..4c2229667 100644
--- a/src/selection-describer.cpp
+++ b/src/selection-describer.cpp
@@ -102,9 +102,8 @@ static GSList *collect_terms (GSList *items)
static int count_filtered (GSList *items)
{
int count=0;
- SPItem *item=NULL;
for (GSList *i = items; i != NULL; i = i->next) {
- item = SP_ITEM(i->data);
+ SPItem *item = SP_ITEM(i->data);
count += item->ifilt();
}
return count;
diff --git a/src/selection.cpp b/src/selection.cpp
index 784219c88..1335c5fca 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -329,11 +329,11 @@ std::list<Persp3D *> const Selection::perspList() {
std::list<SPBox3D *> const Selection::box3DList(Persp3D *persp) {
std::list<SPBox3D *> boxes;
if (persp) {
- SPBox3D *box;
for (std::list<SPBox3D *>::iterator i = _3dboxes.begin(); i != _3dboxes.end(); ++i) {
- box = *i;
- if (persp == box3d_get_perspective(box))
+ SPBox3D *box = *i;
+ if (persp == box3d_get_perspective(box)) {
boxes.push_back(box);
+ }
}
} else {
boxes = _3dboxes;
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index f2339770c..71018d89b 100644
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
@@ -46,15 +46,13 @@ ShapeEditor::~ShapeEditor() {
}
void ShapeEditor::unset_item(SubType type, bool keep_knotholder) {
- Inkscape::XML::Node *old_repr = NULL;
-
switch (type) {
case SH_NODEPATH:
// defunct
break;
case SH_KNOTHOLDER:
if (this->knotholder) {
- old_repr = this->knotholder->repr;
+ Inkscape::XML::Node *old_repr = this->knotholder->repr;
if (old_repr && old_repr == knotholder_listener_attached_for) {
sp_repr_remove_listener_by_data(old_repr, this);
Inkscape::GC::release(old_repr);
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index fa5930570..c86730048 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -133,7 +133,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
try {
path_effect_ref->link(href.c_str());
- } catch (Inkscape::BadURIException& e) {
+ } catch (Inkscape::BadURIException &e) {
g_warning("BadURIException when trying to find LPE: %s", e.what());
path_effect_ref->unlink();
delete path_effect_ref;
diff --git a/src/style.cpp b/src/style.cpp
index 479f30597..a9861f918 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -2945,14 +2945,19 @@ sp_style_clear(SPStyle *style)
style->stroke.clear();
sp_style_filter_clear(style);
+ style->release_connection.disconnect();
+
+ style->fill_ps_modified_connection.disconnect();
if (style->fill.value.href) {
delete style->fill.value.href;
style->fill.value.href = NULL;
}
+ style->stroke_ps_modified_connection.disconnect();
if (style->stroke.value.href) {
delete style->stroke.value.href;
style->stroke.value.href = NULL;
}
+ style->filter_modified_connection.disconnect();
if (style->filter.href) {
delete style->filter.href;
style->filter.href = NULL;
@@ -2972,8 +2977,9 @@ sp_style_clear(SPStyle *style)
SPTextStyle *text = style->text;
unsigned const text_private = style->text_private;
- memset(style, 0, sizeof(SPStyle));
-
+ // this looks really bad! you can't just 0 *all* data in the whole struct!
+ // memset(style, 0, sizeof(SPStyle));
+
style->refcount = refcount;
style->object = object;
style->document = document;
diff --git a/src/syseq.h b/src/syseq.h
index 029f27a91..4e7ccd943 100644
--- a/src/syseq.h
+++ b/src/syseq.h
@@ -289,7 +289,7 @@ template <int S, int T> SolutionKind gaussjord_solve (double A[S][T], double x[T
* afterwards copy the result back to x
*/
double w[S];
- SysEq::multiply<S,T>(B,x,w);
+ SysEq::multiply<S,T>(B,x,w); // initializes w
for (int j = 0; j < S; ++j) {
x[cols[j]] = w[j];
}
diff --git a/src/trace/pool.h b/src/trace/pool.h
index d072a460b..88fd82bcd 100644
--- a/src/trace/pool.h
+++ b/src/trace/pool.h
@@ -59,17 +59,21 @@ class pool {
public:
pool()
- {
+ {
cblock = 0;
size = sizeof(T) > sizeof(void *) ? sizeof(T) : sizeof(void *);
next = NULL;
- }
+ for (int k = 0; k < 64; k++) {
+ block[k] = NULL;
+ }
+ }
~pool()
- {
- for (int k = 0; k < cblock; k++)
- free(block[k]);
- }
+ {
+ for (int k = 0; k < cblock; k++) {
+ free(block[k]);
+ }
+ }
T *draw()
{
@@ -89,7 +93,7 @@ class pool {
int size;
int cblock;
- void *block[64]; //enough to store unlimited number of objects
+ void *block[64]; //enough to store unlimited number of objects, if 64 is changed: see constructor too
void *next;
void addblock()
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index e6bb9b43d..6c6f3a582 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -448,9 +448,9 @@ LivePathEffectEditor::onAdd()
// run sp_selection_clone_original_path_lpe
sp_selection_clone_original_path_lpe(current_desktop);
- item = sel->singleItem();
- item->getRepr()->setAttribute("id", id);
- item->getRepr()->setAttribute("transform", transform);
+ SPItem *new_item = sel->singleItem();
+ new_item->getRepr()->setAttribute("id", id);
+ new_item->getRepr()->setAttribute("transform", transform);
g_free(id);
g_free(transform);
diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h
index fa35b815e..18a84ea05 100644
--- a/src/ui/widget/registered-widget.h
+++ b/src/ui/widget/registered-widget.h
@@ -128,6 +128,7 @@ private:
repr = NULL;
doc = NULL;
write_undo = false;
+ event_type = -1;
}
};
diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h
index 9031ac854..58739cf3b 100644
--- a/src/widgets/desktop-widget.h
+++ b/src/widgets/desktop-widget.h
@@ -129,7 +129,6 @@ struct SPDesktopWidget {
struct WidgetStub : public Inkscape::UI::View::EditWidgetInterface {
SPDesktopWidget *_dtw;
- SPDesktop *_dt;
WidgetStub (SPDesktopWidget* dtw) : _dtw(dtw) {}
virtual void setTitle (gchar const *uri)