diff options
Diffstat (limited to 'src/extension/internal')
| -rw-r--r-- | src/extension/internal/cairo-ps-out.cpp | 24 | ||||
| -rw-r--r-- | src/extension/internal/cairo-render-context.h | 4 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-inout.cpp | 1 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.cpp | 1 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/svg-builder.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/svg.cpp | 42 |
7 files changed, 58 insertions, 22 deletions
diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 9ac19326f..737bb2885 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -42,22 +42,22 @@ namespace Inkscape { namespace Extension { namespace Internal { -bool -CairoPsOutput::check (Inkscape::Extension::Extension * module) +bool CairoPsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) - return FALSE; - - return TRUE; + if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_PS)) { + return FALSE; + } else { + return TRUE; + } } -bool -CairoEpsOutput::check (Inkscape::Extension::Extension * module) +bool CairoEpsOutput::check (Inkscape::Extension::Extension * /*module*/) { - if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) - return FALSE; - - return TRUE; + if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_PRINT_CAIRO_EPS)) { + return FALSE; + } else { + return TRUE; + } } static bool diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index e6f2d698e..a1f902457 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -71,12 +71,12 @@ public: CairoRenderer *getRenderer(void) const; cairo_t *getCairoContext(void) const; - typedef enum CairoRenderMode { + enum CairoRenderMode { RENDER_MODE_NORMAL, RENDER_MODE_CLIP }; - typedef enum CairoClipMode { + enum CairoClipMode { CLIP_MODE_PATH, CLIP_MODE_MASK }; diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index f400a3649..9d25f3a7f 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -127,6 +127,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) /* Print document */ ret = mod->begin(doc); if (ret) { + g_free(oldoutput); throw Inkscape::Extension::Output::save_failed(); } sp_item_invoke_print(mod->base, &context); diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index cc8489302..46e0361ce 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -795,8 +795,8 @@ void SingularValueDecomposition::calculate() } } - delete e; - delete work; + delete [] e; + delete [] work; } diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index c2d417f2c..ba00fe343 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -734,6 +734,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { delete builder; g_free(docname); delete pdf_doc; + delete dlg; // Restore undo sp_document_set_undo_sensitive(doc, saved); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 00bd8fa4d..b9583545f 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -1536,7 +1536,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height } png_write_row(png_ptr, (png_bytep)buffer); } - delete buffer; + delete [] buffer; } else if (color_map) { image_stream = new ImageStream(str, width, color_map->getNumPixelComps(), @@ -1575,7 +1575,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height png_write_row(png_ptr, (png_bytep)buffer); } } - delete buffer; + delete [] buffer; } else { // A colormap must be provided, so quit png_destroy_write_struct(&png_ptr, &info_ptr); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index a3589e905..b10aa87ec 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -21,6 +21,7 @@ #include "extension/system.h" #include "extension/output.h" #include <vector> +#include "xml/attribute-record.h" #ifdef WITH_GNOME_VFS # include <libgnomevfs/gnome-vfs.h> @@ -32,6 +33,37 @@ namespace Internal { #include "clear-n_.h" + +using Inkscape::Util::List; +using Inkscape::XML::AttributeRecord; +using Inkscape::XML::Node; + + + +void pruneExtendedAttributes( Inkscape::XML::Node *repr ) +{ + if (repr) { + if ( repr->type() == Inkscape::XML::ELEMENT_NODE ) { + std::vector<gchar const*> toBeRemoved; + for ( List<AttributeRecord const> it = repr->attributeList(); it; ++it ) { + const gchar* attrName = g_quark_to_string(it->key); + if ((strncmp("inkscape:", attrName, 9) == 0) || (strncmp("sodipodi:", attrName, 9) == 0)) { + toBeRemoved.push_back(attrName); + } + } + // Can't change the set we're interating over while we are iterating. + for ( std::vector<gchar const*>::iterator it = toBeRemoved.begin(); it != toBeRemoved.end(); ++it ) { + repr->setAttribute(*it, 0); + } + } + + for ( Node *child = repr->firstChild(); child; child = child->next() ) { + pruneExtendedAttributes(child); + } + } +} + + /** \return None \brief What would an SVG editor be without loading/saving SVG @@ -179,7 +211,7 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) we're getting good data. It also checks the module ID of the incoming module to figure out whether this save should include the Inkscape namespace stuff or not. The result of that comparison - is stored in the spns variable. + is stored in the exportExtensions variable. If there is not to be Inkscape name spaces a new document is created without. (I think, I'm not sure on this code) @@ -198,18 +230,20 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena gchar *save_path = g_path_get_dirname(filename); - bool const spns = ( !mod->get_id() + bool const exportExtensions = ( !mod->get_id() || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE) || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE)); Inkscape::XML::Document *rdoc = NULL; Inkscape::XML::Node *repr = NULL; - if (spns) { + if (exportExtensions) { repr = sp_document_repr_root (doc); } else { rdoc = sp_repr_document_new ("svg:svg"); repr = rdoc->root(); repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); + + pruneExtendedAttributes(repr); } if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI, @@ -217,7 +251,7 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena throw Inkscape::Extension::Output::save_failed(); } - if (!spns) { + if (!exportExtensions) { Inkscape::GC::release(rdoc); } |
