[tracker/version-macros: 7/9] libtracker-common: Set the declared locale before calling detect()



commit 772f7b03a5cbc28ee105ce26d538a49c33422e18
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Mar 31 11:19:31 2011 +0200

    libtracker-common: Set the declared locale before calling detect()

 .../tracker-encoding-meegotouch.cpp                |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-common/tracker-encoding-meegotouch.cpp b/src/libtracker-common/tracker-encoding-meegotouch.cpp
index 29502f5..5d583cc 100644
--- a/src/libtracker-common/tracker-encoding-meegotouch.cpp
+++ b/src/libtracker-common/tracker-encoding-meegotouch.cpp
@@ -45,17 +45,18 @@ tracker_encoding_guess_meegotouch (const gchar *buffer,
 		return NULL;
 	}
 
+	locale = tracker_locale_get (TRACKER_LOCALE_LANGUAGE);
+	detector.setDeclaredLocale (locale);
+
 	MCharsetMatch bestMatch = detector.detect ();
 
 	if (detector.hasError ()) {
 		g_warning ("Charset detector error when detecting: %s",
 		           detector.errorString ().toUtf8 (). data ());
+		g_free (locale);
 		return NULL;
 	}
 
-	locale = tracker_locale_get (TRACKER_LOCALE_LANGUAGE);
-	detector.setDeclaredLocale (locale);
-
 	if (bestMatch.confidence () > 30) {
 		encoding = g_strdup (bestMatch.name ().toUtf8 ().data ());
 



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