[tracker/tracker-1.0] Fix handling when no match is found by libicu charset detector
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-1.0] Fix handling when no match is found by libicu charset detector
- Date: Tue, 29 Apr 2014 18:55:13 +0000 (UTC)
commit caa0ff35986a92b9c715edcb5e0f57478f5fd30d
Author: Philip Van Hoof <philip codeminded be>
Date: Fri Mar 7 21:18:45 2014 +0100
Fix handling when no match is found by libicu charset detector
src/libtracker-extract/tracker-encoding-libicu.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-encoding-libicu.c
b/src/libtracker-extract/tracker-encoding-libicu.c
index 13327e3..feec102 100644
--- a/src/libtracker-extract/tracker-encoding-libicu.c
+++ b/src/libtracker-extract/tracker-encoding-libicu.c
@@ -35,6 +35,7 @@ tracker_encoding_guess_icu (const gchar *buffer,
const UCharsetMatch *match;
gchar *charset = NULL;
UErrorCode status;
+ const char *p_match = NULL;
detector = ucsdet_open (&status);
@@ -51,15 +52,15 @@ tracker_encoding_guess_icu (const gchar *buffer,
match = ucsdet_detect (detector, &status);
- if (U_FAILURE (status))
+ if (match == NULL || U_FAILURE (status))
goto failure;
- charset = g_strdup (ucsdet_getName (match, &status));
+ p_match = ucsdet_getName (match, &status);
+
+ if (p_match == NULL || U_FAILURE (status))
+ goto failure;
- if (U_FAILURE (status)) {
- g_free (charset);
- charset = NULL;
- }
+ charset = g_strdup ((const gchar *) p_match);
if (charset)
g_debug ("Guessing charset as '%s'", charset);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]