From eba9622d5e8f394fdcba22a68f5d5be05611963b Mon Sep 17 00:00:00 2001 From: gambas Date: Tue, 6 Jul 2021 23:22:24 +0200 Subject: [PATCH] Date formatting with escaped characters works correctly again. [INTERPRETER] * BUG: Date formatting with escaped characters works correctly again. --- main/gbx/gbx_exec_loop.c | 2 +- main/gbx/gbx_local.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/main/gbx/gbx_exec_loop.c b/main/gbx/gbx_exec_loop.c index a5e2a5459..8a9a0f080 100644 --- a/main/gbx/gbx_exec_loop.c +++ b/main/gbx/gbx_exec_loop.c @@ -4029,7 +4029,7 @@ static void _break(ushort code) //fprintf(stderr, "%s %d\n", DEBUG_get_current_position(), DEBUG_info->watch); - if (CP && CP->component == NULL) + if (CP) // && CP->component == NULL) { if (EXEC_profile_instr) DEBUG.Profile.Add(CP, FP, PC); diff --git a/main/gbx/gbx_local.c b/main/gbx/gbx_local.c index c33431da8..4a48fa054 100644 --- a/main/gbx/gbx_local.c +++ b/main/gbx/gbx_local.c @@ -1875,16 +1875,14 @@ bool LOCAL_format_date(const DATE_SERIAL *date, int fmt_type, const char *fmt, i { c = fmt[pos]; - if (quote) - { - COMMON_put_char(c); - quote = FALSE; - continue; - } - else if (c == '\\') + if (c == '\\') { + pos++; + c = fmt[pos]; + if (!c) + break; + c = 1; // something not null that cannot be a token quote = TRUE; - continue; } if (c == token) @@ -1926,7 +1924,7 @@ bool LOCAL_format_date(const DATE_SERIAL *date, int fmt_type, const char *fmt, i else { if (c != ' ' || token == 0 || COMMON_pos > 0) - COMMON_put_char(c); + COMMON_put_char(quote ? fmt[pos] : c); } token = 0;