[gnome-software] trivial: Detect metadata keys with no content



commit 2ca0131891aeb1a7a97b3746d5216d3917f29851
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 27 14:32:42 2014 +0000

    trivial: Detect metadata keys with no content
    
    This is what kudos use.

 src/plugins/appstream-cache.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/appstream-cache.c b/src/plugins/appstream-cache.c
index 3fe2e58..6a8b9a2 100644
--- a/src/plugins/appstream-cache.c
+++ b/src/plugins/appstream-cache.c
@@ -651,8 +651,14 @@ appstream_cache_end_element_cb (GMarkupParseContext *context,
                helper->tag = APPSTREAM_TAG_APPLICATIONS;
                break;
        case APPSTREAM_TAG_VALUE:
-               g_free (helper->lang_temp);
-               helper->lang_temp = NULL;
+               /* a tag with no content, e.g. <value key=name/> */
+               if (helper->lang_temp != NULL) {
+                       appstream_app_add_metadata (helper->item_temp,
+                                                   helper->lang_temp,
+                                                   "", 0);
+                       g_free (helper->lang_temp);
+                       helper->lang_temp = NULL;
+               }
                helper->tag = APPSTREAM_TAG_METADATA;
                break;
        default:
@@ -736,6 +742,8 @@ appstream_cache_text_cb (GMarkupParseContext *context,
                                            helper->lang_temp,
                                            text,
                                            text_len);
+               g_free (helper->lang_temp);
+               helper->lang_temp = NULL;
                break;
        case APPSTREAM_TAG_COMPULSORY_FOR_DESKTOP:
                if (helper->item_temp == NULL) {


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