From 6ed2673499ca548767bb7d2edb453a228ece86fd Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 12 Jun 2016 10:25:42 +0200 Subject: Optionally sort attributes and properties into a canonical order. Useful for comparing different versions of an SVG file. (bzr r14980) --- src/xml/repr-io.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/xml') diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 4a6f59b43..6977bc1e2 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -34,6 +34,7 @@ #include "extension/extension.h" #include "attribute-rel-util.h" +#include "attribute-sort-util.h" #include "preferences.h" @@ -882,6 +883,10 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out, bool clean = prefs->getBool("/options/svgoutput/check_on_writing"); if (clean) sp_attribute_clean_tree( repr ); + // Sort attributes in a canonical order (helps with "diffing" SVG files). + bool sort = prefs->getBool("/options/svgoutput/sort_attributes"); + if (sort) sp_attribute_sort_tree( repr ); + Glib::QueryQuark xml_prefix=g_quark_from_static_string("xml"); NSMap ns_map; -- cgit v1.2.3 From 1ba616c66fa080af9f6afc94af4e16247ed2dada Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 10 Jul 2016 18:38:29 +0200 Subject: Comment out unused enum. (bzr r15015) --- src/xml/event.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/xml') diff --git a/src/xml/event.h b/src/xml/event.h index 73e68daeb..f6b734c29 100644 --- a/src/xml/event.h +++ b/src/xml/event.h @@ -33,13 +33,13 @@ namespace XML { /** * @brief Enumeration of all XML event types */ -enum EventType { - EVENT_ADD, ///< Child added - EVENT_DEL, ///< Child removed - EVENT_CHG_ATTR, ///< Attribute changed - EVENT_CHG_CONTENT, ///< Content changed - EVENT_CHG_ORDER ///< Order of children changed -}; +// enum EventType { +// EVENT_ADD, ///< Child added +// EVENT_DEL, ///< Child removed +// EVENT_CHG_ATTR, ///< Attribute changed +// EVENT_CHG_CONTENT, ///< Content changed +// EVENT_CHG_ORDER ///< Order of children changed +// }; /** * @brief Generic XML modification event -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/xml/node-fns.cpp | 1 - src/xml/rebase-hrefs.cpp | 3 --- src/xml/repr-css.cpp | 2 -- src/xml/repr-io.cpp | 3 +-- src/xml/repr-util.cpp | 2 -- src/xml/repr.cpp | 2 +- src/xml/simple-node.cpp | 4 +--- src/xml/simple-node.h | 1 - 8 files changed, 3 insertions(+), 15 deletions(-) (limited to 'src/xml') diff --git a/src/xml/node-fns.cpp b/src/xml/node-fns.cpp index eb3870978..e1506e3f2 100644 --- a/src/xml/node-fns.cpp +++ b/src/xml/node-fns.cpp @@ -1,5 +1,4 @@ #ifdef HAVE_CONFIG_H -# include "config.h" #endif #include diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index a8ac3b4cc..7e3d4fa7e 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -4,10 +4,7 @@ #include "io/sys.h" #include "sp-object.h" #include "streq.h" -#include "util/share.h" -#include "xml/attribute-record.h" #include "xml/node.h" -#include #include #include #include diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index c043904a7..9590fa97f 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -26,10 +26,8 @@ #include "xml/repr.h" #include "xml/simple-document.h" -#include "xml/simple-node.h" #include "xml/sp-css-attr.h" #include "style.h" -#include "libcroco/cr-sel-eng.h" using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 6977bc1e2..5f576d00f 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -39,7 +39,6 @@ #include "preferences.h" #include -#include using Inkscape::IO::Writer; using Inkscape::Util::List; diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index ce93bccab..4d093a4ea 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -17,8 +17,6 @@ #include "config.h" -#include - #if HAVE_STRING_H # include #endif diff --git a/src/xml/repr.cpp b/src/xml/repr.cpp index 0a384c9c1..8ad1ac06b 100644 --- a/src/xml/repr.cpp +++ b/src/xml/repr.cpp @@ -17,7 +17,7 @@ #define noREPR_VERBOSE #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index 3cbedc80b..49057a54b 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -16,19 +16,17 @@ #include #include +#include #include #include "preferences.h" -#include "xml/node.h" #include "xml/simple-node.h" #include "xml/node-event-vector.h" #include "xml/node-fns.h" -#include "xml/repr.h" #include "debug/event-tracker.h" #include "debug/simple-event.h" -#include "util/share.h" #include "util/format.h" #include "attribute-rel-util.h" diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h index d09392249..2aecdffda 100644 --- a/src/xml/simple-node.h +++ b/src/xml/simple-node.h @@ -19,7 +19,6 @@ #define SEEN_INKSCAPE_XML_SIMPLE_NODE_H #include -#include #include "xml/node.h" #include "xml/attribute-record.h" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/xml/node-fns.cpp | 1 + src/xml/rebase-hrefs.cpp | 3 +++ src/xml/repr-css.cpp | 2 ++ src/xml/repr-io.cpp | 3 ++- src/xml/repr-util.cpp | 2 ++ src/xml/repr.cpp | 2 +- src/xml/simple-node.cpp | 4 +++- src/xml/simple-node.h | 1 + 8 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/xml') diff --git a/src/xml/node-fns.cpp b/src/xml/node-fns.cpp index e1506e3f2..eb3870978 100644 --- a/src/xml/node-fns.cpp +++ b/src/xml/node-fns.cpp @@ -1,4 +1,5 @@ #ifdef HAVE_CONFIG_H +# include "config.h" #endif #include diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 7e3d4fa7e..a8ac3b4cc 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -4,7 +4,10 @@ #include "io/sys.h" #include "sp-object.h" #include "streq.h" +#include "util/share.h" +#include "xml/attribute-record.h" #include "xml/node.h" +#include #include #include #include diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index 9590fa97f..c043904a7 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -26,8 +26,10 @@ #include "xml/repr.h" #include "xml/simple-document.h" +#include "xml/simple-node.h" #include "xml/sp-css-attr.h" #include "style.h" +#include "libcroco/cr-sel-eng.h" using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 5f576d00f..6977bc1e2 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include @@ -39,6 +39,7 @@ #include "preferences.h" #include +#include using Inkscape::IO::Writer; using Inkscape::Util::List; diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 4d093a4ea..ce93bccab 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -17,6 +17,8 @@ #include "config.h" +#include + #if HAVE_STRING_H # include #endif diff --git a/src/xml/repr.cpp b/src/xml/repr.cpp index 8ad1ac06b..0a384c9c1 100644 --- a/src/xml/repr.cpp +++ b/src/xml/repr.cpp @@ -17,7 +17,7 @@ #define noREPR_VERBOSE #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index 49057a54b..3cbedc80b 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -16,17 +16,19 @@ #include #include -#include #include #include "preferences.h" +#include "xml/node.h" #include "xml/simple-node.h" #include "xml/node-event-vector.h" #include "xml/node-fns.h" +#include "xml/repr.h" #include "debug/event-tracker.h" #include "debug/simple-event.h" +#include "util/share.h" #include "util/format.h" #include "attribute-rel-util.h" diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h index 2aecdffda..d09392249 100644 --- a/src/xml/simple-node.h +++ b/src/xml/simple-node.h @@ -19,6 +19,7 @@ #define SEEN_INKSCAPE_XML_SIMPLE_NODE_H #include +#include #include "xml/node.h" #include "xml/attribute-record.h" -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/xml/node-fns.cpp | 1 - src/xml/rebase-hrefs.cpp | 3 --- src/xml/repr-css.cpp | 2 -- src/xml/repr-io.cpp | 3 +-- src/xml/repr-util.cpp | 2 -- src/xml/repr.cpp | 2 +- src/xml/simple-node.cpp | 3 --- 7 files changed, 2 insertions(+), 14 deletions(-) (limited to 'src/xml') diff --git a/src/xml/node-fns.cpp b/src/xml/node-fns.cpp index eb3870978..e1506e3f2 100644 --- a/src/xml/node-fns.cpp +++ b/src/xml/node-fns.cpp @@ -1,5 +1,4 @@ #ifdef HAVE_CONFIG_H -# include "config.h" #endif #include diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index a8ac3b4cc..7e3d4fa7e 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -4,10 +4,7 @@ #include "io/sys.h" #include "sp-object.h" #include "streq.h" -#include "util/share.h" -#include "xml/attribute-record.h" #include "xml/node.h" -#include #include #include #include diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index c043904a7..9590fa97f 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -26,10 +26,8 @@ #include "xml/repr.h" #include "xml/simple-document.h" -#include "xml/simple-node.h" #include "xml/sp-css-attr.h" #include "style.h" -#include "libcroco/cr-sel-eng.h" using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 6977bc1e2..5f576d00f 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -39,7 +39,6 @@ #include "preferences.h" #include -#include using Inkscape::IO::Writer; using Inkscape::Util::List; diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index ce93bccab..4d093a4ea 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -17,8 +17,6 @@ #include "config.h" -#include - #if HAVE_STRING_H # include #endif diff --git a/src/xml/repr.cpp b/src/xml/repr.cpp index 0a384c9c1..8ad1ac06b 100644 --- a/src/xml/repr.cpp +++ b/src/xml/repr.cpp @@ -17,7 +17,7 @@ #define noREPR_VERBOSE #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index 3cbedc80b..6bd47fd22 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -21,14 +21,11 @@ #include "preferences.h" -#include "xml/node.h" #include "xml/simple-node.h" #include "xml/node-event-vector.h" #include "xml/node-fns.h" -#include "xml/repr.h" #include "debug/event-tracker.h" #include "debug/simple-event.h" -#include "util/share.h" #include "util/format.h" #include "attribute-rel-util.h" -- cgit v1.2.3 From e471a664f923f517b68071f2e33fbb6ce070f8b7 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 8 Aug 2016 13:56:40 +0100 Subject: Remove deprecated Autotools and btool files. Please use CMake instead (bzr r15046) --- src/xml/Makefile_insert | 51 ------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/xml/Makefile_insert (limited to 'src/xml') diff --git a/src/xml/Makefile_insert b/src/xml/Makefile_insert deleted file mode 100644 index da55d7f7e..000000000 --- a/src/xml/Makefile_insert +++ /dev/null @@ -1,51 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - xml/comment-node.h \ - xml/composite-node-observer.cpp xml/composite-node-observer.h \ - xml/element-node.h \ - xml/helper-observer.cpp \ - xml/helper-observer.h \ - xml/node-observer.h \ - xml/quote.cpp \ - xml/quote.h \ - xml/repr-css.cpp \ - xml/log-builder.cpp \ - xml/log-builder.h \ - xml/node-fns.cpp \ - xml/node-fns.h \ - xml/pi-node.h \ - xml/rebase-hrefs.cpp \ - xml/rebase-hrefs.h \ - xml/repr-io.cpp \ - xml/repr-sorting.cpp \ - xml/repr-sorting.h \ - xml/repr-util.cpp \ - xml/repr.cpp \ - xml/repr.h \ - xml/simple-document.h \ - xml/simple-document.cpp \ - xml/simple-node.h \ - xml/simple-node.cpp \ - xml/node.h \ - xml/croco-node-iface.cpp \ - xml/croco-node-iface.h \ - xml/attribute-record.h \ - xml/sp-css-attr.h \ - xml/event.cpp xml/event.h xml/event-fns.h \ - xml/document.h \ - xml/node-event-vector.h \ - xml/node-iterators.h \ - xml/sp-css-attr.h \ - xml/subtree.cpp \ - xml/subtree.h \ - xml/text-node.h \ - xml/invalid-operation-exception.h - -# ###################### -# ### CxxTest stuff #### -# ###################### -CXXTEST_TESTSUITES += \ - $(srcdir)/xml/rebase-hrefs-test.h \ - $(srcdir)/xml/repr-action-test.h \ - $(srcdir)/xml/quote-test.h -- cgit v1.2.3 From a920c6186d15be3386066c365c6e7b7ae74e4caf Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 4 Jan 2017 22:07:53 +0200 Subject: Remove some code that doesn't do anything. There was a comment to this effect there. (bzr r15369.1.13) --- src/xml/repr-io.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'src/xml') diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 5f576d00f..ae6f238d4 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -1008,28 +1008,6 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, add_whitespace = false; } - // THIS DOESN'T APPEAR TO DO ANYTHING. Can it be commented out or deleted? - { - GQuark const href_key = g_quark_from_static_string("xlink:href"); - //GQuark const absref_key = g_quark_from_static_string("sodipodi:absref"); - - gchar const *xxHref = 0; - //gchar const *xxAbsref = 0; - for ( List ai(attributes); ai; ++ai ) { - if ( ai->key == href_key ) { - xxHref = ai->value; - //} else if ( ai->key == absref_key ) { - //xxAbsref = ai->value; - } - } - - // Might add a special case for absref but no href. - if ( old_href_base && new_href_base && xxHref ) { - //g_message("href rebase test with [%s] and [%s]", xxHref, xxAbsref); - //std::string newOne = rebase_href_attrs( old_href_base, new_href_base, xxHref, xxAbsref ); - } - } - for ( List iter = rebase_href_attrs(old_href_base, new_href_base, attributes); iter ; ++iter ) -- cgit v1.2.3 From ed72a9f7a5d8bf4b20b4a815f5b59dcfec1365bc Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 29 Jan 2017 15:03:48 +0100 Subject: [Bug #1659347] Windows: '/' in relative image links rewritten as '\' on save. Fixed bugs: - https://launchpad.net/bugs/1659347 (bzr r15459) --- src/xml/rebase-hrefs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xml') diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 7e3d4fa7e..a34df09a5 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -276,7 +276,7 @@ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_b #ifdef WIN32 /* Native Windows path separators are replaced with / so that the href * also works on Gnu/Linux and OSX */ - std::replace(href.begin(), href.end(), '\\', '/'); + std::replace(new_href.begin(), new_href.end(), '\\', '/'); #endif ir->setAttribute("xlink:href", new_href.c_str()); } else { -- cgit v1.2.3 From 112f963fb12a941762c828dfd1690a61771516af Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 30 Apr 2017 19:06:29 +0200 Subject: Relax any hardcoded limit from the libxml2 parser when creating documents from memory This fixes many bugs (mostly caused by very long image data URIs) Fixed bugs: - https://launchpad.net/bugs/1572280 - https://launchpad.net/bugs/1412912 - https://launchpad.net/bugs/1373322 - https://launchpad.net/bugs/1243011 - https://launchpad.net/bugs/1627004 - https://launchpad.net/bugs/1627004 (bzr r15654) --- src/xml/repr-io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/xml') diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index ae6f238d4..d8e0f5418 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -404,7 +404,12 @@ Document *sp_repr_read_mem (const gchar * buffer, gint length, const gchar *defa g_return_val_if_fail (buffer != NULL, NULL); - doc = xmlParseMemory (const_cast(buffer), length); + int parser_options = XML_PARSE_HUGE | XML_PARSE_RECOVER; + parser_options |= XML_PARSE_NONET; // TODO: should we allow network access? + // proper solution would be to check the preference "/options/externalresources/xml/allow_net_access" + // as done in XmlSource::readXml which gets called by the analogous sp_repr_read_file() + // but sp_repr_read_mem() seems to be called in locations where Inkscape::Preferences::get() fails badly + doc = xmlReadMemory (const_cast(buffer), length, NULL, NULL, parser_options); rdoc = sp_repr_do_read (doc, default_ns); if (doc) { -- cgit v1.2.3