From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/extension/execution-env.cpp | 8 +++----- src/extension/implementation/implementation.cpp | 7 +++---- src/extension/implementation/script.cpp | 7 +++---- src/extension/internal/bitmap/imagemagick.cpp | 16 +++++++--------- src/extension/internal/bluredge.cpp | 7 +++---- src/extension/internal/cairo-renderer.cpp | 8 ++++---- src/extension/internal/filter/filter.cpp | 8 +++----- src/extension/internal/grid.cpp | 7 +++---- src/extension/internal/latex-text-renderer.cpp | 8 ++++---- 9 files changed, 33 insertions(+), 43 deletions(-) (limited to 'src/extension') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 13b8d60c4..66a8c4358 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -64,14 +64,12 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp sp_namedview_document_from_window(desktop); if (desktop != NULL) { - Inkscape::Util::GSListConstIterator selected = - desktop->getSelection()->itemList(); - while ( selected != NULL ) { + SelContainer selected = desktop->getSelection()->itemList(); + for(SelContainer::const_iterator x=selected.begin();x!=selected.end();x++){ Glib::ustring selected_id; - selected_id = (*selected)->getId(); + selected_id = (*x)->getId(); _selected.insert(_selected.end(), selected_id); //std::cout << "Selected: " << selected_id << std::endl; - ++selected; } } diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 52f63499a..6eff3ede3 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -48,11 +48,10 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; - // FIXME very unsafe cast - GSListConstIterator selected = ((SPDesktop *)view)->getSelection()->itemList(); + SelContainer selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; - if (selected != NULL) { - const SPItem * item = *selected; + if (!selected.empty()) { + const SPItem * item = SP_ITEM(selected.front()); first_select = item->getRepr(); } diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index bbc567f75..f396e9848 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -689,14 +689,13 @@ void Script::effect(Inkscape::Extension::Effect *module, return; } - Inkscape::Util::GSListConstIterator selected = + SelContainer selected = desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer - while ( selected != NULL ) { + for(SelContainer::const_iterator x=selected.begin();x!=selected.end();x++){ Glib::ustring selected_id; selected_id += "--id="; - selected_id += (*selected)->getId(); + selected_id += (*x)->getId(); params.insert(params.begin(), selected_id); - ++selected; } file_listener fileout; diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 76f35415e..87ef30887 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -70,8 +70,8 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems(NULL) { SPDesktop *desktop = (SPDesktop*)view; - const GSList *selectedItemList = desktop->selection->itemList(); - int selectCount = g_slist_length((GSList *)selectedItemList); + const SelContainer selectedItemList = desktop->selection->itemList(); + int selectCount = selectedItemList.size(); // Init the data-holders _nodes = new Inkscape::XML::Node*[selectCount]; @@ -83,9 +83,8 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems = new SPItem*[selectCount]; // Loop through selected items - for (; selectedItemList != NULL; selectedItemList = g_slist_next(selectedItemList)) - { - SPItem *item = SP_ITEM(selectedItemList->data); + for (SelContainer::const_iterator i=selectedItemList.begin();i!=selectedItemList.end();i++) { + SPItem *item = static_cast(*i); Inkscape::XML::Node *node = reinterpret_cast(item->getRepr()); if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image")) { @@ -243,11 +242,10 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie using Inkscape::Util::GSListConstIterator; - // FIXME very unsafe cast - GSListConstIterator selected = ((SPDesktop *)view)->getSelection()->itemList(); + SelContainer selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; - if (selected != NULL) { - first_select = (*selected)->getRepr(); + if (!selected.empty()) { + first_select = (selected.front())->getRepr(); } return module->autogui(current_document, first_select, changeSignal); diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 3ce537d9f..138172715 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -65,13 +65,12 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View using Inkscape::Util::GSListConstIterator; // TODO need to properly refcount the items, at least - std::list items; - items.insert >(items.end(), selection->itemList(), NULL); + SelContainer items(selection->itemList()); selection->clear(); - for(std::list::iterator item = items.begin(); + for(SelContainer::iterator item = items.begin(); item != items.end(); ++item) { - SPItem * spitem = *item; + SPItem * spitem = static_cast(*item); std::vector new_items(steps); Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 1f48d2097..7ce5cdf8a 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -294,14 +294,14 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) CairoRenderer *renderer = ctx->getRenderer(); TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); - GSList *l = g_slist_reverse(group->childList(false)); - while (l) { - SPObject *o = reinterpret_cast(l->data); + SelContainer l(group->childList(false)); + l.reverse(); + for(SelContainer::const_iterator x=l.begin();x!=l.end();x++){ + SPObject *o = reinterpret_cast(*x); SPItem *item = dynamic_cast(o); if (item) { renderer->renderItem(ctx, item); } - l = g_slist_remove (l, o); } } diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index a2c565699..821c023ac 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -125,17 +125,15 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie //printf("Calling filter effect\n"); Inkscape::Selection * selection = ((SPDesktop *)document)->selection; - using Inkscape::Util::GSListConstIterator; // TODO need to properly refcount the items, at least - std::list items; - items.insert >(items.end(), selection->itemList(), NULL); + SelContainer items(selection->itemList()); Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr(); - for(std::list::iterator item = items.begin(); + for(SelContainer::iterator item = items.begin(); item != items.end(); ++item) { - SPItem * spitem = *item; + SPItem * spitem = static_cast(*item); Inkscape::XML::Node * node = spitem->getRepr(); SPCSSAttr * css = sp_repr_css_attr(node, "style"); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 270edfe44..4c12f629c 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -192,11 +192,10 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View using Inkscape::Util::GSListConstIterator; - // FIXME very unsafe cast - GSListConstIterator selected = ((SPDesktop *)view)->getSelection()->itemList(); + SelContainer selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; - if (selected != NULL) { - first_select = (*selected)->getRepr(); + if (!selected.empty()) { + first_select = (selected.front())->getRepr(); } return module->autogui(current_document, first_select, changeSignal); diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index ab0733848..dab27a0e1 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -228,14 +228,14 @@ LaTeXTextRenderer::writePostamble() void LaTeXTextRenderer::sp_group_render(SPGroup *group) { - GSList *l = g_slist_reverse(group->childList(false)); - while (l) { - SPObject *o = reinterpret_cast(l->data); + SelContainer l = (group->childList(false)); + l.reverse(); + for(SelContainer::const_iterator x=l.begin();x!=l.end();x++){ + SPObject *o = reinterpret_cast(*x); SPItem *item = dynamic_cast(o); if (item) { renderItem(item); } - l = g_slist_remove (l, o); } } -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/extension/execution-env.cpp | 4 ++-- src/extension/implementation/implementation.cpp | 2 +- src/extension/implementation/script.cpp | 4 ++-- src/extension/internal/bitmap/imagemagick.cpp | 6 +++--- src/extension/internal/bluredge.cpp | 4 ++-- src/extension/internal/filter/filter.cpp | 4 ++-- src/extension/internal/grid.cpp | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/extension') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 66a8c4358..90a7810e6 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -64,8 +64,8 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp sp_namedview_document_from_window(desktop); if (desktop != NULL) { - SelContainer selected = desktop->getSelection()->itemList(); - for(SelContainer::const_iterator x=selected.begin();x!=selected.end();x++){ + std::vector selected = desktop->getSelection()->itemList(); + for(std::vector::const_iterator x=selected.begin();x!=selected.end();x++){ Glib::ustring selected_id; selected_id = (*x)->getId(); _selected.insert(_selected.end(), selected_id); diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 6eff3ede3..cea6d139f 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -48,7 +48,7 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; - SelContainer selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { const SPItem * item = SP_ITEM(selected.front()); diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index f396e9848..95d5c7edc 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -689,9 +689,9 @@ void Script::effect(Inkscape::Extension::Effect *module, return; } - SelContainer selected = + std::vector selected = desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer - for(SelContainer::const_iterator x=selected.begin();x!=selected.end();x++){ + for(std::vector::const_iterator x=selected.begin();x!=selected.end();x++){ Glib::ustring selected_id; selected_id += "--id="; selected_id += (*x)->getId(); diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 87ef30887..64abd6c4d 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -70,7 +70,7 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems(NULL) { SPDesktop *desktop = (SPDesktop*)view; - const SelContainer selectedItemList = desktop->selection->itemList(); + const std::vector selectedItemList = desktop->selection->itemList(); int selectCount = selectedItemList.size(); // Init the data-holders @@ -83,7 +83,7 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems = new SPItem*[selectCount]; // Loop through selected items - for (SelContainer::const_iterator i=selectedItemList.begin();i!=selectedItemList.end();i++) { + for (std::vector::const_iterator i=selectedItemList.begin();i!=selectedItemList.end();i++) { SPItem *item = static_cast(*i); Inkscape::XML::Node *node = reinterpret_cast(item->getRepr()); if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image")) @@ -242,7 +242,7 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie using Inkscape::Util::GSListConstIterator; - SelContainer selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { first_select = (selected.front())->getRepr(); diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 138172715..257cac161 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -65,10 +65,10 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View using Inkscape::Util::GSListConstIterator; // TODO need to properly refcount the items, at least - SelContainer items(selection->itemList()); + std::vector items(selection->itemList()); selection->clear(); - for(SelContainer::iterator item = items.begin(); + for(std::vector::iterator item = items.begin(); item != items.end(); ++item) { SPItem * spitem = static_cast(*item); diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 821c023ac..a5eb7de60 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -126,12 +126,12 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::Selection * selection = ((SPDesktop *)document)->selection; // TODO need to properly refcount the items, at least - SelContainer items(selection->itemList()); + std::vector items(selection->itemList()); Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr(); - for(SelContainer::iterator item = items.begin(); + for(std::vector::iterator item = items.begin(); item != items.end(); ++item) { SPItem * spitem = static_cast(*item); Inkscape::XML::Node * node = spitem->getRepr(); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 4c12f629c..440c6b822 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -192,7 +192,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View using Inkscape::Util::GSListConstIterator; - SelContainer selected = ((SPDesktop *)view)->getSelection()->itemList(); + std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { first_select = (selected.front())->getRepr(); -- cgit v1.2.3 From 7e4b6f793d31d3245bd8afbf6f10aa255ac3e7ae Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 20:20:09 +0100 Subject: added a set to the Selection (bzr r13922.1.6) --- src/extension/internal/cairo-renderer.cpp | 5 ++--- src/extension/internal/latex-text-renderer.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 7ce5cdf8a..f614ec745 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -294,9 +294,8 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) CairoRenderer *renderer = ctx->getRenderer(); TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); - SelContainer l(group->childList(false)); - l.reverse(); - for(SelContainer::const_iterator x=l.begin();x!=l.end();x++){ + std::vector l(group->childList(false)); + for(std::vector::const_iterator x=l.begin();x!=l.end();x++){ SPObject *o = reinterpret_cast(*x); SPItem *item = dynamic_cast(o); if (item) { diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index dab27a0e1..a2de264ab 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -228,9 +228,8 @@ LaTeXTextRenderer::writePostamble() void LaTeXTextRenderer::sp_group_render(SPGroup *group) { - SelContainer l = (group->childList(false)); - l.reverse(); - for(SelContainer::const_iterator x=l.begin();x!=l.end();x++){ + std::vector l = (group->childList(false)); + for(std::vector::const_iterator x=l.begin();x!=l.end();x++){ SPObject *o = reinterpret_cast(*x); SPItem *item = dynamic_cast(o); if (item) { -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/extension/execution-env.cpp | 2 +- src/extension/implementation/implementation.cpp | 2 +- src/extension/implementation/script.cpp | 2 +- src/extension/internal/bitmap/imagemagick.cpp | 4 ++-- src/extension/internal/bluredge.cpp | 2 +- src/extension/internal/cairo-renderer.cpp | 2 +- src/extension/internal/filter/filter.cpp | 2 +- src/extension/internal/grid.cpp | 2 +- src/extension/internal/latex-text-renderer.cpp | 4 ++-- 9 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/extension') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 90a7810e6..971f0b64a 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -65,7 +65,7 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp if (desktop != NULL) { std::vector selected = desktop->getSelection()->itemList(); - for(std::vector::const_iterator x=selected.begin();x!=selected.end();x++){ + for(std::vector::const_iterator x = selected.begin(); x != selected.end(); x++){ Glib::ustring selected_id; selected_id = (*x)->getId(); _selected.insert(_selected.end(), selected_id); diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index cea6d139f..11c494b18 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -51,7 +51,7 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { - const SPItem * item = SP_ITEM(selected.front()); + const SPItem * item = selected.front(); first_select = item->getRepr(); } diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 95d5c7edc..5c708cf9a 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -691,7 +691,7 @@ void Script::effect(Inkscape::Extension::Effect *module, std::vector selected = desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer - for(std::vector::const_iterator x=selected.begin();x!=selected.end();x++){ + for(std::vector::const_iterator x = selected.begin(); x != selected.end(); x++){ Glib::ustring selected_id; selected_id += "--id="; selected_id += (*x)->getId(); diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 64abd6c4d..3a29b3dc0 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -83,8 +83,8 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems = new SPItem*[selectCount]; // Loop through selected items - for (std::vector::const_iterator i=selectedItemList.begin();i!=selectedItemList.end();i++) { - SPItem *item = static_cast(*i); + for (std::vector::const_iterator i = selectedItemList.begin(); i != selectedItemList.end(); i++) { + SPItem *item = *i; Inkscape::XML::Node *node = reinterpret_cast(item->getRepr()); if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image")) { diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 257cac161..b80e5ddbb 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -70,7 +70,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View for(std::vector::iterator item = items.begin(); item != items.end(); ++item) { - SPItem * spitem = static_cast(*item); + SPItem * spitem = *item; std::vector new_items(steps); Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index f614ec745..b30c8892e 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -295,7 +295,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); std::vector l(group->childList(false)); - for(std::vector::const_iterator x=l.begin();x!=l.end();x++){ + for(std::vector::const_iterator x = l.begin(); x!= l.end(); x++){ SPObject *o = reinterpret_cast(*x); SPItem *item = dynamic_cast(o); if (item) { diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index a5eb7de60..65162af22 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -133,7 +133,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie for(std::vector::iterator item = items.begin(); item != items.end(); ++item) { - SPItem * spitem = static_cast(*item); + SPItem * spitem = *item; Inkscape::XML::Node * node = spitem->getRepr(); SPCSSAttr * css = sp_repr_css_attr(node, "style"); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 440c6b822..60d606a02 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -195,7 +195,7 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { - first_select = (selected.front())->getRepr(); + first_select = selected[0]->getRepr(); } return module->autogui(current_document, first_select, changeSignal); diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index a2de264ab..831a8d030 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -229,8 +229,8 @@ LaTeXTextRenderer::writePostamble() void LaTeXTextRenderer::sp_group_render(SPGroup *group) { std::vector l = (group->childList(false)); - for(std::vector::const_iterator x=l.begin();x!=l.end();x++){ - SPObject *o = reinterpret_cast(*x); + for(std::vector::const_iterator x = l.begin(); x != l.end(); x++){ + SPObject *o = *x; SPItem *item = dynamic_cast(o); if (item) { renderItem(item); -- cgit v1.2.3 From 9bdc157f705ca61516e599cb416580283d21ec35 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 04:21:48 +0100 Subject: more cast cleanup (bzr r13922.1.11) --- src/extension/implementation/implementation.cpp | 2 +- src/extension/internal/cairo-renderer.cpp | 3 +-- src/extension/internal/latex-text-renderer.cpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/extension') diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 11c494b18..717ca3310 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -51,7 +51,7 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { - const SPItem * item = selected.front(); + const SPItem * item = selected[0]; first_select = item->getRepr(); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index b30c8892e..a2cea014b 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -296,8 +296,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) std::vector l(group->childList(false)); for(std::vector::const_iterator x = l.begin(); x!= l.end(); x++){ - SPObject *o = reinterpret_cast(*x); - SPItem *item = dynamic_cast(o); + SPItem *item = static_cast(*x); if (item) { renderer->renderItem(ctx, item); } diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index 831a8d030..ab863f8b1 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -230,8 +230,7 @@ void LaTeXTextRenderer::sp_group_render(SPGroup *group) { std::vector l = (group->childList(false)); for(std::vector::const_iterator x = l.begin(); x != l.end(); x++){ - SPObject *o = *x; - SPItem *item = dynamic_cast(o); + SPItem *item = static_cast(*x); if (item) { renderItem(item); } -- cgit v1.2.3 From f20da2a7a6e65bcf3a907c3ee5cb5fd69a71c867 Mon Sep 17 00:00:00 2001 From: Mark Harmer Date: Mon, 27 Apr 2015 12:01:19 -0400 Subject: Mainloop fix for possible data loss if closing before save has completed. Fixed bugs: - https://launchpad.net/bugs/967416 (bzr r14060) --- src/extension/implementation/script.cpp | 5 ++++- src/extension/implementation/script.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index bbc567f75..52c360fcd 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -1027,7 +1027,10 @@ int Script::execute (const std::list &in_command, return 0; } - _main_loop = Glib::MainLoop::create(false); + // Create a new MainContext for the loop so that the original context sources are not run here, + // this enforces that only the file_listeners should be read in this new MainLoop + Glib::RefPtr _main_context = Glib::MainContext::create(); + _main_loop = Glib::MainLoop::create(_main_context, false); file_listener fileerr; fileout.init(stdout_pipe, _main_loop); diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 6a7d0c3b8..4cf33c989 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -90,7 +90,7 @@ private: void init (int fd, Glib::RefPtr main) { _channel = Glib::IOChannel::create_from_fd(fd); _channel->set_encoding(); - _conn = Glib::signal_io().connect(sigc::mem_fun(*this, &file_listener::read), _channel, Glib::IO_IN | Glib::IO_HUP | Glib::IO_ERR); + _conn = main->get_context()->signal_io().connect(sigc::mem_fun(*this, &file_listener::read), _channel, Glib::IO_IN | Glib::IO_HUP | Glib::IO_ERR); _main_loop = main; return; -- cgit v1.2.3 From ac063302cd13238523a4f62744282944761c2a49 Mon Sep 17 00:00:00 2001 From: mathog <> Date: Mon, 27 Apr 2015 11:49:22 -0700 Subject: patch for bugs 1447850 and 1447382 (bzr r14062) --- src/extension/internal/emf-inout.cpp | 50 ++++++++++++++++++++-------- src/extension/internal/emf-inout.h | 2 ++ src/extension/internal/emf-print.cpp | 12 +++---- src/extension/internal/wmf-inout.cpp | 64 +++++++++++++++++++++++------------- src/extension/internal/wmf-print.cpp | 6 ++-- 5 files changed, 88 insertions(+), 46 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 31e69706f..e88cf3d42 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -480,7 +480,7 @@ uint32_t Emf::add_image(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t cbBits, uint uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ // next call returns pointers and values, but allocates no memory - dibparams = get_DIB_params(pEmr, offBits, offBmi, &px, (const U_RGBQUAD **) &ct, + dibparams = get_DIB_params((const char *)pEmr, offBits, offBmi, &px, (const U_RGBQUAD **) &ct, &numCt, &width, &height, &colortype, &invert); if(dibparams ==U_BI_RGB){ // U_EMRCREATEMONOBRUSH uses text/bk colors instead of what is in the color map. @@ -1307,7 +1307,7 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index) d->dc[d->level].stroke_set = true; } else if(pEmr->elp.elpBrushStyle == U_BS_DIBPATTERN || pEmr->elp.elpBrushStyle == U_BS_DIBPATTERNPT){ - d->dc[d->level].stroke_idx = add_image(d, pEmr, pEmr->cbBits, pEmr->cbBmi, *(uint32_t *) &(pEmr->elp.elpColor), pEmr->offBits, pEmr->offBmi); + d->dc[d->level].stroke_idx = add_image(d, (void *)pEmr, pEmr->cbBits, pEmr->cbBmi, *(uint32_t *) &(pEmr->elp.elpColor), pEmr->offBits, pEmr->offBmi); d->dc[d->level].stroke_mode = DRAW_IMAGE; d->dc[d->level].stroke_set = true; } @@ -1530,7 +1530,7 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, uint32_t width, height, colortype, numCt, invert; // if needed these values will be set in get_DIB_params if(cbBits && cbBmi && (iUsage == U_DIB_RGB_COLORS)){ // next call returns pointers and values, but allocates no memory - dibparams = get_DIB_params(pEmr, offBits, offBmi, &px, (const U_RGBQUAD **) &ct, + dibparams = get_DIB_params((const char *)pEmr, offBits, offBmi, &px, (const U_RGBQUAD **) &ct, &numCt, &width, &height, &colortype, &invert); if(dibparams ==U_BI_RGB){ if(sw == 0 || sh == 0){ @@ -1611,6 +1611,10 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA uint32_t off=0; uint32_t emr_mask; int OK =1; + int file_status=1; + uint32_t nSize; + uint32_t iType; + const char *blimit = contents + length; PU_ENHMETARECORD lpEMFR; TCHUNK_SPECS tsp; uint32_t tbkMode = U_TRANSPARENT; // holds proposed change to bkMode, if text is involved saving these to the DC must wait until the text is written @@ -1641,19 +1645,32 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA while(OK){ if(off>=length)return(0); //normally should exit from while after EMREOF sets OK to false. + // check record sizes and types thoroughly + int badrec = 0; + if (!U_emf_record_sizeok(contents + off, blimit, &nSize, &iType, 1) || + !U_emf_record_safe(contents + off)){ + badrec = 1; + } + else { + emr_mask = emr_properties(iType); + if (emr_mask == U_EMR_INVALID) { badrec = 1; } + } + if (badrec) { + file_status = 0; + break; + } + lpEMFR = (PU_ENHMETARECORD)(contents + off); + // Uncomment the following to track down toxic records -// std::cout << "record type: " << lpEMFR->iType << " name " << U_emr_names(lpEMFR->iType) << " length: " << lpEMFR->nSize << " offset: " << off <nSize; +// std::cout << "record type: " << iType << " name " << U_emr_names(iType) << " length: " << nSize << " offset: " << off <iType); - if(emr_mask == U_EMR_INVALID){ throw "Inkscape fatal memory allocation error - cannot continue"; } - /* Uncomment the following to track down text problems */ //std::cout << "tri->dirty:"<< d->tri->dirty << " emr_mask: " << std::hex << emr_mask << std::dec << std::endl; @@ -1753,7 +1770,7 @@ std::cout << "BEFORE DRAW" } // std::cout << "AFTER DRAW logic d->mask: " << std::hex << d->mask << " emr_mask: " << emr_mask << std::dec << std::endl; - switch (lpEMFR->iType) + switch (iType) { case U_EMR_HEADER: { @@ -3471,7 +3488,7 @@ std::cout << "BEFORE DRAW" // std::cout << d->outsvg << std::endl; (void) emr_properties(U_EMR_INVALID); // force the release of the lookup table memory, returned value is irrelevant - return 1; + return(file_status); } void Emf::free_emf_strings(EMF_STRINGS name){ @@ -3486,12 +3503,14 @@ void Emf::free_emf_strings(EMF_STRINGS name){ SPDocument * Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { - EMF_CALLBACK_DATA d; - if (uri == NULL) { return NULL; } + EMF_CALLBACK_DATA d; + + d.n_obj = 0; //these might not be set otherwise if the input file is corrupt + d.emf_obj = NULL; d.dc[0].font_name = strdup("Arial"); // Default font, set only on lowest level, it copies up from there EMF spec says device can pick whatever it wants // set up the size default for patterns in defs. This might not be referenced if there are no patterns defined in the drawing. @@ -3518,14 +3537,17 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); - (void) myEnhMetaFileProc(contents,length, &d); + int good = myEnhMetaFileProc(contents,length, &d); free(contents); if (d.pDesc){ free( d.pDesc ); } // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); + SPDocument *doc = NULL; + if (good) { + doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); + } free_emf_strings(d.hatches); free_emf_strings(d.images); diff --git a/src/extension/internal/emf-inout.h b/src/extension/internal/emf-inout.h index c64299093..dd1d8f9c4 100644 --- a/src/extension/internal/emf-inout.h +++ b/src/extension/internal/emf-inout.h @@ -13,6 +13,8 @@ #define SEEN_EXTENSION_INTERNAL_EMF_H #include +#include +#include // for U_emf_record_sizeok() #include "extension/internal/metafile-inout.h" // picks up PNG #include "extension/implementation/implementation.h" #include "style.h" diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 67a9242bc..ed3ae158a 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -60,6 +60,7 @@ #include "splivarot.h" // pieces for union on shapes #include "2geom/svg-path-parser.h" // to get from SVG text to Geom::Path #include "display/canvas-bpath.h" // for SPWindRule +#include "display/cairo-utils.h" // for Inkscape::Pixbuf::PF_CAIRO #include "emf-print.h" @@ -70,7 +71,6 @@ namespace Internal { #define PXPERMETER 2835 - /* globals */ static double PX2WORLD; static bool FixPPTCharPos, FixPPTDashLine, FixPPTGrad2Polys, FixPPTLinGrad, FixPPTPatternAsHatch, FixImageRot; @@ -481,9 +481,8 @@ int PrintEmf::create_brush(SPStyle const *style, PU_COLORREF fcolor) rgba_px = (char *) pixbuf->pixels(); // Do NOT free this!!! colortype = U_BCBM_COLOR32; (void) RGBA_to_DIB(&px, &cbPx, &ct, &numCt, rgba_px, width, height, width * 4, colortype, 0, 1); - // Not sure why the next swap is needed because the preceding does it, and the code is identical - // to that in stretchdibits_set, which does not need this. - swapRBinRGBA(px, width * height); + // pixbuf can be either PF_CAIRO or PF_GDK, and these have R and B bytes swapped + if (pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) { swapRBinRGBA(px, width * height); } Bmih = bitmapinfoheader_set(width, height, 1, colortype, U_BI_RGB, 0, PXPERMETER, PXPERMETER, numCt, 0); Bmi = bitmapinfo_set(Bmih, ct); rec = createdibpatternbrushpt_set(&brush, eht, U_DIB_RGB_COLORS, Bmi, cbPx, px); @@ -584,9 +583,8 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) rgba_px = (char *) pixbuf->pixels(); // Do NOT free this!!! colortype = U_BCBM_COLOR32; (void) RGBA_to_DIB(&px, &cbPx, &ct, &numCt, rgba_px, width, height, width * 4, colortype, 0, 1); - // Not sure why the next swap is needed because the preceding does it, and the code is identical - // to that in stretchdibits_set, which does not need this. - swapRBinRGBA(px, width * height); + // pixbuf can be either PF_CAIRO or PF_GDK, and these have R and B bytes swapped + if (pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) { swapRBinRGBA(px, width * height); } Bmih = bitmapinfoheader_set(width, height, 1, colortype, U_BI_RGB, 0, PXPERMETER, PXPERMETER, numCt, 0); Bmi = bitmapinfo_set(Bmih, ct); } else { // pattern diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 503a93418..30a028eec 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -1497,6 +1497,7 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK uint32_t off=0; uint32_t wmr_mask; int OK =1; + int file_status=1; TCHUNK_SPECS tsp; uint8_t iType; int nSize; // size of the current record, in bytes, or an error value if <=0 @@ -1562,7 +1563,9 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK U_WMRHEADER Header; off = 0; nSize = wmfheader_get(contents, blimit, &Placeable, &Header); - if(!nSize)return(0); + if (!nSize) { + return(0); + } if(!Header.nObjects){ Header.nObjects = 256; }// there _may_ be WMF files with no objects, more likely it is corrupt. Try to use it anyway. d->n_obj = Header.nObjects; d->wmf_obj = new WMF_OBJECT[d->n_obj]; @@ -1602,7 +1605,10 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK else { off += nSize; } - } + } + else { + return(0); + } } off=0; nSize = hold_nSize; @@ -1665,27 +1671,32 @@ int Wmf::myMetaFileProc(const char *contents, unsigned int length, PWMF_CALLBACK while(OK){ - if(off>=length)return(0); //normally should exit from while after WMREOF sets OK to false. + if (off>=length) { + return(0); //normally should exit from while after WMREOF sets OK to false. + } contents += nSize; // pointer to the start of the next record off += nSize; // offset from beginning of buffer to the start of the next record - SVGOStringStream tmp_path; - SVGOStringStream tmp_str; - - /* Check that the current record size is OK, abort if not. - Pointer math might wrap, so check both sides of the range. - Some of the records will reset this with the same value,others will not - return a value at this time. */ + /* Currently this is a weaker check than for EMF, it only checks the size of the constant part + of the record */ nSize = U_WMRRECSAFE_get(contents, blimit); - if(!nSize)break; + if(!nSize) { + file_status = 0; + break; + } iType = *(uint8_t *)(contents + offsetof(U_METARECORD, iType ) ); + wmr_mask = U_wmr_properties(iType); + if (wmr_mask == U_WMR_INVALID) { + file_status = 0; + break; + } // Uncomment the following to track down toxic records // std::cout << "record type: " << (int) iType << " name " << U_wmr_names(iType) << " length: " << nSize << " offset: " << off <dirty:"<< d->tri->dirty << " wmr_mask: " << std::hex << wmr_mask << std::dec << std::endl; @@ -3026,14 +3037,17 @@ std::cout << "BEFORE DRAW" // When testing, uncomment the following to place a comment for each processed WMR record in the SVG // d->outsvg += dbg_str.str().c_str(); d->path += tmp_path.str().c_str(); - if(!nSize){ OK=0; std::cout << "nSize == 0, oops!!!" << std::endl; } // There was some problem with this record, it is not safe to continue + if(!nSize){ // There was some problem with the processing of this record, it is not safe to continue + file_status = 0; + break; + } - } //end of while + } //end of while on OK // When testing, uncomment the following to show the final SVG derived from the WMF // std::cout << d->outsvg << std::endl; (void) U_wmr_properties(U_WMR_INVALID); // force the release of the lookup table memory, returned value is irrelevant - return 1; + return(file_status); } void Wmf::free_wmf_strings(WMF_STRINGS name){ @@ -3049,7 +3063,14 @@ SPDocument * Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { + if (uri == NULL) { + return NULL; + } + WMF_CALLBACK_DATA d; + + d.n_obj = 0; //these might not be set otherwise if the input file is corrupt + d.wmf_obj=NULL; // Default font, WMF spec says device can pick whatever it wants. // WMF files that do not specify a font are unlikely to look very good! @@ -3067,10 +3088,6 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.dc[0].style.stroke_width.value = 1.0; // will be reset to something reasonable once WMF draying size is known d.dc[0].style.stroke.value.color.set( 0, 0, 0 ); - if (uri == NULL) { - return NULL; - } - d.dc[0].font_name = strdup("Arial"); // Default font, set only on lowest level, it copies up from there WMF spec says device can pick whatever it wants // set up the size default for patterns in defs. This might not be referenced if there are no patterns defined in the drawing. @@ -3095,12 +3112,15 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP, FT_KERNING_UNSCALED); - (void) myMetaFileProc(contents,length, &d); + int good = myMetaFileProc(contents,length, &d); free(contents); // std::cout << "SVG Output: " << std::endl << d.outsvg << std::endl; - SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); + SPDocument *doc = NULL; + if (good) { + doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE); + } free_wmf_strings(d.hatches); free_wmf_strings(d.images); diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index 567f9f366..9fe1a0259 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -61,6 +61,7 @@ #include "splivarot.h" // pieces for union on shapes #include "2geom/svg-path-parser.h" // to get from SVG text to Geom::Path #include "display/canvas-bpath.h" // for SPWindRule +#include "display/cairo-utils.h" // for Inkscape::Pixbuf::PF_CAIRO #include "wmf-print.h" @@ -471,9 +472,8 @@ int PrintWmf::create_brush(SPStyle const *style, U_COLORREF *fcolor) rgba_px = (char *) pixbuf->pixels(); // Do NOT free this!!! colortype = U_BCBM_COLOR32; (void) RGBA_to_DIB(&px, &cbPx, &ct, &numCt, rgba_px, width, height, width * 4, colortype, 0, 1); - // Not sure why the next swap is needed because the preceding does it, and the code is identical - // to that in stretchdibits_set, which does not need this. - swapRBinRGBA(px, width * height); + // pixbuf can be either PF_CAIRO or PF_GDK, and these have R and B bytes swapped + if (pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) { swapRBinRGBA(px, width * height); } Bmih = bitmapinfoheader_set(width, height, 1, colortype, U_BI_RGB, 0, PXPERMETER, PXPERMETER, numCt, 0); Bmi = bitmapinfo_set(Bmih, ct); rec = wcreatedibpatternbrush_srcdib_set(&brush, wht, U_DIB_RGB_COLORS, Bmi, cbPx, px); -- cgit v1.2.3 From 4bd4a89e23064b6782728d7965b12443978dcd29 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 28 Apr 2015 00:56:20 +0200 Subject: removed a few "using Inkscape::Util::GSListConstIterator" (bzr r13922.1.16) --- src/extension/implementation/implementation.cpp | 1 - src/extension/internal/bitmap/imagemagick.cpp | 2 -- src/extension/internal/bluredge.cpp | 1 - src/extension/internal/grid.cpp | 2 -- 4 files changed, 6 deletions(-) (limited to 'src/extension') diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 717ca3310..b0ff3e91c 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -47,7 +47,6 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I SPDocument * current_document = view->doc(); - using Inkscape::Util::GSListConstIterator; std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 3a29b3dc0..5e4c930bc 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -240,8 +240,6 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie { SPDocument * current_document = view->doc(); - using Inkscape::Util::GSListConstIterator; - std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index b80e5ddbb..9f19f8b3b 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -63,7 +63,6 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View Inkscape::Preferences *prefs = Inkscape::Preferences::get(); double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); - using Inkscape::Util::GSListConstIterator; // TODO need to properly refcount the items, at least std::vector items(selection->itemList()); selection->clear(); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 60d606a02..932d9a0d0 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -190,8 +190,6 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View { SPDocument * current_document = view->doc(); - using Inkscape::Util::GSListConstIterator; - std::vector selected = ((SPDesktop *)view)->getSelection()->itemList(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { -- cgit v1.2.3 From ba4dbfb351180e0fc4ad57be6e3534fa2ab5cf8c Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 28 Apr 2015 00:38:31 +0100 Subject: Fix unnecessary inclusion of glibmm/threads.h. This can be resolved by ensuring that glibmm headers always preceed glib.h headers. Same applies with gtkmm/gtk+ etc (bzr r14064) --- src/extension/execution-env.cpp | 4 ---- src/extension/extension.cpp | 4 ---- src/extension/internal/bitmap/imagemagick.cpp | 4 ---- src/extension/internal/cdr-input.h | 4 ---- src/extension/internal/grid.cpp | 4 ---- src/extension/internal/pdfinput/pdf-input.h | 4 ---- src/extension/internal/vsd-input.h | 4 ---- src/extension/param/bool.cpp | 4 ---- src/extension/param/color.cpp | 4 ---- src/extension/param/description.cpp | 4 ---- src/extension/param/enum.cpp | 4 ---- src/extension/param/float.cpp | 4 ---- src/extension/param/int.cpp | 4 ---- src/extension/param/notebook.cpp | 4 ---- src/extension/param/radiobutton.cpp | 4 ---- src/extension/param/string.cpp | 4 ---- src/extension/prefdialog.h | 9 --------- 17 files changed, 73 deletions(-) (limited to 'src/extension') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 13b8d60c4..e7cd43d9d 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -14,10 +14,6 @@ # include #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include "gtkmm/messagedialog.h" #include "execution-env.h" diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 3d0f49a20..6f7539360 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -19,10 +19,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 76f35415e..7c91bf1ef 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -12,10 +12,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include diff --git a/src/extension/internal/cdr-input.h b/src/extension/internal/cdr-input.h index 3de6c1ed0..10af41d5a 100644 --- a/src/extension/internal/cdr-input.h +++ b/src/extension/internal/cdr-input.h @@ -19,10 +19,6 @@ #ifdef WITH_LIBCDR -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include "../implementation/implementation.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 270edfe44..61f2f70e2 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -15,10 +15,6 @@ # include #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index d57c3e993..866db5d82 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -16,10 +16,6 @@ #ifdef HAVE_POPPLER -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include "../../implementation/implementation.h" diff --git a/src/extension/internal/vsd-input.h b/src/extension/internal/vsd-input.h index 3414e0ec9..acc52debf 100644 --- a/src/extension/internal/vsd-input.h +++ b/src/extension/internal/vsd-input.h @@ -19,10 +19,6 @@ #ifdef WITH_LIBVISIO -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include "../implementation/implementation.h" diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 548dec4fa..de9b1c586 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -10,10 +10,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 5bd70359f..b774bac83 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -14,10 +14,6 @@ #include #include -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 95ed04afc..326e75e4a 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -13,10 +13,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 74b2a75ad..8bc0fbda7 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -18,10 +18,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 464938f03..81508f6c0 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -10,10 +10,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 819c75693..c286018fd 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -10,10 +10,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 9ec31ca6b..20c8e8481 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -16,10 +16,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 740acf1d1..8181c6f51 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -18,10 +18,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index d6e438db5..4e525ff73 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -10,10 +10,6 @@ # include "config.h" #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h index 905d35744..4714c2c3f 100644 --- a/src/extension/prefdialog.h +++ b/src/extension/prefdialog.h @@ -10,19 +10,10 @@ #ifndef INKSCAPE_EXTENSION_DIALOG_H__ #define INKSCAPE_EXTENSION_DIALOG_H__ -#ifdef HAVE_CONFIG_H -# include -#endif - -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include - namespace Gtk { class CheckButton; } -- cgit v1.2.3 From 1b24834a9073b27ffe84dd0a48ebab4ef7cba46f Mon Sep 17 00:00:00 2001 From: mathog <> Date: Tue, 28 Apr 2015 11:11:32 -0700 Subject: enable default pen object for WMF files (bzr r14067) --- src/extension/internal/wmf-inout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 30a028eec..3ab7a4e89 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -3085,8 +3085,12 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.dc[0].style.stroke_dasharray.set = 0; d.dc[0].style.stroke_linecap.computed = 2; // U_PS_ENDCAP_SQUARE; d.dc[0].style.stroke_linejoin.computed = 0; // U_PS_JOIN_MITER; - d.dc[0].style.stroke_width.value = 1.0; // will be reset to something reasonable once WMF draying size is known + d.dc[0].style.stroke_width.value = 1.0; // will be reset to something reasonable once WMF drawing size is known d.dc[0].style.stroke.value.color.set( 0, 0, 0 ); + d.dc[0].stroke_set = true; + + // Default brush is none - no fill. WMF files that do not specify a brush are unlikely to look very good! + d.dc[0].fill_set = false; d.dc[0].font_name = strdup("Arial"); // Default font, set only on lowest level, it copies up from there WMF spec says device can pick whatever it wants -- cgit v1.2.3 From e5abbfaf9a7767bff95f45bdbfed4999ba894a99 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Wed, 29 Apr 2015 22:38:25 -0400 Subject: Fix dbus build (bzr r14077) --- src/extension/dbus/document-interface.cpp | 46 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/extension') diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 4fde6885f..d64bdbc5c 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -186,10 +186,10 @@ selection_get_center_y (Inkscape::Selection *sel){ * know we never bothered to implement it seperatly. Although * they might see the selection box flicker if used in a loop. */ -const GSList * +std::vector selection_swap(Inkscape::Selection *sel, gchar *name, GError **error) { - const GSList *oldsel = g_slist_copy((GSList *)sel->list()); + std::vector oldsel = sel->list(); sel->set(get_object_by_name(sel->layers()->getDocument(), name, error)); return oldsel; @@ -199,9 +199,11 @@ selection_swap(Inkscape::Selection *sel, gchar *name, GError **error) * See selection_swap, above */ void -selection_restore(Inkscape::Selection *sel, const GSList * oldsel) +selection_restore(Inkscape::Selection *sel, std::vector oldsel) { - sel->setList(oldsel); + // ... setList used to work here + sel->clear(); + sel->add(oldsel.begin(), oldsel.end()); } /* @@ -708,8 +710,8 @@ gboolean document_interface_move (DocumentInterface *doc_interface, gchar *name, gdouble x, gdouble y, GError **error) { - const GSList *oldsel = selection_swap(doc_interface->target.getSelection(), name, error); - if (!oldsel) + std::vector oldsel = selection_swap(doc_interface->target.getSelection(), name, error); + if (oldsel.empty()) return FALSE; sp_selection_move (doc_interface->target.getSelection(), x, 0 - y); selection_restore(doc_interface->target.getSelection(), oldsel); @@ -720,8 +722,8 @@ gboolean document_interface_move_to (DocumentInterface *doc_interface, gchar *name, gdouble x, gdouble y, GError **error) { - const GSList *oldsel = selection_swap(doc_interface->target.getSelection(), name, error); - if (!oldsel) + std::vector oldsel = selection_swap(doc_interface->target.getSelection(), name, error); + if (oldsel.empty()) return FALSE; Inkscape::Selection * sel = doc_interface->target.getSelection(); sp_selection_move (doc_interface->target.getSelection(), x - selection_get_center_x(sel), @@ -734,8 +736,8 @@ gboolean document_interface_object_to_path (DocumentInterface *doc_interface, char *shape, GError **error) { - const GSList *oldsel = selection_swap(doc_interface->target.getSelection(), shape, error); - if (!oldsel) + std::vector oldsel = selection_swap(doc_interface->target.getSelection(), shape, error); + if (oldsel.empty()) return FALSE; dbus_call_verb (doc_interface, SP_VERB_OBJECT_TO_CURVE, error); selection_restore(doc_interface->target.getSelection(), oldsel); @@ -849,8 +851,8 @@ gboolean document_interface_move_to_layer (DocumentInterface *doc_interface, gchar *shape, gchar *layerstr, GError **error) { - const GSList *oldsel = selection_swap(doc_interface->target.getSelection(), shape, error); - if (!oldsel) + std::vector oldsel = selection_swap(doc_interface->target.getSelection(), shape, error); + if (oldsel.empty()) return FALSE; document_interface_selection_move_to_layer(doc_interface, layerstr, error); @@ -1085,15 +1087,15 @@ void document_interface_update(DocumentInterface *doc_interface, GError ** error gboolean document_interface_selection_get(DocumentInterface *doc_interface, char ***out, GError ** /*error*/) { Inkscape::Selection * sel = doc_interface->target.getSelection(); - GSList const *oldsel = sel->list(); + std::vector oldsel = sel->list(); - int size = g_slist_length((GSList *) oldsel); + int size = oldsel.size(); *out = g_new0 (char *, size + 1); int i = 0; - for (GSList const *iter = oldsel; iter != NULL; iter = iter->next) { - (*out)[i] = g_strdup(SP_OBJECT(iter->data)->getRepr()->attribute("id")); + for (std::vector::iterator iter = oldsel.begin(), e = oldsel.end(); iter != e; ++iter) { + (*out)[i] = g_strdup((*iter)->getId()); i++; } (*out)[i] = NULL; @@ -1426,23 +1428,21 @@ gboolean dbus_send_ping (SPDesktop* desk, SPItem *item) gboolean document_interface_get_children (DocumentInterface *doc_interface, char *name, char ***out, GError **error) { - SPItem* parent=(SPItem* )get_object_by_name(doc_interface->target.getDocument(), name, error); + SPItem* parent=(SPItem* )get_object_by_name(doc_interface->target.getDocument(), name, error); + std::vector children = parent->childList(false); - GSList const *children = parent->childList(false); - - int size = g_slist_length((GSList *) children); + int size = children.size(); *out = g_new0 (char *, size + 1); int i = 0; - for (GSList const *iter = children; iter != NULL; iter = iter->next) { - (*out)[i] = g_strdup(SP_OBJECT(iter->data)->getRepr()->attribute("id")); + for (std::vector::iterator iter = children.begin(), e = children.end(); iter != e; ++iter) { + (*out)[i] = g_strdup((*iter)->getId()); i++; } (*out)[i] = NULL; return TRUE; - } -- cgit v1.2.3 From 2f156df97e50f3a1fa2ddc994ddb24dce76a77f2 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Fri, 1 May 2015 22:25:08 -0400 Subject: bzrignore: Fix *.cmake ignorance Only certain .cmake files should be ignored (bzr r14086) --- src/extension/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/extension') diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 47292fd97..d1104f3cc 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -57,6 +57,7 @@ set(extension_SRC internal/vsd-input.cpp internal/wmf-inout.cpp internal/wmf-print.cpp + internal/wpg-input.cpp internal/filter/filter-all.cpp internal/filter/filter-file.cpp @@ -142,6 +143,7 @@ set(extension_SRC internal/vsd-input.h internal/wmf-inout.h internal/wmf-print.h + internal/wpg-input.h ) if(WIN32) -- cgit v1.2.3 From f9afd4f6cdee501fcfd5ae6185643796e9ec646d Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 4 May 2015 13:09:20 +0200 Subject: Fix crash in PDF export introduced in r14074 (bzr r14108) --- src/extension/internal/cairo-renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 49e145de0..5a5553e97 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -296,7 +296,7 @@ static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) std::vector l(group->childList(false)); for(std::vector::const_iterator x = l.begin(); x!= l.end(); x++){ - SPItem *item = static_cast(*x); + SPItem *item = dynamic_cast(*x); if (item) { renderer->renderItem(ctx, item); } -- cgit v1.2.3 From 9102ee49b968e55e93a7f6ccfb563c8571bf458c Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 03:22:12 +0200 Subject: forgotten dynamic cast (bzr r14125) --- src/extension/internal/latex-text-renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp index ab863f8b1..1026f51ad 100644 --- a/src/extension/internal/latex-text-renderer.cpp +++ b/src/extension/internal/latex-text-renderer.cpp @@ -230,7 +230,7 @@ void LaTeXTextRenderer::sp_group_render(SPGroup *group) { std::vector l = (group->childList(false)); for(std::vector::const_iterator x = l.begin(); x != l.end(); x++){ - SPItem *item = static_cast(*x); + SPItem *item = dynamic_cast(*x); if (item) { renderItem(item); } -- cgit v1.2.3 From 48e0423afcb02fe4a0f705d828a0dbdb3106b397 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 15:46:25 +0200 Subject: fixes a few of jenkins warnings (bzr r14126) --- src/extension/implementation/script.cpp | 16 ++++++++++------ src/extension/internal/cairo-render-context.cpp | 1 + src/extension/internal/wmf-inout.cpp | 6 ++---- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src/extension') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 5cab3a2b2..e07a3963c 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -812,6 +812,12 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr } } + if(!oldroot_namedview) + { + g_warning("Error on copy_doc: No namedview on destination document."); + return; + } + // Unparent (delete) for (unsigned int i = 0; i < delete_list.size(); i++) { sp_repr_unparent(delete_list[i]); @@ -823,12 +829,10 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr child = child->next()) { if (!strcmp("sodipodi:namedview", child->name())) { newroot_namedview = child; - if (oldroot_namedview != NULL) { - for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild(); - newroot_namedview_child != NULL; - newroot_namedview_child = newroot_namedview_child->next()) { - oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document())); - } + for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild(); + newroot_namedview_child != NULL; + newroot_namedview_child = newroot_namedview_child->next()) { + oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document())); } } else { oldroot->appendChild(child->duplicate(oldroot->document())); diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 2d6619e1e..27e34dbcf 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1393,6 +1393,7 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, Geom::OptRect const &p dashes[i] = style->stroke_dasharray.values[i]; } cairo_set_dash(_cr, dashes, ndashes, style->stroke_dashoffset.value); + free(dashes); } else { cairo_set_dash(_cr, NULL, 0, 0.0); // disable dashing } diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 3ab7a4e89..f76fa16b4 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -95,7 +95,6 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) SPPrintContext context; const gchar *oldconst; gchar *oldoutput; - unsigned int ret; doc->ensureUpToDate(); @@ -114,13 +113,12 @@ Wmf::print_document_to_file(SPDocument *doc, const gchar *filename) mod->root = mod->base->invoke_show(drawing, mod->dkey, SP_ITEM_SHOW_DISPLAY); drawing.setRoot(mod->root); /* Print document */ - ret = mod->begin(doc); - if (ret) { + if (mod->begin(doc)) { g_free(oldoutput); throw Inkscape::Extension::Output::save_failed(); } mod->base->invoke_print(&context); - ret = mod->finish(); + mod->finish(); /* Release arena */ mod->base->invoke_hide(mod->dkey); mod->base = NULL; -- cgit v1.2.3