[evolution-data-server] Bug 553770 - e_time_get_d_fmt_with_4digit_year: Correct %y replacement
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 553770 - e_time_get_d_fmt_with_4digit_year: Correct %y replacement
- Date: Mon, 28 Aug 2017 10:49:16 +0000 (UTC)
commit 3a86b3085c8514d2de7a4d81d2cfdd0000405e6d
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 28 12:49:37 2017 +0200
Bug 553770 - e_time_get_d_fmt_with_4digit_year: Correct %y replacement
src/libedataserver/e-time-utils.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/libedataserver/e-time-utils.c b/src/libedataserver/e-time-utils.c
index b4cd61b..748b006 100644
--- a/src/libedataserver/e-time-utils.c
+++ b/src/libedataserver/e-time-utils.c
@@ -2119,7 +2119,10 @@ static gint _e_string_replace (gchar **str, const gchar *old, const gchar *new)
* e_time_get_d_fmt_with_4digit_year:
*
* Retrieves a date format string with a 4-digit year (D_FMT on systems with
- * nl_langinfo() available). Free the returned string with g_free().
+ * nl_langinfo() available). In case the current locale doesn't support 4-digit
+ * year, the function returns format as specified by the locale.
+ *
+ * Free the returned string with g_free().
*
* Returns: a newly-allocated date format string
*
@@ -2172,8 +2175,10 @@ e_time_get_d_fmt_with_4digit_year (void)
res = g_strdup ("%x");
#endif
- while (p = strchr (res, 'y'), p)
- *p = 'Y';
+ for (p = res; p && *p; p++) {
+ if (*p == 'y' && p != res && p[-1] == '%')
+ *p = 'Y';
+ }
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]