[tracker] libtracker-data: Fix fn:starts-with for libunistring and glib collators



commit 6a3ac91254e7c7f057a9f6bf8efb6312c0175eb7
Author: Jürg Billeter <j bitron ch>
Date:   Wed Feb 2 16:58:03 2011 +0100

    libtracker-data: Fix fn:starts-with for libunistring and glib collators
    
    Fixes GB#636074.

 src/libtracker-data/libtracker-data.vapi           |    3 +++
 src/libtracker-data/tracker-collation.h            |    7 +++++++
 src/libtracker-data/tracker-sparql-expression.vala |    2 +-
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index 0caf4b6..cc213ea 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -200,4 +200,7 @@ namespace Tracker {
 
 	[CCode (cheader_filename = "libtracker-data/tracker-db-interface-sqlite.h")]
 	public const string COLLATION_NAME;
+
+	[CCode (cheader_filename = "libtracker-data/tracker-collation.h")]
+	public const unichar COLLATION_LAST_CHAR;
 }
diff --git a/src/libtracker-data/tracker-collation.h b/src/libtracker-data/tracker-collation.h
index 469349a..93afae2 100644
--- a/src/libtracker-data/tracker-collation.h
+++ b/src/libtracker-data/tracker-collation.h
@@ -34,6 +34,13 @@ gint     tracker_collation_utf8     (gpointer      collator,
                                      gint          len2,
                                      gconstpointer str2);
 
+#ifdef HAVE_LIBICU
+#define TRACKER_COLLATION_LAST_CHAR ((gunichar) 0x10fffd)
+#else
+/* glibc-based collators do not properly sort private use characters */
+#define TRACKER_COLLATION_LAST_CHAR ((gunichar) 0x9fa5)
+#endif
+
 G_END_DECLS
 
 #endif /* __LIBTRACKER_COMMON_COLLATION_H__ */
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index 760cc90..299bfe8 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -450,7 +450,7 @@ class Tracker.Sparql.Expression : Object {
 
 			sql.append ("?");
 			binding = new LiteralBinding ();
-			binding.literal = prefix + ((unichar) 0x10fffd).to_string ();
+			binding.literal = prefix + COLLATION_LAST_CHAR.to_string ();
 			query.bindings.append (binding);
 
 			return PropertyType.BOOLEAN;



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