From 33212a94d6d0cfef22ff3aced4795edba0932540 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:34:11 +0000 Subject: bug fix by match word token (FindWordEnd fixed); repaired current locale switch --- generic/tclClockFmt.c | 6 +++--- library/clock.tcl | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 5d3dcaf..a10d05d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -609,12 +609,12 @@ FindWordEnd( return ++p; } /* multi-char word */ - while (*p++ == *x++) { - if (x >= tok->tokWord.end || p >= end) { + do + if (*p++ != *x++) { /* no match -> error */ return NULL; } - }; + while (x <= tok->tokWord.end && p < end); return p; } diff --git a/library/clock.tcl b/library/clock.tcl index f874e4d..ca12f4a 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -739,7 +739,7 @@ proc ::tcl::clock::ParseClockFormatFormat {procName format locale} { # Map away the locale-dependent composite format groups - EnterLocale $locale + set locale [EnterLocale $locale] # Change locale if a fresh locale has been given on the command line. @@ -2189,6 +2189,7 @@ proc ::tcl::clock::EnterLocale { locale } { } # Select the locale, eventually load it mcpackagelocale set $locale + return $locale } #---------------------------------------------------------------------- @@ -3028,7 +3029,7 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { && [catch { LoadZoneinfoFile $timezone } - opts] } { # Check may be a legacy zone: - + if { $alias eq {} && ![catch { set tzname [dict get $LegacyTimeZone [string tolower $timezone]] }] } { @@ -4460,6 +4461,9 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { #---------------------------------------------------------------------- proc ::tcl::clock::ChangeCurrentLocale {args} { + + configure -default-locale [lindex $args 0] + variable FormatProc variable LocaleNumeralCache -- cgit v0.12