]> git.0d.be Git - empathy.git/commitdiff
Merge branch 'gnome-3-8'
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 3 May 2013 12:19:23 +0000 (14:19 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 3 May 2013 12:19:23 +0000 (14:19 +0200)
Conflicts:
src/empathy.c

1  2 
libempathy/empathy-utils.c

index 55769ca40a9d7210f7413c585eadb524b2fd2258,b8f54baa42177e626b7c91577a1de37ff3de19b6..0efe3a1807ebd959cbea8353fa7e38402a098ad7
   */
  
  #include "config.h"
 +#include "empathy-utils.h"
  
  #include <glib/gi18n-lib.h>
 -
 -#include <libxml/uri.h>
  #include <dbus/dbus-protocol.h>
 +#include <math.h>
  
  #include "empathy-client-factory.h"
 -#include "empathy-utils.h"
  #include "empathy-presence-manager.h"
 -
 -#include <extensions/extensions.h>
 +#include "extensions.h"
  
+ #include <math.h>
  #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
  #include "empathy-debug.h"
  
@@@ -107,36 -111,36 +109,36 @@@ empathy_init (void
  }
  
  gboolean
 -empathy_xml_validate (xmlDoc      *doc,
 -    const gchar *dtd_filename)
 +empathy_xml_validate_from_resource (xmlDoc *doc,
 +    const gchar *dtd_resourcename)
  {
 -  gchar *path;
 -  xmlChar *escaped;
 +  GBytes *resourcecontents;
 +  gconstpointer resourcedata;
 +  gsize resourcesize;
 +  xmlParserInputBufferPtr buffer;
    xmlValidCtxt  cvp;
    xmlDtd *dtd;
 +  GError *error = NULL;
    gboolean ret;
  
 -  path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"), "libempathy",
 -         dtd_filename, NULL);
 -  if (!g_file_test (path, G_FILE_TEST_EXISTS))
 +  DEBUG ("Loading dtd resource %s", dtd_resourcename);
 +
 +  resourcecontents = g_resources_lookup_data (dtd_resourcename, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
 +  if (error != NULL)
      {
 -      g_free (path);
 -      path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
 +      g_warning ("Unable to load dtd resource '%s': %s", dtd_resourcename, error->message);
 +      g_error_free (error);
 +      return FALSE;
      }
 -
 -  DEBUG ("Loading dtd file %s", path);
 -
 -  /* The list of valid chars is taken from libxml. */
 -  escaped = xmlURIEscapeStr ((const xmlChar *) path,
 -    (const xmlChar *)":@&=+$,/?;");
 -  g_free (path);
 +  resourcedata = g_bytes_get_data (resourcecontents, &resourcesize);
 +  buffer = xmlParserInputBufferCreateStatic (resourcedata, resourcesize, XML_CHAR_ENCODING_UTF8);
  
    memset (&cvp, 0, sizeof (cvp));
 -  dtd = xmlParseDTD (NULL, escaped);
 +  dtd = xmlIOParseDTD (NULL, buffer, XML_CHAR_ENCODING_UTF8);
    ret = xmlValidateDtd (&cvp, doc, dtd);
  
 -  xmlFree (escaped);
    xmlFreeDtd (dtd);
 +  g_bytes_unref (resourcecontents);
  
    return ret;
  }