gnucash master: Bug 497831 - Can't change the date of a transaction with certain locales
Geert Janssens
gjanssens at code.gnucash.org
Sat Feb 22 12:09:20 EST 2014
Updated via https://github.com/Gnucash/gnucash/commit/6925192a (commit)
from https://github.com/Gnucash/gnucash/commit/50c64199 (commit)
commit 6925192aff91524e4c9ae4f3ef847095e4029e17
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Sat Feb 22 18:08:19 2014 +0100
Bug 497831 - Can't change the date of a transaction with certain locales
This patch fixes the issue for the cs_CZ locale.
diff --git a/src/libqof/qof/gnc-date.c b/src/libqof/qof/gnc-date.c
index 49738b7..2bfbf7d 100644
--- a/src/libqof/qof/gnc-date.c
+++ b/src/libqof/qof/gnc-date.c
@@ -1121,10 +1121,30 @@ qof_scan_date_internal (const char *buff, int *day, int *month, int *year,
if (buff[0] != '\0')
{
struct tm thetime;
+ gchar *format = g_strdup (GNC_D_FMT);
+ gchar *stripped_format = g_strdup (GNC_D_FMT);
+ gint counter = 0, stripped_counter = 0;
+
+ /* strptime can't handle the - format modifier
+ * let's strip it out of the format before using it
+ */
+ while (format[counter] != '\0')
+ {
+ stripped_format[stripped_counter] = format[counter];
+ if ((format[counter] == '%') && (format[counter+1] == '-'))
+ counter++; // skip - format modifier
+
+ counter++;
+ stripped_counter++;
+ }
+ stripped_format[stripped_counter] = '\0';
+ g_free (format);
+
/* Parse time string. */
memset(&thetime, -1, sizeof(struct tm));
- strptime (buff, GNC_D_FMT, &thetime);
+ strptime (buff, stripped_format, &thetime);
+ g_free (stripped_format);
if (third_field)
{
Summary of changes:
src/libqof/qof/gnc-date.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list