From 1c18349cc106bb55c7bca12fd572fb7b899ff225 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Wed, 9 Dec 2015 01:45:44 +0100 Subject: replaced remaining GHashTable with std::map (bzr r14504.1.16) --- src/xml/repr-io.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/xml/repr-io.cpp') diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index a4146f215..4a6f59b43 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -38,6 +38,7 @@ #include "preferences.h" #include +#include using Inkscape::IO::Writer; using Inkscape::Util::List; @@ -50,8 +51,8 @@ using Inkscape::XML::calc_abs_doc_base; using Inkscape::XML::rebase_href_attrs; Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns); -static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ns, GHashTable *prefix_map); -static gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar *default_ns, GHashTable *prefix_map); +static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ns, std::map &prefix_map); +static gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar *default_ns, std::map &prefix_map); static void sp_repr_write_stream_root_element(Node *repr, Writer &out, bool add_whitespace, gchar const *default_ns, int inlineattrs, int indent, @@ -486,8 +487,7 @@ Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns) return NULL; } - GHashTable * prefix_map; - prefix_map = g_hash_table_new (g_str_hash, g_str_equal); + std::map prefix_map; Document *rdoc = new Inkscape::XML::SimpleDocument(); @@ -536,21 +536,17 @@ Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns) } } - g_hash_table_destroy (prefix_map); - return rdoc; } -gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar */*default_ns*/, GHashTable *prefix_map) +gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar */*default_ns*/, std::map &prefix_map) { const xmlChar *prefix; if (ns){ if (ns->href ) { prefix = reinterpret_cast( sp_xml_ns_uri_prefix(reinterpret_cast(ns->href), reinterpret_cast(ns->prefix)) ); - void* p0 = reinterpret_cast(const_cast(prefix)); - void* p1 = reinterpret_cast(const_cast(ns->href)); - g_hash_table_insert( prefix_map, p0, p1 ); + prefix_map[reinterpret_cast(prefix)] = reinterpret_cast(ns->href); } else { prefix = NULL; @@ -567,7 +563,7 @@ gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *nam } } -static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ns, GHashTable *prefix_map) +static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gchar *default_ns, std::map &prefix_map) { xmlAttrPtr prop; xmlNodePtr child; -- cgit v1.2.3