[tracker/sam/json-uint] libtracker-sparql: Don't try to create JSON nodes with unsigned integers



commit 8cec529629a1c805dd9c5ca6ab57e0de96c7b530
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Apr 1 12:57:38 2019 +0200

    libtracker-sparql: Don't try to create JSON nodes with unsigned integers
    
    It turns out that json-glib only allows signed integer fields. This
    fixes missing values when running `tracker-extract -o json-ld` in
    certain cases. If you hit this bug you might also see the following
    error:
    
            Invalid value of type 'guint'

 src/libtracker-sparql/tracker-resource.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/libtracker-sparql/tracker-resource.c b/src/libtracker-sparql/tracker-resource.c
index a5d006270..989fafb65 100644
--- a/src/libtracker-sparql/tracker-resource.c
+++ b/src/libtracker-sparql/tracker-resource.c
@@ -1595,6 +1595,10 @@ generate_jsonld_value (const GValue       *value,
                node = json_node_new (JSON_NODE_VALUE);
                json_node_set_string (node, uri);
                json_builder_add_value (data->builder, node);
+       } else if (G_VALUE_HOLDS (value, G_TYPE_UINT)) {
+               node = json_node_new (JSON_NODE_VALUE);
+               json_node_set_int (node, g_value_get_uint(value));
+               json_builder_add_value (data->builder, node);
        } else {
                node = json_node_new (JSON_NODE_VALUE);
                json_node_set_value (node, value);


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