[gupnp-av/wip/lazy-namespaces: 6/7] Revert "Add dlna namespace only when it's actually used"



commit 6ed170d470ab6cd725731d9b2a94fa2e6ef8e5b4
Author: Jens Georg <mail jensge org>
Date:   Sat Dec 14 15:32:29 2013 +0100

    Revert "Add dlna namespace only when it's actually used"
    
    This reverts commit 50a5e45591e7bccb79250502c22233793dc6b2cb.
    
    Conflicts:
        libgupnp-av/gupnp-didl-lite-writer.c

 libgupnp-av/gupnp-didl-lite-resource.c |    1 +
 libgupnp-av/gupnp-didl-lite-resource.h |    1 -
 libgupnp-av/gupnp-didl-lite-writer.c   |   34 +-------------------------------
 3 files changed, 2 insertions(+), 34 deletions(-)
---
diff --git a/libgupnp-av/gupnp-didl-lite-resource.c b/libgupnp-av/gupnp-didl-lite-resource.c
index e11f204..0eaab07 100644
--- a/libgupnp-av/gupnp-didl-lite-resource.c
+++ b/libgupnp-av/gupnp-didl-lite-resource.c
@@ -1470,6 +1470,7 @@ gupnp_didl_lite_resource_set_cleartext_size
                               resource->priv->dlna_ns,
                               (unsigned char *) "cleartextSize",
                               (unsigned char *) str);
+
                 g_free (str);
         }
 
diff --git a/libgupnp-av/gupnp-didl-lite-resource.h b/libgupnp-av/gupnp-didl-lite-resource.h
index cec572c..5700042 100644
--- a/libgupnp-av/gupnp-didl-lite-resource.h
+++ b/libgupnp-av/gupnp-didl-lite-resource.h
@@ -80,7 +80,6 @@ typedef struct {
         void (* _gupnp_reserved4) (void);
 } GUPnPDIDLLiteResourceClass;
 
-
 void
 gupnp_didl_lite_resource_set_uri        (GUPnPDIDLLiteResource *resource,
                                          const char            *uri);
diff --git a/libgupnp-av/gupnp-didl-lite-writer.c b/libgupnp-av/gupnp-didl-lite-writer.c
index b61011b..2afc507 100644
--- a/libgupnp-av/gupnp-didl-lite-writer.c
+++ b/libgupnp-av/gupnp-didl-lite-writer.c
@@ -52,8 +52,6 @@ struct _GUPnPDIDLLiteWriterPrivate {
         xmlNs       *pv_ns;
 
         char        *language;
-
-        gboolean    dlna_attr_present;
 };
 
 enum {
@@ -209,19 +207,6 @@ filter_attributes (xmlNode             *node,
 }
 
 static void
-check_dlna_attr (xmlNode             *node,
-                 GUPnPDIDLLiteWriter *writer)
-{
-        xmlAttr *attr;
-
-        /* check if dlna prefix is present for a node */
-        for (attr = node->properties; attr != NULL; attr = attr->next) {
-                if (attr->ns && g_strcmp0 (attr->ns->prefix, "dlna") == 0)
-                        writer->priv->dlna_attr_present = TRUE;
-        }
-}
-
-static void
 filter_node (xmlNode             *node,
              GList               *allowed,
              GUPnPDIDLLiteWriter *writer,
@@ -236,10 +221,6 @@ filter_node (xmlNode             *node,
         if (!tags_only)
                 filter_attributes (node, allowed);
 
-        // Check if dlna namespace attribute is present
-        if (!writer->priv->dlna_attr_present)
-                check_dlna_attr (node, writer);
-
         if (strcmp ((const char *) node->name, "container") == 0) {
                 is_container = TRUE;
                 container_class = xml_util_get_child_element_content (node,
@@ -298,13 +279,8 @@ apply_filter (GUPnPDIDLLiteWriter *writer,
         g_return_if_fail (GUPNP_IS_DIDL_LITE_WRITER (writer));
         g_return_if_fail (filter != NULL);
 
-        if (filter[0] == '*') {
-                /* Create DLNA namespace as we include anything anyway */
-                xmlNewNs (writer->priv->xml_node,
-                          writer->priv->dlna_ns->href,
-                          writer->priv->dlna_ns->prefix);
+        if (filter[0] == '*')
                 return;         /* Wildcard */
-        }
 
         tokens = g_strsplit (filter, ",", -1);
         g_return_if_fail (tokens != NULL);
@@ -317,12 +293,6 @@ apply_filter (GUPnPDIDLLiteWriter *writer,
              node = node->next)
                 filter_node (node, allowed, writer, tags_only);
 
-        if (writer->priv->dlna_attr_present) {
-                xmlNewNs (writer->priv->xml_node,
-                          writer->priv->dlna_ns->href,
-                          writer->priv->dlna_ns->prefix);
-        }
-
         g_list_free (allowed);
         g_strfreev (tokens);
 }
@@ -408,8 +378,6 @@ gupnp_didl_lite_writer_constructed (GObject *object)
                             (unsigned char *) "lang",
                             (unsigned char *) priv->language);
 
-        priv->dlna_attr_present = FALSE;
-
         object_class = G_OBJECT_CLASS (gupnp_didl_lite_writer_parent_class);
         if (object_class->constructed != NULL)
                 object_class->constructed (object);


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