diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-12 09:09:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-12 09:09:05 (GMT) |
commit | 648f2bd64be3781ac7d0dc2777e5a77ff9d21e70 (patch) | |
tree | cf3ba7b5a710de362503d5d78b4073b5ef4a5fa9 | |
parent | bbb594048998c37ffff17a30ac1ababd1be5c9bf (diff) | |
parent | b2a28063811abb4c3bbe540d8e42b24c571b4588 (diff) | |
download | tcl-648f2bd64be3781ac7d0dc2777e5a77ff9d21e70.zip tcl-648f2bd64be3781ac7d0dc2777e5a77ff9d21e70.tar.gz tcl-648f2bd64be3781ac7d0dc2777e5a77ff9d21e70.tar.bz2 |
Merge 9.0
-rw-r--r-- | generic/tclClock.c | 2 | ||||
-rw-r--r-- | generic/tclClockFmt.c | 10 | ||||
-rw-r--r-- | generic/tclDecls.h | 26 | ||||
-rw-r--r-- | generic/tclInt.h | 7 | ||||
-rw-r--r-- | generic/tclObj.c | 1 | ||||
-rw-r--r-- | generic/tclStubInit.c | 4 | ||||
-rw-r--r-- | tests/clock.test | 20 |
7 files changed, 36 insertions, 34 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index 107d4e5..0664432 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -4007,7 +4007,7 @@ ClockFreeScan( Tcl_DecrRefCount(tzObjStor); } else { /* simplest case - GMT / UTC */ - opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, + opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, dataPtr->literals[LIT_GMT]); } if (opts->timezoneObj == NULL) { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index edb74ae..e46043a 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1070,7 +1070,7 @@ ObjListSearch( const char *s, *f, *sf; /* search in list */ for (i = 0; i < lstc; i++) { - s = Tcl_GetStringFromObj(lstv[i], &l); + s = TclGetStringFromObj(lstv[i], &l); if ( l >= minLen && (f = TclUtfFindEqualNC(yyInput, yyInput + maxLen, s, s + l, &sf)) > yyInput @@ -2617,7 +2617,7 @@ ClockFmtToken_AMPM_Proc( if (mcObj == NULL) { return TCL_ERROR; } - s = Tcl_GetStringFromObj(mcObj, &len); + s = TclGetStringFromObj(mcObj, &len); if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, s, len + 1); if (*tok->tokWord.start == 'p') { @@ -2775,7 +2775,7 @@ ClockFmtToken_TimeZone_Proc( return TCL_ERROR; }; objPtr = dateFmt->date.tzName; - s = Tcl_GetStringFromObj(objPtr, &len); + s = TclGetStringFromObj(objPtr, &len); if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, s, len + 1); dateFmt->output += len; @@ -2802,7 +2802,7 @@ ClockFmtToken_LocaleERA_Proc( if (mcObj == NULL) { return TCL_ERROR; } - s = Tcl_GetStringFromObj(mcObj, &len); + s = TclGetStringFromObj(mcObj, &len); if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, s, len + 1); dateFmt->output += len; @@ -2885,7 +2885,7 @@ ClockFmtToken_LocaleERAYear_Proc( return TCL_OK; } } - s = Tcl_GetStringFromObj(objPtr, &len); + s = TclGetStringFromObj(objPtr, &len); if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, s, len + 1); dateFmt->output += len; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index a2b0ec1..2acbb38 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4158,19 +4158,17 @@ extern const TclStubs *tclStubsPtr; # define Tcl_GetMaster Tcl_GetParent #endif -#ifdef USE_TCL_STUBS - /* Protect those 10 functions, make them useless through the stub table */ -# undef TclGetStringFromObj -# undef TclGetBytesFromObj -# undef TclGetUnicodeFromObj -# undef TclListObjGetElements -# undef TclListObjLength -# undef TclDictObjSize -# undef TclSplitList -# undef TclSplitPath -# undef TclFSSplitPath -# undef TclParseArgsObjv -#endif +/* Protect those 10 functions, make them useless through the stub table */ +#undef TclGetStringFromObj +#undef TclGetBytesFromObj +#undef TclGetUnicodeFromObj +#undef TclListObjGetElements +#undef TclListObjLength +#undef TclDictObjSize +#undef TclSplitList +#undef TclSplitPath +#undef TclFSSplitPath +#undef TclParseArgsObjv #if TCL_MAJOR_VERSION < 9 /* TIP #627 for 8.7 */ @@ -4236,7 +4234,7 @@ extern const TclStubs *tclStubsPtr; TclGetBytesFromObj((interp), (objPtr), (sizePtr)) : \ (Tcl_GetBytesFromObj)((interp), (objPtr), (Tcl_Size *)(void *)(sizePtr))) # define Tcl_GetStringFromObj(objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \ - TclGetStringFromObj((objPtr), (sizePtr)) : \ + (TclGetStringFromObj)((objPtr), (sizePtr)) : \ (Tcl_GetStringFromObj)((objPtr), (Tcl_Size *)(void *)(sizePtr))) # define Tcl_GetUnicodeFromObj(objPtr, sizePtr) (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclGetUnicodeFromObj((objPtr), (sizePtr)) : \ diff --git a/generic/tclInt.h b/generic/tclInt.h index 66edbb3..9ea31bc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4397,6 +4397,11 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TclGetString(objPtr) \ ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString(objPtr)) +#define TclGetStringFromObj(objPtr, lenPtr) \ + ((objPtr)->bytes \ + ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes) \ + : (Tcl_GetStringFromObj)((objPtr), (lenPtr))) + /* *---------------------------------------------------------------- * Macro used by the Tcl core to clean out an object's internal @@ -4588,7 +4593,7 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; #define TclNumUtfCharsM(numChars, bytes, numBytes) \ do { \ - Tcl_Size _count = 0, _i = (numBytes); \ + Tcl_Size _count, _i = (numBytes); \ unsigned char *_str = (unsigned char *) (bytes); \ while (_i > 0 && (*_str < 0xC0)) { _i--; _str++; } \ _count = (numBytes) - _i; \ diff --git a/generic/tclObj.c b/generic/tclObj.c index 17cb6a4..5dd4545 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1660,6 +1660,7 @@ Tcl_GetString( */ #if !defined(TCL_NO_DEPRECATED) +#undef TclGetStringFromObj char * TclGetStringFromObj( Tcl_Obj *objPtr, /* Object whose string rep byte pointer should diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 9072796..b48ec1b 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -73,10 +73,8 @@ # undef Tcl_WinConvertError # define Tcl_WinConvertError 0 #endif +#undef TclGetStringFromObj #if defined(TCL_NO_DEPRECATED) -# undef TclGetStringFromObj -# undef TclGetBytesFromObj -# undef TclGetUnicodeFromObj # define TclGetStringFromObj 0 # define TclGetBytesFromObj 0 # define TclGetUnicodeFromObj 0 diff --git a/tests/clock.test b/tests/clock.test index 00e6cb0..3cfba06 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -15391,7 +15391,7 @@ test clock-4.97.8 { format JDN/JD (calendar and astronomical) } { set res {} foreach i { -172800 -129600 -86400 -43200 - -1 0 1 21600 43199 43200 86399 + -1 0 1 21600 43199 43200 86399 86400 86401 108000 129600 172800 } { lappend res $i [clock format [expr {-210866803200 - $i}] \ @@ -15420,7 +15420,7 @@ test clock-4.97.9 { format JDN/JD (calendar and astronomical) } { set res {} foreach i { -86400 -43200 - -1 0 1 + -1 0 1 43199 43200 43201 86400 } { lappend res $i [clock format [expr {653133196800 + $i}] \ @@ -21452,7 +21452,7 @@ test clock-9.2.1 {Calendar julian day (with time fraction) takes precedence over list \ [clock scan {2440588.0 20000101 010203} -format {%EJ %Y%m%d %H%M%S} -gmt true] \ [clock scan {2440588.5 20000101 010203} -format {%EJ %Y%m%d %H%M%S} -gmt true] - + } {0 43200} test clock-9.3 {Astro julian day takes always precedence over date-time} { list \ @@ -37141,7 +37141,7 @@ unset -nocomplain idx relstr set dst_hole_check { {":Europe/Berlin" - "2017-03-26 01:59:59" "2017-03-26 02:00:00" "2017-03-26 02:59:59" "2017-03-26 03:00:00" + "2017-03-26 01:59:59" "2017-03-26 02:00:00" "2017-03-26 02:59:59" "2017-03-26 03:00:00" "2017-10-29 01:59:59" "2017-10-29 02:00:00"} {":Europe/Berlin" "2018-03-25 01:59:59" "2018-03-25 02:00:00" "2018-03-25 02:59:59" "2018-03-25 03:00:00" @@ -37150,14 +37150,14 @@ set dst_hole_check { "2017-03-12 01:59:59" "2017-03-12 02:00:00" "2017-03-12 02:59:59" "2017-03-12 03:00:00" "2017-11-05 01:59:59" "2017-11-05 02:00:00"} {":America/New_York" - "2018-03-11 01:59:59" "2018-03-11 02:00:00" "2018-03-11 02:59:59" "2018-03-11 03:00:00" + "2018-03-11 01:59:59" "2018-03-11 02:00:00" "2018-03-11 02:59:59" "2018-03-11 03:00:00" "2018-11-04 01:59:59" "2018-11-04 02:00:00"} } test clock-46.19-1 {free-scan: validation rules: invalid time (DST-hole, out of range in time-zone)} \ -body { set res {} foreach tz $dst_hole_check { set dt [lassign $tz tz]; foreach dt $dt { - lappend res [set v [catch {clock scan $dt -timezone $tz -valid 1} msg]] + lappend res [set v [catch {clock scan $dt -timezone $tz -valid 1} msg]] if {$v} { lappend res $msg } }} set res @@ -37170,7 +37170,7 @@ test clock-46.19-2 {free-scan: validation rules regression: all scans successful set res {} set res {} foreach tz $dst_hole_check { set dt [lassign $tz tz]; foreach dt $dt { - lappend res [set v [catch {clock scan $dt -timezone $tz} msg]] + lappend res [set v [catch {clock scan $dt -timezone $tz} msg]] }} set res } -cleanup { @@ -37180,7 +37180,7 @@ test clock-46.19-3 {scan: validation rules: invalid time (DST-hole, out of range -body { set res {} foreach tz $dst_hole_check { set dt [lassign $tz tz]; foreach dt $dt { - lappend res [set v [catch {clock scan $dt -timezone $tz -format "%Y-%m-%d %H:%M:%S" -valid 1} msg]] + lappend res [set v [catch {clock scan $dt -timezone $tz -format "%Y-%m-%d %H:%M:%S" -valid 1} msg]] if {$v} { lappend res $msg } }} set res @@ -37193,7 +37193,7 @@ test clock-46.19-4 {scan: validation rules regression: all scans successful, if set res {} set res {} foreach tz $dst_hole_check { set dt [lassign $tz tz]; foreach dt $dt { - lappend res [set v [catch {clock scan $dt -timezone $tz -format "%Y-%m-%d %H:%M:%S"} msg]] + lappend res [set v [catch {clock scan $dt -timezone $tz -format "%Y-%m-%d %H:%M:%S"} msg]] }} set res } -cleanup { @@ -37286,7 +37286,7 @@ test clock-46.31 {scan: validation rules: invalid iso year} -setup { clock configure {*}$orgcfg unset -nocomplain orgcfg } - + test clock-47.1 {regression test - four-digit time} { clock scan 0012 } [clock scan 0012 -format %H%M] |