librsvg r1182 - trunk



Author: doml
Date: Mon Oct 20 14:25:29 2008
New Revision: 1182
URL: http://svn.gnome.org/viewvc/librsvg?rev=1182&view=rev

Log:
2008-10-20  Dominic Lachowicz <domlachowicz gmail com>

        * rsvg-gobject.c: gdmgreeter segfault due to libxml2 API/ABI change
        (#549087). Patch by Tom Parker (palfrey%40tevp.net). Untested against
        libxml2 >= 2.7.0, but DV says "from the distance, that patch seems
        to do the right thing"
        * rsvg-base.c: ditto



Modified:
   trunk/ChangeLog
   trunk/rsvg-base.c
   trunk/rsvg-gobject.c

Modified: trunk/rsvg-base.c
==============================================================================
--- trunk/rsvg-base.c	(original)
+++ trunk/rsvg-base.c	Mon Oct 20 14:25:29 2008
@@ -43,6 +43,8 @@
 #include "rsvg-mask.h"
 #include "rsvg-marker.h"
 
+#include <libxml/uri.h>
+
 #include <math.h>
 #include <string.h>
 #include <stdarg.h>
@@ -796,6 +798,21 @@
     RsvgHandle *ctx = (RsvgHandle *) data;
     GHashTable *entities = ctx->priv->entities;
     xmlEntityPtr entity;
+#if LIBXML_VERSION >= 20700
+    xmlChar *resolvedSystemId = NULL, *resolvedPublicId = NULL;
+
+    if (systemId)
+        resolvedSystemId = xmlBuildRelativeURI (systemId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
+    else if (publicId)
+        resolvedPublicId = xmlBuildRelativeURI (publicId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
+
+    entity = xmlNewEntity(NULL, name, type, resolvedPublicId, resolvedSystemId, content);
+
+    free(resolvedPublicId);
+    free(resolvedSystemId);
+
+    g_hash_table_insert (entities, g_strdup ((const char*) name), entity);
+#else
     xmlChar *dupname;
 
     entity = xmlMalloc (sizeof (xmlEntity));
@@ -834,6 +851,7 @@
     }
 
     g_hash_table_insert (entities, dupname, entity);
+#endif
 }
 
 static void

Modified: trunk/rsvg-gobject.c
==============================================================================
--- trunk/rsvg-gobject.c	(original)
+++ trunk/rsvg-gobject.c	Mon Oct 20 14:25:29 2008
@@ -70,6 +70,7 @@
 {
     xmlEntityPtr entval = (xmlEntityPtr) value;
 
+#if LIBXML_VERSION < 20700
     /* key == entval->name, so it's implicitly freed below */
 
     xmlFree ((xmlChar *) entval->name);
@@ -78,6 +79,9 @@
     xmlFree (entval->content);
     xmlFree (entval->orig);
     xmlFree (entval);
+#else
+	xmlFreeNode(entval);
+#endif
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]