From dc46e9d20b83e755bc49e090ce49900c11659c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 19 Sep 2015 22:55:43 +0000 Subject: [PATCH] [INTERPRETER] * BUG: Val() correctly detect dates now, when the date or the time separator is a space character. git-svn-id: svn://localhost/gambas/trunk@7326 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbx/gbx_date.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/main/gbx/gbx_date.c b/main/gbx/gbx_date.c index 5d7922a81..77454c7ff 100644 --- a/main/gbx/gbx_date.c +++ b/main/gbx/gbx_date.c @@ -481,7 +481,17 @@ bool DATE_from_string(const char *str, int len, VALUE *val, bool local) c = COMMON_get_unicode_char(); - if ((c < 0) || isspace(c)) + if (c == info->date_sep) + { + set_date(&date, info->date_order[0], nbr); + set_date(&date, info->date_order[1], nbr2); + + if (read_integer(&nbr)) + return TRUE; + + set_date(&date, info->date_order[2], nbr); + } + else if ((c < 0) || isspace(c)) { i = 0; @@ -493,16 +503,6 @@ bool DATE_from_string(const char *str, int len, VALUE *val, bool local) if (info->date_order[i] == LO_YEAR) i++; set_date(&date, info->date_order[i], nbr2); } - else if (c == info->date_sep) - { - set_date(&date, info->date_order[0], nbr); - set_date(&date, info->date_order[1], nbr2); - - if (read_integer(&nbr)) - return TRUE; - - set_date(&date, info->date_order[2], nbr); - } jump_space(); @@ -525,17 +525,7 @@ bool DATE_from_string(const char *str, int len, VALUE *val, bool local) c = COMMON_get_unicode_char(); - if ((c < 0) || isspace(c)) - { - i = 0; - - if (info->time_order[i] == LO_SECOND) i++; - set_time(&date, info->time_order[i], nbr); i++; - - if (info->time_order[i] == LO_SECOND) i++; - set_time(&date, info->time_order[i], nbr2); - } - else if (c == info->time_sep) + if (c == info->time_sep) { set_time(&date, info->time_order[0], nbr); set_time(&date, info->time_order[1], nbr2); @@ -553,6 +543,16 @@ bool DATE_from_string(const char *str, int len, VALUE *val, bool local) date.msec = nbr; } } + else if ((c < 0) || isspace(c)) + { + i = 0; + + if (info->time_order[i] == LO_SECOND) i++; + set_time(&date, info->time_order[i], nbr); i++; + + if (info->time_order[i] == LO_SECOND) i++; + set_time(&date, info->time_order[i], nbr2); + } c = get_char(); if ((c < 0) || isspace(c))