[tracker/tracker-0.6] Fixes NB#126255, Image:Date is empty for some of the images
- From: Mikael Ottela <mottela src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.6] Fixes NB#126255, Image:Date is empty for some of the images
- Date: Mon, 28 Sep 2009 10:36:45 +0000 (UTC)
commit 71ab0673b4afd5ca6f2aa447e5634b523ef0d4fe
Author: Mikael Ottela <mikael ottela ixonos com>
Date: Mon Sep 28 13:30:22 2009 +0300
Fixes NB#126255, Image:Date is empty for some of the images
src/libtracker-common/tracker-type-utils.c | 14 +++++++++-----
tests/libtracker-common/tracker-type-utils-test.c | 4 ++++
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-common/tracker-type-utils.c b/src/libtracker-common/tracker-type-utils.c
index 06b2036..e39c24c 100644
--- a/src/libtracker-common/tracker-type-utils.c
+++ b/src/libtracker-common/tracker-type-utils.c
@@ -81,11 +81,9 @@ get_remainder_multiplier (gint remainder)
return mult;
}
-/* FIXME This function is crap and it doing unnecessary
- * allocations (splits) all over the place.
- * FIXME We still don't handle large years or year-week
+/* FIXME We still do not handle large years or year-week
* or year-day-formats (not that they would be common in
- * file formats
+ * file formats)
*/
static gboolean
tracker_simplify_8601 (const gchar *date_string,
@@ -131,7 +129,13 @@ tracker_simplify_8601 (const gchar *date_string,
}
if (!timezone_sep) {
- time = g_strdup (time_part);
+ /* Remove a trailing Z */
+ len = strlen (time_part);
+
+ if (time_part[len-1] == 'Z')
+ len--;
+
+ time = g_strndup (time_part, len);
zone = g_strdup ("+00:00");
} else {
pieces = g_strsplit_set (time_part, "+-", -1);
diff --git a/tests/libtracker-common/tracker-type-utils-test.c b/tests/libtracker-common/tracker-type-utils-test.c
index 60d857f..479c97c 100644
--- a/tests/libtracker-common/tracker-type-utils-test.c
+++ b/tests/libtracker-common/tracker-type-utils-test.c
@@ -131,6 +131,10 @@ test_date_format (void)
/* Timezone and UTC */
+ result = tracker_date_format ("1979-03-04T16:03Z");
+ g_assert (tracker_test_helpers_cmpstr_equal (result, "1979-03-04T16:03:00+00:00"));
+ g_free (result);
+
result = tracker_date_format ("1979-03-04 16:03:03.5Z");
g_assert (tracker_test_helpers_cmpstr_equal (result, "1979-03-04T16:03:03+00:00"));
g_free (result);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]