[tracker] libtracker-extract: text_len is unsigned, made it signed



commit 445e070b421486c3ad73fdb1071b55929476e9af
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon May 24 10:24:37 2010 +0200

    libtracker-extract: text_len is unsigned, made it signed

 src/libtracker-extract/tracker-utils.c |   10 +++++++---
 src/libtracker-extract/tracker-utils.h |    2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-utils.c b/src/libtracker-extract/tracker-utils.c
index 3971a62..fb6fbb3 100644
--- a/src/libtracker-extract/tracker-utils.c
+++ b/src/libtracker-extract/tracker-utils.c
@@ -375,18 +375,22 @@ tracker_text_normalize (const gchar *text,
  **/
 gboolean
 tracker_text_validate_utf8 (const gchar  *text,
-                            gsize         text_len,
+                            gssize        text_len,
                             GString     **str,
                             gsize        *valid_len)
 {
+	gsize len_to_validate;
+
 	g_return_val_if_fail (text, FALSE);
 
-	if (text_len > 0) {
+	len_to_validate = text_len >= 0 ? text_len : strlen (text);
+
+	if (len_to_validate > 0) {
 		const gchar *end = text;
 
 		/* Validate string, getting the pointer to first non-valid character
 		 *  (if any) or to the end of the string. */
-		g_utf8_validate (text, text_len, &end);
+		g_utf8_validate (text, len_to_validate, &end);
 		if (end > text) {
 			/* If str output required... */
 			if (str) {
diff --git a/src/libtracker-extract/tracker-utils.h b/src/libtracker-extract/tracker-utils.h
index 5b048a6..5f6aadd 100644
--- a/src/libtracker-extract/tracker-utils.h
+++ b/src/libtracker-extract/tracker-utils.h
@@ -40,7 +40,7 @@ gchar*       tracker_text_normalize         (const gchar *text,
 #endif /* TRACKER_DISABLE_DEPRECATED */
 
 gboolean     tracker_text_validate_utf8     (const gchar  *text,
-                                             gsize         text_len,
+                                             gssize        text_len,
                                              GString     **str,
                                              gsize        *valid_len);
 gchar*       tracker_date_guess             (const gchar *date_string);



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