[tracker/wip/carlosg/sparql-parser-ng: 31/50] libtracker-data: Preprocess \u and \U sequences in SPARQL queries



commit a089cf6ad5be7bf5de3660f0b9c516469fc395cc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Sep 22 22:43:56 2018 +0200

    libtracker-data: Preprocess \u and \U sequences in SPARQL queries

 src/libtracker-data/tracker-sparql.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 34c2188a7..da7dd8506 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -95,7 +95,7 @@ struct _TrackerSparql
 {
        GObject parent_instance;
        TrackerDataManager *data_manager;
-       const gchar *sparql;
+       gchar *sparql;
 
        TrackerNodeTree *tree;
        GError *parser_error;
@@ -166,6 +166,8 @@ tracker_sparql_finalize (GObject *object)
        if (sparql->blank_nodes)
                g_variant_builder_unref (sparql->blank_nodes);
 
+       g_free (sparql->sparql);
+
        G_OBJECT_CLASS (tracker_sparql_parent_class)->finalize (object);
 }
 
@@ -6210,7 +6212,7 @@ tracker_sparql_new (TrackerDataManager *manager,
 
        sparql = g_object_new (TRACKER_TYPE_SPARQL, NULL);
        sparql->data_manager = g_object_ref (manager);
-       sparql->sparql = query;
+       sparql->sparql = tracker_unescape_unichars (query, -1);
 
        tree = tracker_sparql_parse_query (sparql->sparql, -1, NULL,
                                           &sparql->parser_error);
@@ -6353,7 +6355,7 @@ tracker_sparql_new_update (TrackerDataManager *manager,
 
        sparql = g_object_new (TRACKER_TYPE_SPARQL, NULL);
        sparql->data_manager = g_object_ref (manager);
-       sparql->sparql = query;
+       sparql->sparql = tracker_unescape_unichars (query, -1);
 
        tree = tracker_sparql_parse_update (sparql->sparql, -1, &len,
                                            &sparql->parser_error);


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