[tracker] libtracker-common: Fixed tracker_is_blank_string() to be UTF8 compliant



commit c10bff86a27151d8186e5348a5f3efdb3dd503d2
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Nov 4 16:44:11 2009 +0000

    libtracker-common: Fixed tracker_is_blank_string() to be UTF8 compliant

 src/libtracker-common/tracker-utils.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-common/tracker-utils.c b/src/libtracker-common/tracker-utils.c
index 0bce806..4897653 100644
--- a/src/libtracker-common/tracker-utils.c
+++ b/src/libtracker-common/tracker-utils.c
@@ -38,18 +38,20 @@ tracker_is_empty_string (const char *str)
 inline gboolean
 tracker_is_blank_string (const char *str)
 {
-	register gint len, i;
+	register const gchar *p;
 
 	if (str == NULL || str[0] == '\0') {
 		return TRUE;
 	}
 
-	len = strlen (str);
+        for (p = str; *p; p = g_utf8_next_char (p)) {
+		register gunichar c;
 
-	for (i = 0; i < len; i++) {
-		if (str[i] != ' ') {
-			return FALSE;
-		}
+                c = g_utf8_get_char (p);
+
+                if (!g_unichar_isspace (c)) {
+                        return FALSE;
+                }
 	}
 
 	return TRUE;



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