aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2006-04-11 07:16:38 +0800
committerTor Lillqvist <tml@src.gnome.org>2006-04-11 07:16:38 +0800
commit77027331dec11dc8bbdddf5f1dbe568de2286fd3 (patch)
tree1bc48447c23bc3e2032423e86dd597384ef066b1
parente7c558b78448f65fdcec0b0f533521751741cafd (diff)
downloadgsoc2013-evolution-77027331dec11dc8bbdddf5f1dbe568de2286fd3.tar.gz
gsoc2013-evolution-77027331dec11dc8bbdddf5f1dbe568de2286fd3.tar.zst
gsoc2013-evolution-77027331dec11dc8bbdddf5f1dbe568de2286fd3.zip
[Win32] Instead of %l (which is a GNU extension not implemented in the
2006-03-27 Tor Lillqvist <tml@novell.com> * e-util.c (fix_percent_l): [Win32] Instead of %l (which is a GNU extension not implemented in the Microsoft C library) use %I. Fixes #336055. (e_strftime_fix_am_pm): Call fix_percent_l() when necessary. svn path=/trunk/; revision=31807
-rw-r--r--e-util/ChangeLog7
-rw-r--r--e-util/e-util.c30
2 files changed, 37 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 5b4551ffb9..09a90bfe8e 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-27 Tor Lillqvist <tml@novell.com>
+
+ * e-util.c (fix_percent_l): [Win32] Instead of %l (which is a GNU
+ extension not implemented in the Microsoft C library) use %I.
+ Fixes #336055.
+ (e_strftime_fix_am_pm): Call fix_percent_l() when necessary.
+
2006-02-12 Karsten Bräckelmann <guenther@rudersport.de>
* e-error.c (e_error_newv):
diff --git a/e-util/e-util.c b/e-util/e-util.c
index d364a06ec9..73a1842919 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -679,6 +679,24 @@ e_sort (void *base,
#endif
}
+#ifdef G_OS_WIN32
+static void
+fix_percent_l(const char **fmt, char **newfmt)
+{
+ /* %l is not implemented in the Microsoft C library. Use %I
+ * instead. Don't bother that we get a leading zero instead of
+ * leading blank for hours 0..9.
+ */
+ if (strstr(*fmt, "%l")!=NULL) {
+ char *p;
+ *newfmt=g_strdup(*fmt);
+ p=strstr(*newfmt, "%l");
+ p[1]='I';
+ *fmt=*newfmt;
+ }
+}
+#endif
+
/**
* Function to do a last minute fixup of the AM/PM stuff if the locale
* and gettext haven't done it right. Most English speaking countries
@@ -703,9 +721,15 @@ size_t e_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct t
char *sp;
char *ffmt;
size_t ret;
+#ifdef G_OS_WIN32
+ char *newfmt=NULL;
+#endif
if (strstr(fmt, "%p")==NULL && strstr(fmt, "%P")==NULL) {
/* No AM/PM involved - can use the fmt string directly */
+#ifdef G_OS_WIN32
+ fix_percent_l(&fmt, &newfmt);
+#endif
ret=e_strftime(s, max, fmt, tm);
} else {
/* Get the AM/PM symbol from the locale */
@@ -716,6 +740,9 @@ size_t e_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct t
* AM/PM have been defined in the locale
* so we can use the fmt string directly
**/
+#ifdef G_OS_WIN32
+ fix_percent_l(&fmt, &newfmt);
+#endif
ret=e_strftime(s, max, fmt, tm);
} else {
/**
@@ -737,6 +764,9 @@ size_t e_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct t
g_free(ffmt);
}
}
+#ifdef G_OS_WIN32
+ g_free(newfmt);
+#endif
return(ret);
}