From a8e3213d433c2cb886e1abc7b985c7fa362d3a3d Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 18 Mar 2020 21:03:06 +0000 Subject: TIP 568 proposes new public routine Tcl_GetBytesFromObj. --- generic/tcl.decls | 6 ++++++ generic/tclBinary.c | 6 +++--- generic/tclDecls.h | 6 ++++++ generic/tclInt.h | 2 -- generic/tclStubInit.c | 1 + 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 2575de1..5d6f6be 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2402,6 +2402,12 @@ declare 648 { int length, Tcl_DString *dsPtr) } +# TIP #568 +declare 649 { + unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + int *lengthPtr) +} + # ----- BASELINE -- FOR -- 8.7.0 ----- # ############################################################################## diff --git a/generic/tclBinary.c b/generic/tclBinary.c index a050122..0adacfc 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -440,7 +440,7 @@ Tcl_SetByteArrayObj( /* *---------------------------------------------------------------------- * - * TclGetBytesFromObj -- + * Tcl_GetBytesFromObj -- * * Attempt to extract the value from objPtr in the representation * of a byte sequence. On success return the extracted byte sequence. @@ -455,7 +455,7 @@ Tcl_SetByteArrayObj( */ unsigned char * -TclGetBytesFromObj( +Tcl_GetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ int *lengthPtr) /* If non-NULL, filled with length of the @@ -519,7 +519,7 @@ Tcl_GetByteArrayFromObj( { ByteArray *baPtr; const Tcl_ObjIntRep *irPtr; - unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr); + unsigned char *result = Tcl_GetBytesFromObj(NULL, objPtr, lengthPtr); if (result) { return result; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 890114a..69d98d9 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1921,6 +1921,9 @@ EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr, /* 648 */ EXTERN int * Tcl_UtfToUniCharDString(const char *src, int length, Tcl_DString *dsPtr); +/* 649 */ +EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, int *lengthPtr); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2605,6 +2608,7 @@ typedef struct TclStubs { int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, int uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 648 */ + unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); /* 649 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3933,6 +3937,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_UniCharToUtfDString) /* 647 */ #define Tcl_UtfToUniCharDString \ (tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */ +#define Tcl_GetBytesFromObj \ + (tclStubsPtr->tcl_GetBytesFromObj) /* 649 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclInt.h b/generic/tclInt.h index be6f26e..56009c2 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3026,8 +3026,6 @@ MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); -MODULE_SCOPE unsigned char * TclGetBytesFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, int *lengthPtr); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *chanPtr, int *modePtr, int flags); diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index fbbac6d..6e70938 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1865,6 +1865,7 @@ const TclStubs tclStubs = { Tcl_UtfToUniChar, /* 646 */ Tcl_UniCharToUtfDString, /* 647 */ Tcl_UtfToUniCharDString, /* 648 */ + Tcl_GetBytesFromObj, /* 649 */ }; /* !END!: Do not edit above this line. */ -- cgit v0.12 From f0082ebb735bf9dbb9edb45a2f3c952a1e7f10c6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 1 Apr 2020 13:40:27 +0000 Subject: Remove variable "properByteArrayType" from tclTest.c, because it isn't used any more. --- generic/tclTest.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 3e1eff3..867cf39 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -47,7 +47,6 @@ DLLEXPORT int Tcltest_SafeInit(Tcl_Interp *interp); static Tcl_DString delString; static Tcl_Interp *delInterp; -static const Tcl_ObjType *properByteArrayType; /* * One of the following structures exists for each asynchronous handler @@ -457,11 +456,6 @@ Tcltest_Init( return TCL_ERROR; } - objPtr = Tcl_NewStringObj("abc", 3); - (void)Tcl_GetByteArrayFromObj(objPtr, &index); - properByteArrayType = objPtr->typePtr; - Tcl_DecrRefCount(objPtr); - /* * Create additional commands and math functions for testing Tcl. */ -- cgit v0.12 From 56938ac247374b9d6770ed3eb41cff5f96fa52e1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Jan 2021 15:59:11 +0000 Subject: Make Tcl_GetBytesFromObj work with size_t length parameter (just as Tcl_GetByteArrayFromObj in TIP #481. Add documentation for the new function --- doc/ByteArrObj.3 | 15 +++++++++++--- generic/tcl.decls | 6 +++++- generic/tclBinary.c | 55 +++++++++++++++++++++++++++++++++++++++++++-------- generic/tclDecls.h | 20 +++++++++++++------ generic/tclIO.c | 2 +- generic/tclStubInit.c | 4 ++-- generic/tclZipfs.c | 2 +- generic/tclZlib.c | 26 ++++++++++++------------ 8 files changed, 95 insertions(+), 35 deletions(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index ff0b4e1..ecc51b0 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -8,7 +8,7 @@ .so man.macros .BS .SH NAME -Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetByteArrayFromObj, Tcl_SetByteArrayLength \- manipulate Tcl values as a arrays of bytes +Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetByteArrayFromObj, Tcl_GetBytesFromObj, Tcl_SetByteArrayLength \- manipulate Tcl values as a arrays of bytes .SH SYNOPSIS .nf \fB#include \fR @@ -23,9 +23,14 @@ unsigned char * \fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, lengthPtr\fR) .sp unsigned char * +\fBTcl_GetBytesFromObj\fR(\fIinterp, objPtr, lengthPtr\fR) +.sp +unsigned char * \fBTcl_SetByteArrayLength\fR(\fIobjPtr, length\fR) .SH ARGUMENTS .AS "const unsigned char" *lengthPtr in/out +.AP Tcl_Interp *interp in +Interpreter to use for error reporting. .AP "const unsigned char" *bytes in The array of bytes used to initialize or set a byte-array value. May be NULL even if \fIlength\fR is non-zero. @@ -33,11 +38,11 @@ even if \fIlength\fR is non-zero. The length of the array of bytes. It must be >= 0. .AP Tcl_Obj *objPtr in/out For \fBTcl_SetByteArrayObj\fR, this points to the value to be converted to -byte-array type. For \fBTcl_GetByteArrayFromObj\fR and +byte-array type. For \fBTcl_GetByteArrayFromObj\fR, \fBTcl_GetBytesFromObj\fR and \fBTcl_SetByteArrayLength\fR, this points to the value from which to get the byte-array value; if \fIobjPtr\fR does not already point to a byte-array value, it will be converted to one. -.AP int *lengthPtr out +.AP size_t | int *lengthPtr out If non-NULL, filled with the length of the array of bytes in the value. .BE @@ -75,6 +80,10 @@ the value and should not be freed. The contents of the array may be modified by the caller only if the value is not shared and the caller invalidates the string representation. .PP +\fBTcl_GetBytesFromObj\fR does almost the same as \fBTcl_GetByteArrayFromObj\fR, +the difference is that this function can error if the object contains +characters > 255. If \fBinterp\fR is not NULL, an error-message will be left there. +.PP \fBTcl_SetByteArrayLength\fR converts the Tcl value to byte-array type and changes the length of the value's internal representation as an array of bytes. If \fIlength\fR is greater than the space currently diff --git a/generic/tcl.decls b/generic/tcl.decls index 0324af8..b0de918 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2404,9 +2404,13 @@ declare 648 { # TIP #568 declare 649 { - unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr) } +declare 650 { + unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + size_t *lengthPtr) +} # TIP #481 declare 651 { diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 3924549..7fbfbaf 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -440,7 +440,7 @@ Tcl_SetByteArrayObj( /* *---------------------------------------------------------------------- * - * Tcl_GetBytesFromObj -- + * Tcl_GetBytesFromObj/TclGetBytesFromObj -- * * Attempt to extract the value from objPtr in the representation * of a byte sequence. On success return the extracted byte sequence. @@ -455,7 +455,7 @@ Tcl_SetByteArrayObj( */ unsigned char * -Tcl_GetBytesFromObj( +TclGetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ int *lengthPtr) /* If non-NULL, filled with length of the @@ -492,6 +492,45 @@ Tcl_GetBytesFromObj( } return baPtr->bytes; } +#undef Tcl_GetBytesFromObj +unsigned char * +Tcl_GetBytesFromObj( + Tcl_Interp *interp, /* For error reporting */ + Tcl_Obj *objPtr, /* Value to extract from */ + size_t *lengthPtr) /* If non-NULL, filled with length of the + * array of bytes in the ByteArray object. */ +{ + ByteArray *baPtr; + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType); + + if (irPtr == NULL) { + SetByteArrayFromAny(NULL, objPtr); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); + if (irPtr == NULL) { + if (interp) { + const char *nonbyte; + int ucs4; + + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); + baPtr = GET_BYTEARRAY(irPtr); + nonbyte = Tcl_UtfAtIndex(Tcl_GetString(objPtr), baPtr->bad); + TclUtfToUCS4(nonbyte, &ucs4); + + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "expected byte sequence but character %d " + "was '%1s' (U+%06X)", baPtr->bad, nonbyte, ucs4)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", NULL); + } + return NULL; + } + } + baPtr = GET_BYTEARRAY(irPtr); + + if (lengthPtr != NULL) { + *lengthPtr = baPtr->used; + } + return baPtr->bytes; +} /* *---------------------------------------------------------------------- @@ -520,7 +559,7 @@ Tcl_GetByteArrayFromObj( { ByteArray *baPtr; const Tcl_ObjIntRep *irPtr; - unsigned char *result = Tcl_GetBytesFromObj(NULL, objPtr, lengthPtr); + unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr); if (result) { return result; @@ -545,7 +584,7 @@ TclGetByteArrayFromObj( { ByteArray *baPtr; const Tcl_ObjIntRep *irPtr; - unsigned char *result = Tcl_GetBytesFromObj(NULL, objPtr, (int *)NULL); + unsigned char *result = TclGetBytesFromObj(NULL, objPtr, (int *)NULL); if (result) { return result; @@ -2656,7 +2695,7 @@ BinaryDecodeHex( } TclNewObj(resultObj); - data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count); + data = TclGetBytesFromObj(NULL, objv[objc - 1], &count); if (data == NULL) { pure = 0; data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count); @@ -2788,7 +2827,7 @@ BinaryEncode64( } break; case OPT_WRAPCHAR: - wrapchar = (const char *)Tcl_GetBytesFromObj(NULL, + wrapchar = (const char *)TclGetBytesFromObj(NULL, objv[i + 1], &wrapcharlen); if (wrapchar == NULL) { purewrap = 0; @@ -3051,7 +3090,7 @@ BinaryDecodeUu( } TclNewObj(resultObj); - data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count); + data = TclGetBytesFromObj(NULL, objv[objc - 1], &count); if (data == NULL) { pure = 0; data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count); @@ -3225,7 +3264,7 @@ BinaryDecode64( } TclNewObj(resultObj); - data = Tcl_GetBytesFromObj(NULL, objv[objc - 1], &count); + data = TclGetBytesFromObj(NULL, objv[objc - 1], &count); if (data == NULL) { pure = 0; data = (unsigned char *) TclGetStringFromObj(objv[objc - 1], &count); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 4e7f3f8b..9279e2d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1921,9 +1921,11 @@ EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr, EXTERN int * Tcl_UtfToUniCharDString(const char *src, int length, Tcl_DString *dsPtr); /* 649 */ -EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp, +EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); -/* Slot 650 is reserved */ +/* 650 */ +EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */ EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, size_t *lengthPtr); @@ -2617,8 +2619,8 @@ typedef struct TclStubs { int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, int uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 648 */ - unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); /* 649 */ - void (*reserved650)(void); + unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); /* 649 */ + unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, size_t *lengthPtr); /* 650 */ char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */ Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 652 */ unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 653 */ @@ -3950,9 +3952,10 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_UniCharToUtfDString) /* 647 */ #define Tcl_UtfToUniCharDString \ (tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */ +#define TclGetBytesFromObj \ + (tclStubsPtr->tclGetBytesFromObj) /* 649 */ #define Tcl_GetBytesFromObj \ - (tclStubsPtr->tcl_GetBytesFromObj) /* 649 */ -/* Slot 650 is reserved */ + (tclStubsPtr->tcl_GetBytesFromObj) /* 650 */ #define TclGetStringFromObj \ (tclStubsPtr->tclGetStringFromObj) /* 651 */ #define TclGetUnicodeFromObj \ @@ -4142,12 +4145,15 @@ extern const TclStubs *tclStubsPtr; #endif #undef Tcl_GetStringFromObj +#undef Tcl_GetBytesFromObj #undef Tcl_GetUnicodeFromObj #undef Tcl_GetByteArrayFromObj #undef Tcl_GetUnicode #if defined(USE_TCL_STUBS) #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)sizePtr)) +#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (size_t *)sizePtr)) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (size_t *)sizePtr)) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ @@ -4157,6 +4163,8 @@ extern const TclStubs *tclStubsPtr; #else #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)sizePtr) : (TclGetStringFromObj)(objPtr, (size_t *)sizePtr)) +#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)sizePtr) : (Tcl_GetBytesFromObj)(interp, objPtr, (size_t *)sizePtr)) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)sizePtr) : TclGetByteArrayFromObj(objPtr, (size_t *)sizePtr)) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ diff --git a/generic/tclIO.c b/generic/tclIO.c index 2232d8d..9cace8c 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -5863,7 +5863,7 @@ DoReadChars( && (statePtr->inEofChar == '\0'); if (appendFlag) { - if (binaryMode && (NULL == Tcl_GetBytesFromObj(NULL, objPtr, NULL))) { + if (binaryMode && (NULL == TclGetBytesFromObj(NULL, objPtr, NULL))) { binaryMode = 0; } } else { diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index e29330b..f5d16b1 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1894,8 +1894,8 @@ const TclStubs tclStubs = { Tcl_UtfToUniChar, /* 646 */ Tcl_UniCharToUtfDString, /* 647 */ Tcl_UtfToUniCharDString, /* 648 */ - Tcl_GetBytesFromObj, /* 649 */ - 0, /* 650 */ + TclGetBytesFromObj, /* 649 */ + Tcl_GetBytesFromObj, /* 650 */ TclGetStringFromObj, /* 651 */ TclGetUnicodeFromObj, /* 652 */ TclGetByteArrayFromObj, /* 653 */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index a5a40b4..fc7be6f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1896,7 +1896,7 @@ ZipFSMountBufferObjCmd( return TCL_OK; } - data = Tcl_GetBytesFromObj(interp, objv[2], &length); + data = TclGetBytesFromObj(interp, objv[2], &length); if (data == NULL) { return TCL_ERROR; } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 6960294..d257ea1 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1153,8 +1153,8 @@ Tcl_ZlibStreamSetCompressionDictionary( { ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle; - if (compressionDictionaryObj && (NULL == Tcl_GetBytesFromObj(NULL, - compressionDictionaryObj, NULL))) { + if (compressionDictionaryObj && (NULL == TclGetBytesFromObj(NULL, + compressionDictionaryObj, (int *)NULL))) { /* Missing or invalid compression dictionary */ compressionDictionaryObj = NULL; } @@ -1208,7 +1208,7 @@ Tcl_ZlibStreamPut( return TCL_ERROR; } - bytes = Tcl_GetBytesFromObj(zshPtr->interp, data, &size); + bytes = TclGetBytesFromObj(zshPtr->interp, data, &size); if (bytes == NULL) { return TCL_ERROR; } @@ -1338,7 +1338,7 @@ Tcl_ZlibStreamGet( return TCL_OK; } - if (NULL == Tcl_GetBytesFromObj(zshPtr->interp, data, &existing)) { + if (NULL == TclGetBytesFromObj(zshPtr->interp, data, &existing)) { return TCL_ERROR; } @@ -1592,7 +1592,7 @@ Tcl_ZlibDeflate( * to the deflate command. */ - inData = Tcl_GetBytesFromObj(interp, data, &inLen); + inData = TclGetBytesFromObj(interp, data, &inLen); if (inData == NULL) { return TCL_ERROR; } @@ -1741,7 +1741,7 @@ Tcl_ZlibInflate( return TCL_ERROR; } - inData = Tcl_GetBytesFromObj(interp, data, &inLen); + inData = TclGetBytesFromObj(interp, data, &inLen); if (inData == NULL) { return TCL_ERROR; } @@ -1978,7 +1978,7 @@ ZlibCmd( Tcl_WrongNumArgs(interp, 2, objv, "data ?startValue?"); return TCL_ERROR; } - data = Tcl_GetBytesFromObj(interp, objv[2], &dlen); + data = TclGetBytesFromObj(interp, objv[2], &dlen); if (data == NULL) { return TCL_ERROR; } @@ -1998,7 +1998,7 @@ ZlibCmd( Tcl_WrongNumArgs(interp, 2, objv, "data ?startValue?"); return TCL_ERROR; } - data = Tcl_GetBytesFromObj(interp, objv[2], &dlen); + data = TclGetBytesFromObj(interp, objv[2], &dlen); if (data == NULL) { return TCL_ERROR; } @@ -2342,7 +2342,7 @@ ZlibStreamSubcmd( } if (compDictObj) { - if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, NULL)) { + if (NULL == TclGetBytesFromObj(interp, compDictObj, NULL)) { return TCL_ERROR; } } @@ -2524,7 +2524,7 @@ ZlibPushSubcmd( } } - if (compDictObj && (NULL == Tcl_GetBytesFromObj(interp, compDictObj, NULL))) { + if (compDictObj && (NULL == TclGetBytesFromObj(interp, compDictObj, NULL))) { return TCL_ERROR; } @@ -2773,7 +2773,7 @@ ZlibStreamAddCmd( if (compDictObj != NULL) { int len; - if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, &len)) { + if (NULL == TclGetBytesFromObj(interp, compDictObj, &len)) { return TCL_ERROR; } @@ -2880,7 +2880,7 @@ ZlibStreamPutCmd( if (compDictObj != NULL) { int len; - if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, &len)) { + if (NULL == TclGetBytesFromObj(interp, compDictObj, &len)) { return TCL_ERROR; } if (len == 0) { @@ -3318,7 +3318,7 @@ ZlibTransformSetOption( /* not used */ TclNewStringObj(compDictObj, value, strlen(value)); Tcl_IncrRefCount(compDictObj); - if (NULL == Tcl_GetBytesFromObj(interp, compDictObj, NULL)) { + if (NULL == TclGetBytesFromObj(interp, compDictObj, NULL)) { Tcl_DecrRefCount(compDictObj); return TCL_ERROR; } -- cgit v0.12 From b373f35cc26b885600e10f64cb5f85d64f64dff2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 26 Jan 2021 11:13:11 +0000 Subject: Make Tcl_GetBytesFromObj usable without TCL_NO_DEPRECATED too. Fix "testbytestring" test command, prevent stack smash (seen in github action build) --- generic/tclDecls.h | 10 +++++----- generic/tclTest.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index aee81e7..7232eac 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4150,29 +4150,29 @@ extern const TclStubs *tclStubsPtr; Tcl_GetStringFromObj(objPtr, (int *)NULL) #define Tcl_GetUnicode(objPtr) \ Tcl_GetUnicodeFromObj(objPtr, (int *)NULL) +#undef Tcl_GetBytesFromObj #ifdef TCL_NO_DEPRECATED #undef Tcl_GetStringFromObj -#undef Tcl_GetBytesFromObj #undef Tcl_GetUnicodeFromObj #undef Tcl_GetByteArrayFromObj #endif #if defined(USE_TCL_STUBS) +#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (size_t *)sizePtr)) #ifdef TCL_NO_DEPRECATED #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)sizePtr)) -#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ - (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (size_t *)sizePtr)) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (size_t *)sizePtr)) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (size_t *)sizePtr)) #endif #else +#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)sizePtr) : (Tcl_GetBytesFromObj)(interp, objPtr, (size_t *)sizePtr)) #ifdef TCL_NO_DEPRECATED #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)sizePtr) : (TclGetStringFromObj)(objPtr, (size_t *)sizePtr)) -#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ - (sizeof(*sizePtr) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)sizePtr) : (Tcl_GetBytesFromObj)(interp, objPtr, (size_t *)sizePtr)) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)sizePtr) : TclGetByteArrayFromObj(objPtr, (size_t *)sizePtr)) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ diff --git a/generic/tclTest.c b/generic/tclTest.c index f016995..3c7bdb8 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -5069,7 +5069,7 @@ TestbytestringObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - int n = 0; + size_t n = 0; const char *p; if (objc != 2) { -- cgit v0.12 From b649d5f2ef697debf06046efc1af7bdfcd58a5c1 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 27 Aug 2021 18:46:10 +0000 Subject: Work in progress updating the documentation to modern perspectives. --- doc/ByteArrObj.3 | 64 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index 90f749e..a8b70eb 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -19,11 +19,13 @@ Tcl_Obj * void \fBTcl_SetByteArrayObj\fR(\fIobjPtr, bytes, length\fR) .sp +.VS TIP568 unsigned char * -\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, lengthPtr\fR) +\fBTcl_GetBytesFromObj\fR(\fIinterp, objPtr, lengthPtr\fR) +.VE TIP568 .sp unsigned char * -\fBTcl_GetBytesFromObj\fR(\fIinterp, objPtr, lengthPtr\fR) +\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, lengthPtr\fR) .sp unsigned char * \fBTcl_SetByteArrayLength\fR(\fIobjPtr, length\fR) @@ -37,41 +39,45 @@ even if \fIlength\fR is non-zero. .AP int length in The length of the array of bytes. It must be >= 0. .AP Tcl_Obj *objPtr in/out -For \fBTcl_SetByteArrayObj\fR, this points to the value to be converted to -byte-array type. For \fBTcl_GetByteArrayFromObj\fR, \fBTcl_GetBytesFromObj\fR and -\fBTcl_SetByteArrayLength\fR, this points to the value from which to get -the byte-array value; if \fIobjPtr\fR does not already point to a byte-array -value, it will be converted to one. -.AP size_t | int *lengthPtr out -Filled with the length of the array of bytes in the value. -May be (int *)NULL when not used. +For \fBTcl_SetByteArrayObj\fR, this points to an unshared value to be +overwritten by a byte-array value. For \fBTcl_GetBytesFromObj\fR, +\fBTcl_GetByteArrayFromObj\fR and \fBTcl_SetByteArrayLength\fR, this points +to the value from which to extract a byte-array value. +.AP "size_t | int" *lengthPtr out +Points to space to be filled with the length of the array of bytes extracted +from \fIobjPtr\fR. May be NULL when the caller does not need the length. .BE .SH DESCRIPTION .PP These procedures are used to create, modify, and read Tcl byte-array values from C code. Byte-array values are typically used to hold the -results of binary IO operations or data structures created with the -\fBbinary\fR command. In Tcl, an array of bytes is not equivalent to a -string. Conceptually, a string is an array of Unicode characters, while a -byte-array is an array of 8-bit quantities with no implicit meaning. -Accessor functions are provided to get the string representation of a -byte-array or to convert an arbitrary value to a byte-array. Obtaining the +results of binary IO operations, data structures created with the +\fBbinary\fR command, or other information, such as encrypted data, +represented as arbitrary binary data. +A byte-array is an array of 8-bit quantities (the integer range 0 - 255) +with no inherent meaning. When a byte-array value must be processed as +a string, the sequence of \fBN\fR bytes is transformed into the corresponding +sequence of \fBN\fR characters, where each byte value transforms to the same +character codepoint value in the range (U+0000 - U+00FF). Obtaining the string representation of a byte-array value (by calling -\fBTcl_GetStringFromObj\fR) produces a properly formed UTF-8 sequence with a -one-to-one mapping between the bytes in the internal representation and the -UTF-8 characters in the string representation. +\fBTcl_GetStringFromObj\fR) produces this string in Tcl's usual +Modified UTF-8 encoding. .PP -\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR will -create a new value of byte-array type or modify an existing value to have a -byte-array type. Both of these procedures set the value's type to be -byte-array and set the value's internal representation to a copy of the -array of bytes given by \fIbytes\fR. \fBTcl_NewByteArrayObj\fR returns a -pointer to a newly allocated value with a reference count of zero. -\fBTcl_SetByteArrayObj\fR invalidates any old string representation and, if -the value is not already a byte-array value, frees any old internal -representation. If \fIbytes\fR is NULL then the new byte array contains -arbitrary values. +\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR +create a new value or overwrite an existing unshared value, respectively, +to hold a byte-array value of \fIlength\fR bytes. \fBTcl_NewByteArrayObj\fR +returns a pointer to the created value with a reference count of zero. +\fBTcl_SetByteArrayObj\fR overwrites and invalidates any old contents +as appropriate, and keeps the same reference count (0 or 1). When +the \fIbytes\fR argument passed to either routine is not NULL, \fIlength\fR +bytes are copied from \fIbytes\fR into the new value. When +the \fIbytes\fR argument passed to either routine is NULL, the +contents of the resulting byte array value are undefined. A \fIbytes\fR +value of NULL is useful only when the caller will arrange to write +known contents into the byte array through a pointer retrieved by a call +to one of the routines explained below. Such manipulation must be performed +only on unshared values, and accompanied by all appropriate invalidations. .PP \fBTcl_GetByteArrayFromObj\fR converts a Tcl value to byte-array type and returns a pointer to the value's new internal representation as an array of -- cgit v0.12 From bc437743d592d3d9a2e37ef46633532102d1e629 Mon Sep 17 00:00:00 2001 From: griffin Date: Tue, 31 Aug 2021 14:36:33 +0000 Subject: Patch to fix zipfs mkimg bug. --- generic/tclZipfs.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index c77e8db..da46acd 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1191,7 +1191,8 @@ ZipFSFindTOC( const unsigned char *p, *q; const unsigned char *start = zf->data; const unsigned char *end = zf->data + zf->length; - + size_t pass_offset; + /* * Scan backwards from the end of the file for the signature. This is * necessary because ZIP archives aren't the only things that get tagged @@ -1224,6 +1225,11 @@ ZipFSFindTOC( goto error; } + /* + * Remember passOffset + */ + pass_offset = p - zf->data; + /* * How many files in the archive? If that's bogus, we're done here. */ @@ -1300,6 +1306,12 @@ ZipFSFindTOC( zf->passOffset -= i ? (5 + i) : 0; } } + + /* + * Restore passOffset + */ + zf->passOffset = pass_offset; + return TCL_OK; error: @@ -3108,6 +3120,22 @@ ZipFSMkZipOrImg( * Copy everything up to the ZIP-related suffix. */ + if (zf->passOffset == 0) { + /* + * Hmm, this mounted archive is local (in this image), but + * zf->passOffset does not have a valid value. Let's open + * this image and find the passOffset so as to copy the image + * correctly. + */ + + ZipFile zflocal; + memset(&zflocal, 0, sizeof(ZipFile)); + if (ZipFSOpenArchive(interp, imgName, 0, &zflocal) == TCL_OK) { + zf->passOffset = zflocal.passOffset; + ZipFSCloseArchive(interp, &zflocal); + } + } + if ((size_t) Tcl_Write(out, (char *) zf->data, zf->passOffset) != zf->passOffset) { memset(passBuf, 0, sizeof(passBuf)); -- cgit v0.12 From 34e7d9999e042408f6eef02bbd690d43f25b9fde Mon Sep 17 00:00:00 2001 From: griffin Date: Wed, 13 Oct 2021 00:22:20 +0000 Subject: Corrected offset calculations --- generic/tclZipfs.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index da46acd..4d40da3 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1187,11 +1187,10 @@ ZipFSFindTOC( int needZip, ZipFile *zf) { - size_t i; + size_t i, minoff; const unsigned char *p, *q; const unsigned char *start = zf->data; const unsigned char *end = zf->data + zf->length; - size_t pass_offset; /* * Scan backwards from the end of the file for the signature. This is @@ -1225,11 +1224,6 @@ ZipFSFindTOC( goto error; } - /* - * Remember passOffset - */ - pass_offset = p - zf->data; - /* * How many files in the archive? If that's bogus, we're done here. */ @@ -1251,6 +1245,8 @@ ZipFSFindTOC( q = zf->data + ZipReadInt(start, end, p + ZIP_CENTRAL_DIRSTART_OFFS); p -= ZipReadInt(start, end, p + ZIP_CENTRAL_DIRSIZE_OFFS); + zf->baseOffset = zf->passOffset = (p>q) ? p - q : 0; + zf->directoryOffset = q - zf->data + zf->baseOffset; if ((p < q) || (p < zf->data) || (p > zf->data + zf->length) || (q < zf->data) || (q > zf->data + zf->length)) { if (!needZip) { @@ -1266,11 +1262,11 @@ ZipFSFindTOC( * Read the central directory. */ - zf->baseOffset = zf->passOffset = p - q; - zf->directoryOffset = p - zf->data; q = p; + minoff = zf->length; for (i = 0; i < zf->numFiles; i++) { int pathlen, comlen, extra; + size_t localhdr_off = zf->length; if (q + ZIP_CENTRAL_HEADER_LEN > end) { ZIPFS_ERROR(interp, "wrong header length"); @@ -1285,16 +1281,27 @@ ZipFSFindTOC( pathlen = ZipReadShort(start, end, q + ZIP_CENTRAL_PATHLEN_OFFS); comlen = ZipReadShort(start, end, q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); extra = ZipReadShort(start, end, q + ZIP_CENTRAL_EXTRALEN_OFFS); + localhdr_off = ZipReadInt(start, end, q + ZIP_CENTRAL_LOCALHDR_OFFS); + if (ZipReadInt(start, end, zf->data + zf->baseOffset + localhdr_off) != ZIP_LOCAL_HEADER_SIG) { + ZIPFS_ERROR(interp, "Failed to find local header"); + ZIPFS_ERROR_CODE(interp, "LCL_HDR"); + goto error; + } + if (localhdr_off < minoff) { + minoff = localhdr_off; + } q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; } + zf->passOffset = minoff + zf->baseOffset; + /* * If there's also an encoded password, extract that too (but don't decode * yet). */ - q = zf->data + zf->baseOffset; - if ((zf->baseOffset >= 6) && + q = zf->data + zf->passOffset; + if ((zf->passOffset >= 6) && (start < q-4) && (ZipReadInt(start, end, q - 4) == ZIP_PASSWORD_END_SIG)) { const unsigned char *passPtr; @@ -1307,11 +1314,6 @@ ZipFSFindTOC( } } - /* - * Restore passOffset - */ - zf->passOffset = pass_offset; - return TCL_OK; error: -- cgit v0.12 From 2812109f17b5854a23b1f0b63d0fd99b1f56965a Mon Sep 17 00:00:00 2001 From: griffin Date: Wed, 13 Oct 2021 16:34:46 +0000 Subject: Remove unnecessary change --- generic/tclZipfs.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 4d40da3..ae4c8c4 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3122,22 +3122,6 @@ ZipFSMkZipOrImg( * Copy everything up to the ZIP-related suffix. */ - if (zf->passOffset == 0) { - /* - * Hmm, this mounted archive is local (in this image), but - * zf->passOffset does not have a valid value. Let's open - * this image and find the passOffset so as to copy the image - * correctly. - */ - - ZipFile zflocal; - memset(&zflocal, 0, sizeof(ZipFile)); - if (ZipFSOpenArchive(interp, imgName, 0, &zflocal) == TCL_OK) { - zf->passOffset = zflocal.passOffset; - ZipFSCloseArchive(interp, &zflocal); - } - } - if ((size_t) Tcl_Write(out, (char *) zf->data, zf->passOffset) != zf->passOffset) { memset(passBuf, 0, sizeof(passBuf)); -- cgit v0.12 From 8ddc7324253119c4c3bcb0bde0d1b7b6bf71d6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ignacio=20Mar=C3=ADn?= Date: Mon, 18 Oct 2021 18:23:48 +0000 Subject: Update TZ info to tzdata2021d. --- library/tzdata/Pacific/Fiji | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/tzdata/Pacific/Fiji b/library/tzdata/Pacific/Fiji index a062913..67a1f00 100644 --- a/library/tzdata/Pacific/Fiji +++ b/library/tzdata/Pacific/Fiji @@ -31,8 +31,6 @@ set TZData(:Pacific/Fiji) { {1578751200 43200 0 +12} {1608386400 46800 1 +12} {1610805600 43200 0 +12} - {1636812000 46800 1 +12} - {1642255200 43200 0 +12} {1668261600 46800 1 +12} {1673704800 43200 0 +12} {1699711200 46800 1 +12} -- cgit v0.12 From 71c68757ce70e3ab6cc87a226791ab598efb9bb4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Oct 2021 18:53:54 +0000 Subject: Update TZ info to tzdata2021d --- library/tzdata/Pacific/Fiji | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/tzdata/Pacific/Fiji b/library/tzdata/Pacific/Fiji index a062913..67a1f00 100644 --- a/library/tzdata/Pacific/Fiji +++ b/library/tzdata/Pacific/Fiji @@ -31,8 +31,6 @@ set TZData(:Pacific/Fiji) { {1578751200 43200 0 +12} {1608386400 46800 1 +12} {1610805600 43200 0 +12} - {1636812000 46800 1 +12} - {1642255200 43200 0 +12} {1668261600 46800 1 +12} {1673704800 43200 0 +12} {1699711200 46800 1 +12} -- cgit v0.12 From 58583ac83fd364a825038d5dfcdaa7c75aca836b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 19 Oct 2021 14:42:56 +0000 Subject: IntRep -> InternalRep. Internal changes only. --- generic/tclAssembly.c | 4 ++-- generic/tclCompExpr.c | 8 +++---- generic/tclCompile.c | 4 ++-- generic/tclDisassemble.c | 2 +- generic/tclEncoding.c | 16 ++++++------- generic/tclExecute.c | 8 +++---- generic/tclIO.c | 18 +++++++-------- generic/tclInt.h | 3 ++- generic/tclListObj.c | 59 ++++++++++++++++++++++++++++-------------------- generic/tclNamesp.c | 6 ++--- generic/tclObj.c | 10 ++++---- generic/tclPathObj.c | 2 +- generic/tclResult.c | 2 +- generic/tclStrToD.c | 4 ++-- generic/tclStringObj.c | 2 +- generic/tclUtil.c | 2 +- tests/cmdIL.test | 2 +- tests/format.test | 4 ++-- tests/io.test | 2 +- tests/lset.test | 2 +- tests/var.test | 2 +- 21 files changed, 86 insertions(+), 76 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 7ecc1d5..bf86b90 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -4279,7 +4279,7 @@ AddBasicBlockRangeToErrorInfo( * DupAssembleCodeInternalRep -- * * Part of the Tcl object type implementation for Tcl assembly language - * bytecode. We do not copy the bytecode intrep. Instead, we return + * bytecode. We do not copy the bytecode internalrep. Instead, we return * without setting copyPtr->typePtr, so the copy is a plain string copy * of the assembly source, and if it is to be used as a compiled * expression, it will need to be reprocessed. @@ -4288,7 +4288,7 @@ AddBasicBlockRangeToErrorInfo( * usual (only?) time Tcl_DuplicateObj() will be called is when the copy * is about to be modified, which would invalidate any copied bytecode * anyway. The only reason it might make sense to copy the bytecode is if - * we had some modifying routines that operated directly on the intrep, + * we had some modifying routines that operated directly on the internalrep, * as we do for lists and dicts. * * Results: diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 1ffe099..52b62fc 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2438,7 +2438,7 @@ CompileExprTree( * However, the design of the "global" and "local" * LiteralTable does not permit the value of lePtr->objPtr * to change. So rather than replace lePtr->objPtr, we do - * surgery to transfer our desired intrep into it. + * surgery to transfer our desired internalrep into it. */ objPtr->typePtr = literal->typePtr; @@ -2451,9 +2451,9 @@ CompileExprTree( * When optimize==0, we know the expression is a one-off and * there's nothing to be gained from sharing literals when * they won't live long, and the copies we have already have - * an appropriate intrep. In this case, skip literal + * an appropriate internalrep. In this case, skip literal * registration that would enable sharing, and use the routine - * that preserves intreps. + * that preserves internalreps. */ TclEmitPush(TclAddLiteralObj(envPtr, literal, NULL), envPtr); @@ -2488,7 +2488,7 @@ CompileExprTree( if ((tableValue->typePtr == NULL) && (objPtr->typePtr != NULL)) { /* - * Same intrep surgery as for OT_LITERAL. + * Same internalrep surgery as for OT_LITERAL. */ tableValue->typePtr = objPtr->typePtr; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6761c09..eb2e16b 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2829,7 +2829,7 @@ TclInitByteCodeObj( if (objPtr == fetched) { /* - * Prevent circular reference where the bytecode intrep of + * Prevent circular reference where the bytecode internalrep of * a value contains a literal which is that same value. * If this is allowed to happen, refcount decrements may not * reach zero, and memory may leak. Bugs 467523, 3357771 @@ -2837,7 +2837,7 @@ TclInitByteCodeObj( * NOTE: [Bugs 3392070, 3389764] We make a copy based completely * on the string value, and do not call Tcl_DuplicateObj() so we * can be sure we do not have any lingering cycles hiding in - * the intrep. + * the internalrep. */ int numBytes; const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes); diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 8236d20..8b137d4 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -755,7 +755,7 @@ TclGetInnerContext( int len; /* - * Reset while keeping the list intrep as much as possible. + * Reset while keeping the list internalrep as much as possible. */ Tcl_ListObjLength(interp, result, &len); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 686eeb5..8fff493 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -196,13 +196,13 @@ static unsigned short emptyPage[256]; */ static Tcl_EncodingConvertProc BinaryProc; -static Tcl_DupInternalRepProc DupEncodingIntRep; +static Tcl_DupInternalRepProc DupEncodingInternalRep; static Tcl_EncodingFreeProc EscapeFreeProc; static Tcl_EncodingConvertProc EscapeFromUtfProc; static Tcl_EncodingConvertProc EscapeToUtfProc; static void FillEncodingFileMap(void); static void FreeEncoding(Tcl_Encoding encoding); -static Tcl_FreeInternalRepProc FreeEncodingIntRep; +static Tcl_FreeInternalRepProc FreeEncodingInternalRep; static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr, int state); static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp, @@ -262,12 +262,12 @@ static int Iso88591ToUtfProc(ClientData clientData, /* * A Tcl_ObjType for holding a cached Tcl_Encoding in the twoPtrValue.ptr1 field - * of the intrep. This should help the lifetime of encodings be more useful. + * of the internalrep. This should help the lifetime of encodings be more useful. * See concerns raised in [Bug 1077262]. */ static const Tcl_ObjType encodingType = { - "encoding", FreeEncodingIntRep, DupEncodingIntRep, NULL, NULL + "encoding", FreeEncodingInternalRep, DupEncodingInternalRep, NULL, NULL }; /* @@ -314,7 +314,7 @@ Tcl_GetEncodingFromObj( /* *---------------------------------------------------------------------- * - * FreeEncodingIntRep -- + * FreeEncodingInternalRep -- * * The Tcl_FreeInternalRepProc for the "encoding" Tcl_ObjType. * @@ -322,7 +322,7 @@ Tcl_GetEncodingFromObj( */ static void -FreeEncodingIntRep( +FreeEncodingInternalRep( Tcl_Obj *objPtr) { Tcl_FreeEncoding((Tcl_Encoding)objPtr->internalRep.twoPtrValue.ptr1); @@ -332,7 +332,7 @@ FreeEncodingIntRep( /* *---------------------------------------------------------------------- * - * DupEncodingIntRep -- + * DupEncodingInternalRep -- * * The Tcl_DupInternalRepProc for the "encoding" Tcl_ObjType. * @@ -340,7 +340,7 @@ FreeEncodingIntRep( */ static void -DupEncodingIntRep( +DupEncodingInternalRep( Tcl_Obj *srcPtr, Tcl_Obj *dupPtr) { diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d675e44..8963472 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1598,7 +1598,7 @@ CompileExprObj( * DupExprCodeInternalRep -- * * Part of the Tcl object type implementation for Tcl expression - * bytecode. We do not copy the bytecode intrep. Instead, we return + * bytecode. We do not copy the bytecode internalrep. Instead, we return * without setting copyPtr->typePtr, so the copy is a plain string copy * of the expression value, and if it is to be used as a compiled * expression, it will just need a recompile. @@ -1607,7 +1607,7 @@ CompileExprObj( * usual (only?) time Tcl_DuplicateObj() will be called is when the copy * is about to be modified, which would invalidate any copied bytecode * anyway. The only reason it might make sense to copy the bytecode is if - * we had some modifying routines that operated directly on the intrep, + * we had some modifying routines that operated directly on the internalrep, * like we do for lists and dicts. * * Results: @@ -6778,7 +6778,7 @@ TEBCresume( if (Tcl_IsShared(valuePtr)) { /* * Here we do some surgery within the Tcl_Obj internals. We want - * to copy the intrep, but not the string, so we temporarily hide + * to copy the internalrep, but not the string, so we temporarily hide * the string so we do not copy it. */ @@ -7605,7 +7605,7 @@ TEBCresume( /* * dictPtr is no longer on the stack, and we're not - * moving it into the intrep of an iterator. We need + * moving it into the internalrep of an iterator. We need * to drop the refcount [Tcl Bug 9b352768e6]. */ diff --git a/generic/tclIO.c b/generic/tclIO.c index f916211..43b7ce3 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -324,13 +324,13 @@ typedef struct ResolvedChanName { int refCount; /* Share this struct among many Tcl_Obj. */ } ResolvedChanName; -static void DupChannelIntRep(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); -static void FreeChannelIntRep(Tcl_Obj *objPtr); +static void DupChannelInternalRep(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); +static void FreeChannelInternalRep(Tcl_Obj *objPtr); static const Tcl_ObjType chanObjType = { "channel", /* name for this type */ - FreeChannelIntRep, /* freeIntRepProc */ - DupChannelIntRep, /* dupIntRepProc */ + FreeChannelInternalRep, /* freeIntRepProc */ + DupChannelInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL /* setFromAnyProc */ }; @@ -1526,7 +1526,7 @@ TclGetChannelFromObj( if (chan == NULL) { if (resPtr) { - FreeChannelIntRep(objPtr); + FreeChannelInternalRep(objPtr); } return TCL_ERROR; } @@ -11212,7 +11212,7 @@ Tcl_ChannelTruncateProc( /* *---------------------------------------------------------------------- * - * DupChannelIntRep -- + * DupChannelInternalRep -- * * Initialize the internal representation of a new Tcl_Obj to a copy of * the internal representation of an existing string object. @@ -11228,7 +11228,7 @@ Tcl_ChannelTruncateProc( */ static void -DupChannelIntRep( +DupChannelInternalRep( Tcl_Obj *srcPtr, /* Object with internal rep to copy. Must have * an internal rep of type "Channel". */ Tcl_Obj *copyPtr) /* Object with internal rep to set. Must not @@ -11244,7 +11244,7 @@ DupChannelIntRep( /* *---------------------------------------------------------------------- * - * FreeChannelIntRep -- + * FreeChannelInternalRep -- * * Release statePtr storage. * @@ -11258,7 +11258,7 @@ DupChannelIntRep( */ static void -FreeChannelIntRep( +FreeChannelInternalRep( Tcl_Obj *objPtr) /* Object with internal rep to free. */ { ResolvedChanName *resPtr = objPtr->internalRep.twoPtrValue.ptr1; diff --git a/generic/tclInt.h b/generic/tclInt.h index dc6b83f..949672b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2391,6 +2391,7 @@ typedef struct List { #define ListRepPtr(listPtr) \ ((List *) (listPtr)->internalRep.twoPtrValue.ptr1) +/* Not used any more */ #define ListSetIntRep(objPtr, listRepPtr) \ (objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(listRepPtr), \ (objPtr)->internalRep.twoPtrValue.ptr2 = NULL, \ @@ -3147,7 +3148,7 @@ MODULE_SCOPE int TclScanElement(const char *string, int length, char *flagPtr); MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp, Tcl_Obj *cmdPrefix); -MODULE_SCOPE void TclSetBignumIntRep(Tcl_Obj *objPtr, +MODULE_SCOPE void TclSetBignumInternalRep(Tcl_Obj *objPtr, mp_int *bignumValue); MODULE_SCOPE int TclSetBooleanFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE void TclSetCmdNameObj(Tcl_Interp *interp, Tcl_Obj *objPtr, diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 11726d5..9bc4e47 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -19,7 +19,7 @@ static List * AttemptNewList(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static List * NewListIntRep(int objc, Tcl_Obj *const objv[], int p); +static List * NewListInternalRep(int objc, Tcl_Obj *const objv[], int p); static void DupListInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void FreeListInternalRep(Tcl_Obj *listPtr); static int SetListFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -46,6 +46,15 @@ const Tcl_ObjType tclListType = { SetListFromAny /* setFromAnyProc */ }; +/* Macros to manipulate the List internal rep */ + +#define ListSetInternalRep(objPtr, listRepPtr) \ + (objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(listRepPtr), \ + (objPtr)->internalRep.twoPtrValue.ptr2 = NULL, \ + (listRepPtr)->refCount++, \ + (objPtr)->typePtr = &tclListType + + #ifndef TCL_MIN_ELEMENT_GROWTH #define TCL_MIN_ELEMENT_GROWTH TCL_MIN_GROWTH/sizeof(Tcl_Obj *) #endif @@ -53,7 +62,7 @@ const Tcl_ObjType tclListType = { /* *---------------------------------------------------------------------- * - * NewListIntRep -- + * NewListInternalRep -- * * Creates a 'List' structure with space for 'objc' elements. 'objc' must * be > 0. If 'objv' is not NULL, The list is initialized with first @@ -76,7 +85,7 @@ const Tcl_ObjType tclListType = { */ static List * -NewListIntRep( +NewListInternalRep( int objc, Tcl_Obj *const objv[], int p) @@ -84,7 +93,7 @@ NewListIntRep( List *listRepPtr; if (objc <= 0) { - Tcl_Panic("NewListIntRep: expects postive element count"); + Tcl_Panic("NewListInternalRep: expects postive element count"); } /* @@ -102,7 +111,7 @@ NewListIntRep( return NULL; } - listRepPtr = attemptckalloc(LIST_SIZE(objc)); + listRepPtr = (List *)attemptckalloc(LIST_SIZE(objc)); if (listRepPtr == NULL) { if (p) { Tcl_Panic("list creation failed: unable to alloc %u bytes", @@ -136,7 +145,7 @@ NewListIntRep( * * AttemptNewList -- * - * Like NewListIntRep, but additionally sets an error message on failure. + * Like NewListInternalRep, but additionally sets an error message on failure. * *---------------------------------------------------------------------- */ @@ -147,7 +156,7 @@ AttemptNewList( int objc, Tcl_Obj *const objv[]) { - List *listRepPtr = NewListIntRep(objc, objv, 0); + List *listRepPtr = NewListInternalRep(objc, objv, 0); if (interp != NULL && listRepPtr == NULL) { if (objc > LIST_MAX) { @@ -218,14 +227,14 @@ Tcl_NewListObj( * Create the internal rep. */ - listRepPtr = NewListIntRep(objc, objv, 1); + listRepPtr = NewListInternalRep(objc, objv, 1); /* * Now create the object. */ TclInvalidateStringRep(listPtr); - ListSetIntRep(listPtr, listRepPtr); + ListSetInternalRep(listPtr, listRepPtr); return listPtr; } #endif /* if TCL_MEM_DEBUG */ @@ -269,14 +278,14 @@ Tcl_DbNewListObj( * Create the internal rep. */ - listRepPtr = NewListIntRep(objc, objv, 1); + listRepPtr = NewListInternalRep(objc, objv, 1); /* * Now create the object. */ TclInvalidateStringRep(listPtr); - ListSetIntRep(listPtr, listRepPtr); + ListSetInternalRep(listPtr, listRepPtr); return listPtr; } @@ -333,8 +342,8 @@ Tcl_SetListObj( */ if (objc > 0) { - listRepPtr = NewListIntRep(objc, objv, 1); - ListSetIntRep(objPtr, listRepPtr); + listRepPtr = NewListInternalRep(objc, objv, 1); + ListSetInternalRep(objPtr, listRepPtr); } else { objPtr->bytes = tclEmptyStringRep; objPtr->length = 0; @@ -580,7 +589,7 @@ Tcl_ListObjAppendElement( if (needGrow && !isShared) { /* - * Need to grow + unshared intrep => try to realloc + * Need to grow + unshared internalrep => try to realloc */ attempt = 2 * numRequired; @@ -608,8 +617,8 @@ Tcl_ListObjAppendElement( Tcl_Obj **dst, **src = &listRepPtr->elements; /* - * Either we have a shared intrep and we must copy to write, or we - * need to grow and realloc attempts failed. Attempt intrep copy. + * Either we have a shared internalrep and we must copy to write, or we + * need to grow and realloc attempts failed. Attempt internalrep copy. */ attempt = 2 * numRequired; @@ -640,7 +649,7 @@ Tcl_ListObjAppendElement( if (isShared) { /* - * The original intrep must remain undisturbed. Copy into the new + * The original internalrep must remain undisturbed. Copy into the new * one and bump refcounts */ while (numElems--) { @@ -650,7 +659,7 @@ Tcl_ListObjAppendElement( listRepPtr->refCount--; } else { /* - * Old intrep to be freed, re-use refCounts. + * Old internalrep to be freed, re-use refCounts. */ memcpy(dst, src, numElems * sizeof(Tcl_Obj *)); @@ -1085,7 +1094,7 @@ Tcl_ListObjReplace( * * Implemented entirely as a wrapper around 'TclLindexFlat'. Reconfigures * the argument format into required form while taking care to manage - * shimmering so as to tend to keep the most useful intreps + * shimmering so as to tend to keep the most useful internalreps * and/or avoid the most expensive conversions. * * Value @@ -1469,8 +1478,8 @@ TclLsetFlat( /* * Replace the original elemPtr[index] in parentList with a copy * we know to be unshared. This call will also deal with the - * situation where parentList shares its intrep with other - * Tcl_Obj's. Dealing with the shared intrep case can cause + * situation where parentList shares its internalrep with other + * Tcl_Obj's. Dealing with the shared internalrep case can cause * subListPtr to become shared again, so detect that case and make * and store another copy. */ @@ -1495,7 +1504,7 @@ TclLsetFlat( * variable. Later on, when we set valuePtr in its proper place, * then all containing lists will have their values changed, and * will need their string reps spoiled. We maintain a list of all - * those Tcl_Obj's (via a little intrep surgery) so we can spoil + * those Tcl_Obj's (via a little internalrep surgery) so we can spoil * them at that time. */ @@ -1524,7 +1533,7 @@ TclLsetFlat( } /* - * Clear away our intrep surgery mess. + * Clear away our internalrep surgery mess. */ chainPtr = objPtr->internalRep.twoPtrValue.ptr2; @@ -1768,7 +1777,7 @@ DupListInternalRep( { List *listRepPtr = ListRepPtr(srcPtr); - ListSetIntRep(copyPtr, listRepPtr); + ListSetInternalRep(copyPtr, listRepPtr); } /* @@ -1905,7 +1914,7 @@ SetListFromAny( */ TclFreeIntRep(objPtr); - ListSetIntRep(objPtr, listRepPtr); + ListSetInternalRep(objPtr, listRepPtr); return TCL_OK; } diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 9541828..bea0043 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -4800,7 +4800,7 @@ SetNsNameFromAny( if ((nsPtr == NULL) || (nsPtr->flags & NS_DYING)) { /* - * Our failed lookup proves any previously cached nsName intrep is no + * Our failed lookup proves any previously cached nsName internalrep is no * longer valid. Get rid of it so we no longer waste memory storing * it, nor time determining its invalidity again and again. */ @@ -5001,7 +5001,7 @@ TclLogCommandInfo( Tcl_ListObjLength(interp, iPtr->errorStack, &len); /* - * Reset while keeping the list intrep as much as possible. + * Reset while keeping the list internalrep as much as possible. */ Tcl_ListObjReplace(interp, iPtr->errorStack, 0, len, 0, NULL); @@ -5086,7 +5086,7 @@ TclErrorStackResetIf( Tcl_ListObjLength(interp, iPtr->errorStack, &len); /* - * Reset while keeping the list intrep as much as possible. + * Reset while keeping the list internalrep as much as possible. */ Tcl_ListObjReplace(interp, iPtr->errorStack, 0, len, 0, NULL); diff --git a/generic/tclObj.c b/generic/tclObj.c index 2ec5eb8..0950dcd 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1875,7 +1875,7 @@ Tcl_SetBooleanObj( * result unless "interp" is NULL. * * Side effects: - * The intrep of *objPtr may be changed. + * The internalrep of *objPtr may be changed. * *---------------------------------------------------------------------- */ @@ -1898,7 +1898,7 @@ Tcl_GetBooleanFromObj( if (objPtr->typePtr == &tclDoubleType) { /* * Caution: Don't be tempted to check directly for the "double" - * Tcl_ObjType and then compare the intrep to 0.0. This isn't + * Tcl_ObjType and then compare the internalrep to 0.0. This isn't * reliable because a "double" Tcl_ObjType can hold the NaN value. * Use the API Tcl_GetDoubleFromObj, which does the checking and * sets the proper error message for us. @@ -3584,13 +3584,13 @@ Tcl_SetBignumObj( #endif TclInvalidateStringRep(objPtr); TclFreeIntRep(objPtr); - TclSetBignumIntRep(objPtr, bignumValue); + TclSetBignumInternalRep(objPtr, bignumValue); } /* *---------------------------------------------------------------------- * - * TclSetBignumIntRep -- + * TclSetBignumInternalRep -- * * Install a bignum into the internal representation of an object. * @@ -3606,7 +3606,7 @@ Tcl_SetBignumObj( */ void -TclSetBignumIntRep( +TclSetBignumInternalRep( Tcl_Obj *objPtr, mp_int *bignumValue) { diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index a41d9fd..d919c40 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1396,7 +1396,7 @@ AppendPath( * that use some character other than "/" as a path separator. I know * of no evidence that such a foolish thing exists. This solution was * chosen so that "JoinPath" operations that pass through either path - * intrep produce the same results; that is, bugward compatibility. If + * internalrep produce the same results; that is, bugward compatibility. If * we need to fix that bug here, it needs fixing in TclJoinPath() too. */ bytes = Tcl_GetStringFromObj(tail, &numBytes); diff --git a/generic/tclResult.c b/generic/tclResult.c index 07d0e83..b1cf9ee 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -1322,7 +1322,7 @@ TclProcessReturn( Tcl_ListObjLength(interp, iPtr->errorStack, &len); /* - * Reset while keeping the list intrep as much as possible. + * Reset while keeping the list internalrep as much as possible. */ Tcl_ListObjReplace(interp, iPtr->errorStack, 0, len, valueObjc, diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 2e66864..35848f7 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1285,7 +1285,7 @@ TclParseNumber( if (signum) { (void)mp_neg(&octalSignificandBig, &octalSignificandBig); } - TclSetBignumIntRep(objPtr, &octalSignificandBig); + TclSetBignumInternalRep(objPtr, &octalSignificandBig); } break; @@ -1332,7 +1332,7 @@ TclParseNumber( if (signum) { (void)mp_neg(&significandBig, &significandBig); } - TclSetBignumIntRep(objPtr, &significandBig); + TclSetBignumInternalRep(objPtr, &significandBig); } break; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0e1acf0..22e025c 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3241,7 +3241,7 @@ SetStringFromAny( TclFreeIntRep(objPtr); /* - * Create a basic String intrep that just points to the UTF-8 string + * Create a basic String internalrep that just points to the UTF-8 string * already in place at objPtr->bytes. */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 9a0203e..858163e 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -4231,7 +4231,7 @@ TclSetProcessGlobalValue( /* * Fill the local thread copy directly with the Tcl_Obj value to avoid - * loss of the intrep. Increment newValue refCount early to handle case + * loss of the internalrep. Increment newValue refCount early to handle case * where we set a PGV to itself. */ diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 06171e4..e16bfcf 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -760,7 +760,7 @@ test cmdIL-7.6 {lreverse command - unshared object [Bug 1672585]} { test cmdIL-7.7 {lreverse command - empty object [Bug 1876793]} { lreverse [list] } {} -test cmdIL-7.8 {lreverse command - shared intrep [Bug 1675044]} -setup { +test cmdIL-7.8 {lreverse command - shared internalrep [Bug 1675044]} -setup { teststringobj set 1 {1 2 3} testobj convert 1 list testobj duplicate 1 2 diff --git a/tests/format.test b/tests/format.test index 20006ef..43100bc 100644 --- a/tests/format.test +++ b/tests/format.test @@ -605,12 +605,12 @@ test format-19.4.2 {Bug d498578df4: width overflow should cause limit exceeded} } -returnCodes error -result "max size for a Tcl value exceeded" # Note that this test may fail in future versions -test format-20.1 {Bug 2932421: plain %s caused intrep change of args} -body { +test format-20.1 {Bug 2932421: plain %s caused internalrep change of args} -body { set x [dict create a b c d] format %s $x # After this, obj in $x should be a dict # We are testing to make sure it has not been shimmered to a - # different intrep when that is not necessary. + # different internalrep when that is not necessary. # Whether or not there is a string rep - we should not care! tcl::unsupported::representation $x } -match glob -result {value is a dict *} diff --git a/tests/io.test b/tests/io.test index a86527b..5d800a7 100644 --- a/tests/io.test +++ b/tests/io.test @@ -8624,7 +8624,7 @@ test io-73.1 {channel Tcl_Obj SetChannelFromAny} {} { } {1} test io-73.2 {channel Tcl_Obj SetChannelFromAny, bug 2407783} -setup { - # Invalidate intrep of 'channel' Tcl_Obj when transiting between interpreters. + # Invalidate internalrep of 'channel' Tcl_Obj when transiting between interpreters. set f [open [info script] r] } -body { interp create foo diff --git a/tests/lset.test b/tests/lset.test index a130fe9..0ce1c6d 100644 --- a/tests/lset.test +++ b/tests/lset.test @@ -412,7 +412,7 @@ test lset-14.2 {lset, not compiled, flat args, is string rep preserved?} testeva } "{ { 1 2 } { 3 4 } } { 3 4 }" testConstraint testobj [llength [info commands testobj]] -test lset-15.1 {lset: shared intrep [Bug 1677512]} -setup { +test lset-15.1 {lset: shared internalrep [Bug 1677512]} -setup { teststringobj set 1 {{1 2} 3} testobj convert 1 list testobj duplicate 1 2 diff --git a/tests/var.test b/tests/var.test index 8bb55a2..968337b 100644 --- a/tests/var.test +++ b/tests/var.test @@ -1041,7 +1041,7 @@ test var-22.0 {leak in array element unset: Bug a3309d01db} -setup { rename getbytes {} rename doit {} } -result 0 -test var-22.1 {leak in localVarName intrep: Bug 80304238ac} -setup { +test var-22.1 {leak in localVarName internalrep: Bug 80304238ac} -setup { proc getbytes {} { lindex [split [memory info] \n] 3 3 } -- cgit v0.12 From 7f8b256581b9fa5564137271b2f24df3ccd5b9fa Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Oct 2021 20:27:45 +0000 Subject: Code cleanup (comments, bracing) --- generic/tclEncoding.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index fad9faa..6fe81e8 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -517,7 +517,7 @@ FillEncodingFileMap(void) /* Those flags must not conflict with other TCL_ENCODING_* flags in tcl.h */ /* Since TCL_ENCODING_MODIFIED is only used for utf-8/cesu-8 and - * TCL_ENCODING_LE is only used for utf-16/ucs-2. re-use the same value */ + * TCL_ENCODING_LE is only used for utf-16/utf-32/ucs-2. re-use the same value */ #define TCL_ENCODING_MODIFIED 0x20 /* Converting NULL bytes to 0xC0 0x80 */ #define TCL_ENCODING_LE TCL_ENCODING_MODIFIED /* Little-endian encoding */ #define TCL_ENCODING_UTF 0x200 /* For UTF-8 encoding, allow 4-byte output sequences */ @@ -2253,15 +2253,15 @@ UtfToUtfProc( result = TCL_CONVERT_NOSPACE; break; } - if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && (flags & TCL_ENCODING_MODIFIED))) { + if (UCHAR(*src) < 0x80 && !((UCHAR(*src) == 0) && (flags & TCL_ENCODING_MODIFIED))) { /* * Copy 7bit characters, but skip null-bytes when we are in input * mode, so that they get converted to 0xC080. */ *dst++ = *src++; - } else if (UCHAR(*src) == 0xC0 && (src + 1 < srcEnd) - && UCHAR(src[1]) == 0x80 && !(flags & TCL_ENCODING_MODIFIED)) { + } else if ((UCHAR(*src) == 0xC0) && (src + 1 < srcEnd) + && (UCHAR(src[1]) == 0x80) && !(flags & TCL_ENCODING_MODIFIED)) { /* * Convert 0xC080 to real nulls when we are in output mode. */ @@ -2353,7 +2353,7 @@ UtfToUtfProc( *dstCharsPtr = numChars; return result; } - + /* *------------------------------------------------------------------------- * @@ -2449,7 +2449,7 @@ Utf32ToUtfProc( *dstCharsPtr = numChars; return result; } - + /* *------------------------------------------------------------------------- * @@ -2530,13 +2530,13 @@ UtfToUtf32Proc( src += len; if (flags & TCL_ENCODING_LE) { *dst++ = (ch & 0xFF); - *dst++ = ((ch >> 8) & 0xff); - *dst++ = ((ch >> 16) & 0xff); - *dst++ = ((ch >> 24) & 0xff); + *dst++ = ((ch >> 8) & 0xFF); + *dst++ = ((ch >> 16) & 0xFF); + *dst++ = ((ch >> 24) & 0xFF); } else { - *dst++ = ((ch >> 24) & 0xff); - *dst++ = ((ch >> 16) & 0xff); - *dst++ = ((ch >> 8) & 0xff); + *dst++ = ((ch >> 24) & 0xFF); + *dst++ = ((ch >> 16) & 0xFF); + *dst++ = ((ch >> 8) & 0xFF); *dst++ = (ch & 0xFF); } } @@ -3048,11 +3048,7 @@ TableFromUtfProc( len = TclUtfToUniChar(src, &ch); #if TCL_UTF_MAX > 3 - /* - * This prevents a crash condition. More evaluation is required for - * full support of int Tcl_UniChar. [Bug 1004065] - */ - + /* Unicode chars > +U0FFFF cannot be represented in any table encoding */ if (ch & 0xFFFF0000) { word = 0; } else -- cgit v0.12 From 13223fbc3fca082c74336bb13dfb03e115d9f1cd Mon Sep 17 00:00:00 2001 From: griffin Date: Sun, 24 Oct 2021 18:19:16 +0000 Subject: These record locations are not relative offsets, but rather absolute locations. --- generic/tclZipfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index ae4c8c4..f649588 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3428,7 +3428,7 @@ SerializeCentralDirectoryEntry( ZipWriteShort(start, end, buf + ZIP_CENTRAL_IATTR_OFFS, 0); ZipWriteInt(start, end, buf + ZIP_CENTRAL_EATTR_OFFS, 0); ZipWriteInt(start, end, buf + ZIP_CENTRAL_LOCALHDR_OFFS, - z->offset - dataStartOffset); + z->offset); } static void @@ -3455,7 +3455,7 @@ SerializeCentralDirectorySuffix( ZipWriteInt(start, end, buf + ZIP_CENTRAL_DIRSIZE_OFFS, suffixStartOffset - directoryStartOffset); ZipWriteInt(start, end, buf + ZIP_CENTRAL_DIRSTART_OFFS, - directoryStartOffset - dataStartOffset); + directoryStartOffset); ZipWriteShort(start, end, buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0); } -- cgit v0.12 From e58d1a560fc2306653db113bdbc00944f1d493a8 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 25 Oct 2021 15:34:06 +0000 Subject: Revise outdated comments. --- generic/tclBinary.c | 107 +++++++++++++++++++++------------------------------- 1 file changed, 43 insertions(+), 64 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 6a32250..a133ed1 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -2,7 +2,7 @@ * tclBinary.c -- * * This file contains the implementation of the "binary" Tcl built-in - * command and the Tcl binary data object. + * command and the Tcl value internal representation for binary data. * * Copyright © 1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. @@ -165,12 +165,11 @@ static const EnsembleImplMap decodeMap[] = { * images to name just two. * * It's strange to have two Tcl_ObjTypes in place for this task when one would - * do, so a bit of detail and history how we got to this point and where we - * might go from here. + * do, so a bit of detail and history will aid understanding. * * A bytearray is an ordered sequence of bytes. Each byte is an integer value * in the range [0-255]. To be a Tcl value type, we need a way to encode each - * value in the value set as a Tcl string. The simplest encoding is to + * value in the value set as a Tcl string. A simple encoding is to * represent each byte value as the same codepoint value. A bytearray of N * bytes is encoded into a Tcl string of N characters where the codepoint of * each character is the value of corresponding byte. This approach creates a @@ -181,9 +180,7 @@ static const EnsembleImplMap decodeMap[] = { * question arises what to do with strings outside that subset? That is, * those Tcl strings containing at least one codepoint greater than 255? The * obviously correct answer is to raise an error! That string value does not - * represent any valid bytearray value. Full Stop. The setFromAnyProc - * signature has a completion code return value for just this reason, to - * reject invalid inputs. + * represent any valid bytearray value. * * Unfortunately this was not the path taken by the authors of the original * tclByteArrayType. They chose to accept all Tcl string values as acceptable @@ -191,33 +188,10 @@ static const EnsembleImplMap decodeMap[] = { * high bits of any codepoint value at all. This meant that every bytearray * value had multiple accepted string representations. * - * The implications of this choice are truly ugly. When a Tcl value has a - * string representation, we are required to accept that as the true value. - * Bytearray values that possess a string representation cannot be processed - * as bytearrays because we cannot know which true value that bytearray - * represents. The consequence is that we drag around an internal rep that we - * cannot make any use of. This painful price is extracted at any point after - * a string rep happens to be generated for the value. This happens even when - * the troublesome codepoints outside the byte range never show up. This - * happens rather routinely in normal Tcl operations unless we burden the - * script writer with the cognitive burden of avoiding it. The price is also - * paid by callers of the C interface. The routine - * - * unsigned char *Tcl_GetByteArrayFromObj(objPtr, lenPtr) - * - * has a guarantee to always return a non-NULL value, but that value points to - * a byte sequence that cannot be used by the caller to process the Tcl value - * absent some sideband testing that objPtr is "pure". Tcl offers no public - * interface to perform this test, so callers either break encapsulation or - * are unavoidably buggy. Tcl has defined a public interface that cannot be - * used correctly. The Tcl source code itself suffers the same problem, and - * has been buggy, but progressively less so as more and more portions of the - * code have been retrofitted with the required "purity testing". The set of - * values able to pass the purity test can be increased via the introduction - * of a "canonical" flag marker, but the only way the broken interface itself - * can be discarded is to start over and define the Tcl_ObjType properly. - * Bytearrays should simply be usable as bytearrays without a kabuki dance of - * testing. + * The implications of this choice are truly ugly, and motivated the proposal + * of TIP 568 to migrate away from it and to the more sensible design where + * each bytearray value has only one string representation. Full details are + * recorded in that TIP for those who seek them. * * The Tcl_ObjType "properByteArrayType" is (nearly) a correct implementation * of bytearrays. Any Tcl value with the type properByteArrayType can have @@ -226,21 +200,24 @@ static const EnsembleImplMap decodeMap[] = { * implies a side testing burden -- past mistakes will not let us avoid that * immediately, but it is at least a conventional test of type, and can be * implemented entirely by examining the objPtr fields, with no need to query - * the internalrep, as a canonical flag would require. - * - * Until Tcl_GetByteArrayFromObj() and Tcl_SetByteArrayLength() can be revised - * to admit the possibility of returning NULL when the true value is not a - * valid bytearray, we need a mechanism to retain compatibility with the - * deployed callers of the broken interface. That's what the retained - * "tclByteArrayType" provides. In those unusual circumstances where we - * convert an invalid bytearray value to a bytearray type, it is to this - * legacy type. Essentially any time this legacy type gets used, it's a - * signal of a bug being ignored. A TIP should be drafted to remove this - * connection to the broken past so that Tcl 9 will no longer have any trace - * of it. Prescribing a migration path will be the key element of that work. - * The internal changes now in place are the limit of what can be done short - * of interface repair. They provide a great expansion of the histories over - * which bytearray values can be useful in the meanwhile. + * the internalrep, as a canonical flag would require. This benefit is made + * available to extensions through the public routine Tcl_GetBytesFromObj(), + * first available in Tcl 8.7. + * + * The public routines Tcl_GetByteArrayFromObj() and Tcl_SetByteArrayLength() + * must continue to follow their documented behavior through the 8.* series of + * releases. To support that legacy operation, we need a mechanism to retain + * compatibility with the deployed callers of the broken interface. That's + * what the retained "tclByteArrayType" provides. In those unusual + * circumstances where we convert an invalid bytearray value to a bytearray + * type, it is to this legacy type. Essentially any time this legacy type + * shows up, it's a signal of a bug being ignored. + * + * In Tcl 9, the incompatibility in the behavior of these public routines + * has been approved, and the legacy internal rep is no longer retained. + * The internal changes seen below are the limit of what can be done + * in a Tcl 8.* release. They provide a great expansion of the histories + * over which bytearray values can be useful. */ static const Tcl_ObjType properByteArrayType = { @@ -267,15 +244,16 @@ const Tcl_ObjType tclByteArrayType = { */ typedef struct ByteArray { - unsigned int bad; /* Index of the character that is a nonbyte. - * If all characters are bytes, bad = used, - * though then we should never read it. */ + unsigned int bad; /* Index of first character that is a nonbyte. + * If all characters are bytes, bad = used. */ unsigned int used; /* The number of bytes used in the byte - * array. */ - unsigned int allocated; /* The amount of space actually allocated - * minus 1 byte. */ - unsigned char bytes[TCLFLEXARRAY]; /* The array of bytes. The actual size of this - * field depends on the 'allocated' field + * array. Must be <= allocated. The bytes + * used to store the value are indexed from + * 0 to used-1. */ + unsigned int allocated; /* The number of bytes of space allocated. */ + unsigned char bytes[TCLFLEXARRAY]; + /* The array of bytes. The actual size of this + * field is stored in the 'allocated' field * above. */ } ByteArray; @@ -301,7 +279,7 @@ TclIsPureByteArray( * from the given array of bytes. * * Results: - * The newly create object is returned. This object will have no initial + * The newly created object is returned. This object has no initial * string representation. The returned object has a ref count of 0. * * Side effects: @@ -346,7 +324,7 @@ Tcl_NewByteArrayObj( * result of calling Tcl_NewByteArrayObj. * * Results: - * The newly create object is returned. This object will have no initial + * The newly created object is returned. This object has no initial * string representation. The returned object has a ref count of 0. * * Side effects: @@ -444,11 +422,11 @@ Tcl_SetByteArrayObj( * * Attempt to extract the value from objPtr in the representation * of a byte sequence. On success return the extracted byte sequence. - * On failures, return NULL and record error message and code in + * On failure, return NULL and record error message and code in * interp (if not NULL). * * Results: - * Pointer to array of bytes, or NULL. representing the ByteArray object. + * NULL or pointer to array of bytes representing the ByteArray object. * Writes number of bytes in array to *lengthPtr. * *---------------------------------------------------------------------- @@ -459,7 +437,7 @@ TclGetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ int *lengthPtr) /* If non-NULL, filled with length of the - * array of bytes in the ByteArray object. */ + * returned array of bytes. */ { ByteArray *baPtr; const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &properByteArrayType); @@ -599,6 +577,7 @@ TclGetByteArrayFromObj( #if TCL_MAJOR_VERSION > 8 *lengthPtr = baPtr->used; #else + /* TODO: What's going on here? Document or eliminate. */ *lengthPtr = ((size_t)(unsigned)(baPtr->used + 1)) - 1; #endif } @@ -2162,7 +2141,7 @@ CopyNumber( * * FormatNumber -- * - * This routine is called by Tcl_BinaryObjCmd to format a number into a + * This routine is called by BinaryFormatCmd to format a number into a * location pointed at by cursor. * * Results: @@ -2331,7 +2310,7 @@ FormatNumber( * * ScanNumber -- * - * This routine is called by Tcl_BinaryObjCmd to scan a number out of a + * This routine is called by BinaryScanCmd to scan a number out of a * buffer. * * Results: -- cgit v0.12 From 4eaf0af8f2be1a74c73507138193543e47165584 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 25 Oct 2021 21:27:04 +0000 Subject: Update platform extension for MaxOS Monterey --- library/platform/platform.tcl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index e01334e..0e92cf8 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -364,6 +364,17 @@ proc ::platform::patterns {id} { foreach {major minor} [split $v .] break set res {} + if {$major eq 12} { + # Add 12.0 to 12.minor to patterns. + for {set j $minor} {$j >= 0} {incr j -1} { + lappend res macosx${major}.${j}-${cpu} + foreach a $alt { + lappend res macosx${major}.${j}-$a + } + } + set major 11 + set minor 5 + } if {$major eq 11} { # Add 11.0 to 11.minor to patterns. for {set j $minor} {$j >= 0} {incr j -1} { -- cgit v0.12 From daf00857b8f3a937f928222d82c33fbbb3fb7df9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 27 Oct 2021 06:48:14 +0000 Subject: Update TZ info to tzdata2021e --- library/tzdata/Asia/Gaza | 158 ++++++++++++++++++++++----------------------- library/tzdata/Asia/Hebron | 158 ++++++++++++++++++++++----------------------- 2 files changed, 158 insertions(+), 158 deletions(-) diff --git a/library/tzdata/Asia/Gaza b/library/tzdata/Asia/Gaza index 95523c9..86282fa 100644 --- a/library/tzdata/Asia/Gaza +++ b/library/tzdata/Asia/Gaza @@ -124,161 +124,161 @@ set TZData(:Asia/Gaza) { {1585346400 10800 1 EEST} {1603490400 7200 0 EET} {1616796000 10800 1 EEST} - {1635544800 7200 0 EET} + {1635458400 7200 0 EET} {1648245600 10800 1 EEST} - {1666994400 7200 0 EET} + {1666908000 7200 0 EET} {1679695200 10800 1 EEST} - {1698444000 7200 0 EET} + {1698357600 7200 0 EET} {1711749600 10800 1 EEST} - {1729893600 7200 0 EET} + {1729807200 7200 0 EET} {1743199200 10800 1 EEST} - {1761343200 7200 0 EET} + {1761861600 7200 0 EET} {1774648800 10800 1 EEST} - {1792792800 7200 0 EET} + {1793311200 7200 0 EET} {1806098400 10800 1 EEST} - {1824847200 7200 0 EET} + {1824760800 7200 0 EET} {1837548000 10800 1 EEST} - {1856296800 7200 0 EET} + {1856210400 7200 0 EET} {1868997600 10800 1 EEST} - {1887746400 7200 0 EET} + {1887660000 7200 0 EET} {1901052000 10800 1 EEST} - {1919196000 7200 0 EET} + {1919109600 7200 0 EET} {1932501600 10800 1 EEST} - {1950645600 7200 0 EET} + {1951164000 7200 0 EET} {1963951200 10800 1 EEST} - {1982700000 7200 0 EET} + {1982613600 7200 0 EET} {1995400800 10800 1 EEST} - {2014149600 7200 0 EET} + {2014063200 7200 0 EET} {2026850400 10800 1 EEST} - {2045599200 7200 0 EET} + {2045512800 7200 0 EET} {2058300000 10800 1 EEST} - {2077048800 7200 0 EET} + {2076962400 7200 0 EET} {2090354400 10800 1 EEST} - {2108498400 7200 0 EET} + {2109016800 7200 0 EET} {2121804000 10800 1 EEST} - {2139948000 7200 0 EET} + {2140466400 7200 0 EET} {2153253600 10800 1 EEST} - {2172002400 7200 0 EET} + {2171916000 7200 0 EET} {2184703200 10800 1 EEST} - {2203452000 7200 0 EET} + {2203365600 7200 0 EET} {2216152800 10800 1 EEST} - {2234901600 7200 0 EET} + {2234815200 7200 0 EET} {2248207200 10800 1 EEST} - {2266351200 7200 0 EET} + {2266264800 7200 0 EET} {2279656800 10800 1 EEST} - {2297800800 7200 0 EET} + {2298319200 7200 0 EET} {2311106400 10800 1 EEST} - {2329250400 7200 0 EET} + {2329768800 7200 0 EET} {2342556000 10800 1 EEST} - {2361304800 7200 0 EET} + {2361218400 7200 0 EET} {2374005600 10800 1 EEST} - {2392754400 7200 0 EET} + {2392668000 7200 0 EET} {2405455200 10800 1 EEST} - {2424204000 7200 0 EET} + {2424117600 7200 0 EET} {2437509600 10800 1 EEST} - {2455653600 7200 0 EET} + {2455567200 7200 0 EET} {2468959200 10800 1 EEST} - {2487103200 7200 0 EET} + {2487621600 7200 0 EET} {2500408800 10800 1 EEST} - {2519157600 7200 0 EET} + {2519071200 7200 0 EET} {2531858400 10800 1 EEST} - {2550607200 7200 0 EET} + {2550520800 7200 0 EET} {2563308000 10800 1 EEST} - {2582056800 7200 0 EET} + {2581970400 7200 0 EET} {2595362400 10800 1 EEST} - {2613506400 7200 0 EET} + {2613420000 7200 0 EET} {2626812000 10800 1 EEST} - {2644956000 7200 0 EET} + {2645474400 7200 0 EET} {2658261600 10800 1 EEST} - {2676405600 7200 0 EET} + {2676924000 7200 0 EET} {2689711200 10800 1 EEST} - {2708460000 7200 0 EET} + {2708373600 7200 0 EET} {2721160800 10800 1 EEST} - {2739909600 7200 0 EET} + {2739823200 7200 0 EET} {2752610400 10800 1 EEST} - {2771359200 7200 0 EET} + {2771272800 7200 0 EET} {2784664800 10800 1 EEST} - {2802808800 7200 0 EET} + {2802722400 7200 0 EET} {2816114400 10800 1 EEST} - {2834258400 7200 0 EET} + {2834776800 7200 0 EET} {2847564000 10800 1 EEST} - {2866312800 7200 0 EET} + {2866226400 7200 0 EET} {2879013600 10800 1 EEST} - {2897762400 7200 0 EET} + {2897676000 7200 0 EET} {2910463200 10800 1 EEST} - {2929212000 7200 0 EET} + {2929125600 7200 0 EET} {2941912800 10800 1 EEST} - {2960661600 7200 0 EET} + {2960575200 7200 0 EET} {2973967200 10800 1 EEST} - {2992111200 7200 0 EET} + {2992629600 7200 0 EET} {3005416800 10800 1 EEST} - {3023560800 7200 0 EET} + {3024079200 7200 0 EET} {3036866400 10800 1 EEST} - {3055615200 7200 0 EET} + {3055528800 7200 0 EET} {3068316000 10800 1 EEST} - {3087064800 7200 0 EET} + {3086978400 7200 0 EET} {3099765600 10800 1 EEST} - {3118514400 7200 0 EET} + {3118428000 7200 0 EET} {3131820000 10800 1 EEST} - {3149964000 7200 0 EET} + {3149877600 7200 0 EET} {3163269600 10800 1 EEST} - {3181413600 7200 0 EET} + {3181932000 7200 0 EET} {3194719200 10800 1 EEST} - {3212863200 7200 0 EET} + {3213381600 7200 0 EET} {3226168800 10800 1 EEST} - {3244917600 7200 0 EET} + {3244831200 7200 0 EET} {3257618400 10800 1 EEST} - {3276367200 7200 0 EET} + {3276280800 7200 0 EET} {3289068000 10800 1 EEST} - {3307816800 7200 0 EET} + {3307730400 7200 0 EET} {3321122400 10800 1 EEST} - {3339266400 7200 0 EET} + {3339180000 7200 0 EET} {3352572000 10800 1 EEST} - {3370716000 7200 0 EET} + {3371234400 7200 0 EET} {3384021600 10800 1 EEST} - {3402770400 7200 0 EET} + {3402684000 7200 0 EET} {3415471200 10800 1 EEST} - {3434220000 7200 0 EET} + {3434133600 7200 0 EET} {3446920800 10800 1 EEST} - {3465669600 7200 0 EET} + {3465583200 7200 0 EET} {3478975200 10800 1 EEST} - {3497119200 7200 0 EET} + {3497032800 7200 0 EET} {3510424800 10800 1 EEST} - {3528568800 7200 0 EET} + {3529087200 7200 0 EET} {3541874400 10800 1 EEST} - {3560018400 7200 0 EET} + {3560536800 7200 0 EET} {3573324000 10800 1 EEST} - {3592072800 7200 0 EET} + {3591986400 7200 0 EET} {3604773600 10800 1 EEST} - {3623522400 7200 0 EET} + {3623436000 7200 0 EET} {3636223200 10800 1 EEST} - {3654972000 7200 0 EET} + {3654885600 7200 0 EET} {3668277600 10800 1 EEST} - {3686421600 7200 0 EET} + {3686335200 7200 0 EET} {3699727200 10800 1 EEST} - {3717871200 7200 0 EET} + {3718389600 7200 0 EET} {3731176800 10800 1 EEST} - {3749925600 7200 0 EET} + {3749839200 7200 0 EET} {3762626400 10800 1 EEST} - {3781375200 7200 0 EET} + {3781288800 7200 0 EET} {3794076000 10800 1 EEST} - {3812824800 7200 0 EET} + {3812738400 7200 0 EET} {3825525600 10800 1 EEST} - {3844274400 7200 0 EET} + {3844188000 7200 0 EET} {3857580000 10800 1 EEST} - {3875724000 7200 0 EET} + {3876242400 7200 0 EET} {3889029600 10800 1 EEST} - {3907173600 7200 0 EET} + {3907692000 7200 0 EET} {3920479200 10800 1 EEST} - {3939228000 7200 0 EET} + {3939141600 7200 0 EET} {3951928800 10800 1 EEST} - {3970677600 7200 0 EET} + {3970591200 7200 0 EET} {3983378400 10800 1 EEST} - {4002127200 7200 0 EET} + {4002040800 7200 0 EET} {4015432800 10800 1 EEST} - {4033576800 7200 0 EET} + {4033490400 7200 0 EET} {4046882400 10800 1 EEST} - {4065026400 7200 0 EET} + {4065544800 7200 0 EET} {4078332000 10800 1 EEST} - {4096476000 7200 0 EET} + {4096994400 7200 0 EET} } diff --git a/library/tzdata/Asia/Hebron b/library/tzdata/Asia/Hebron index 3fdcd65..7559347 100644 --- a/library/tzdata/Asia/Hebron +++ b/library/tzdata/Asia/Hebron @@ -123,161 +123,161 @@ set TZData(:Asia/Hebron) { {1585346400 10800 1 EEST} {1603490400 7200 0 EET} {1616796000 10800 1 EEST} - {1635544800 7200 0 EET} + {1635458400 7200 0 EET} {1648245600 10800 1 EEST} - {1666994400 7200 0 EET} + {1666908000 7200 0 EET} {1679695200 10800 1 EEST} - {1698444000 7200 0 EET} + {1698357600 7200 0 EET} {1711749600 10800 1 EEST} - {1729893600 7200 0 EET} + {1729807200 7200 0 EET} {1743199200 10800 1 EEST} - {1761343200 7200 0 EET} + {1761861600 7200 0 EET} {1774648800 10800 1 EEST} - {1792792800 7200 0 EET} + {1793311200 7200 0 EET} {1806098400 10800 1 EEST} - {1824847200 7200 0 EET} + {1824760800 7200 0 EET} {1837548000 10800 1 EEST} - {1856296800 7200 0 EET} + {1856210400 7200 0 EET} {1868997600 10800 1 EEST} - {1887746400 7200 0 EET} + {1887660000 7200 0 EET} {1901052000 10800 1 EEST} - {1919196000 7200 0 EET} + {1919109600 7200 0 EET} {1932501600 10800 1 EEST} - {1950645600 7200 0 EET} + {1951164000 7200 0 EET} {1963951200 10800 1 EEST} - {1982700000 7200 0 EET} + {1982613600 7200 0 EET} {1995400800 10800 1 EEST} - {2014149600 7200 0 EET} + {2014063200 7200 0 EET} {2026850400 10800 1 EEST} - {2045599200 7200 0 EET} + {2045512800 7200 0 EET} {2058300000 10800 1 EEST} - {2077048800 7200 0 EET} + {2076962400 7200 0 EET} {2090354400 10800 1 EEST} - {2108498400 7200 0 EET} + {2109016800 7200 0 EET} {2121804000 10800 1 EEST} - {2139948000 7200 0 EET} + {2140466400 7200 0 EET} {2153253600 10800 1 EEST} - {2172002400 7200 0 EET} + {2171916000 7200 0 EET} {2184703200 10800 1 EEST} - {2203452000 7200 0 EET} + {2203365600 7200 0 EET} {2216152800 10800 1 EEST} - {2234901600 7200 0 EET} + {2234815200 7200 0 EET} {2248207200 10800 1 EEST} - {2266351200 7200 0 EET} + {2266264800 7200 0 EET} {2279656800 10800 1 EEST} - {2297800800 7200 0 EET} + {2298319200 7200 0 EET} {2311106400 10800 1 EEST} - {2329250400 7200 0 EET} + {2329768800 7200 0 EET} {2342556000 10800 1 EEST} - {2361304800 7200 0 EET} + {2361218400 7200 0 EET} {2374005600 10800 1 EEST} - {2392754400 7200 0 EET} + {2392668000 7200 0 EET} {2405455200 10800 1 EEST} - {2424204000 7200 0 EET} + {2424117600 7200 0 EET} {2437509600 10800 1 EEST} - {2455653600 7200 0 EET} + {2455567200 7200 0 EET} {2468959200 10800 1 EEST} - {2487103200 7200 0 EET} + {2487621600 7200 0 EET} {2500408800 10800 1 EEST} - {2519157600 7200 0 EET} + {2519071200 7200 0 EET} {2531858400 10800 1 EEST} - {2550607200 7200 0 EET} + {2550520800 7200 0 EET} {2563308000 10800 1 EEST} - {2582056800 7200 0 EET} + {2581970400 7200 0 EET} {2595362400 10800 1 EEST} - {2613506400 7200 0 EET} + {2613420000 7200 0 EET} {2626812000 10800 1 EEST} - {2644956000 7200 0 EET} + {2645474400 7200 0 EET} {2658261600 10800 1 EEST} - {2676405600 7200 0 EET} + {2676924000 7200 0 EET} {2689711200 10800 1 EEST} - {2708460000 7200 0 EET} + {2708373600 7200 0 EET} {2721160800 10800 1 EEST} - {2739909600 7200 0 EET} + {2739823200 7200 0 EET} {2752610400 10800 1 EEST} - {2771359200 7200 0 EET} + {2771272800 7200 0 EET} {2784664800 10800 1 EEST} - {2802808800 7200 0 EET} + {2802722400 7200 0 EET} {2816114400 10800 1 EEST} - {2834258400 7200 0 EET} + {2834776800 7200 0 EET} {2847564000 10800 1 EEST} - {2866312800 7200 0 EET} + {2866226400 7200 0 EET} {2879013600 10800 1 EEST} - {2897762400 7200 0 EET} + {2897676000 7200 0 EET} {2910463200 10800 1 EEST} - {2929212000 7200 0 EET} + {2929125600 7200 0 EET} {2941912800 10800 1 EEST} - {2960661600 7200 0 EET} + {2960575200 7200 0 EET} {2973967200 10800 1 EEST} - {2992111200 7200 0 EET} + {2992629600 7200 0 EET} {3005416800 10800 1 EEST} - {3023560800 7200 0 EET} + {3024079200 7200 0 EET} {3036866400 10800 1 EEST} - {3055615200 7200 0 EET} + {3055528800 7200 0 EET} {3068316000 10800 1 EEST} - {3087064800 7200 0 EET} + {3086978400 7200 0 EET} {3099765600 10800 1 EEST} - {3118514400 7200 0 EET} + {3118428000 7200 0 EET} {3131820000 10800 1 EEST} - {3149964000 7200 0 EET} + {3149877600 7200 0 EET} {3163269600 10800 1 EEST} - {3181413600 7200 0 EET} + {3181932000 7200 0 EET} {3194719200 10800 1 EEST} - {3212863200 7200 0 EET} + {3213381600 7200 0 EET} {3226168800 10800 1 EEST} - {3244917600 7200 0 EET} + {3244831200 7200 0 EET} {3257618400 10800 1 EEST} - {3276367200 7200 0 EET} + {3276280800 7200 0 EET} {3289068000 10800 1 EEST} - {3307816800 7200 0 EET} + {3307730400 7200 0 EET} {3321122400 10800 1 EEST} - {3339266400 7200 0 EET} + {3339180000 7200 0 EET} {3352572000 10800 1 EEST} - {3370716000 7200 0 EET} + {3371234400 7200 0 EET} {3384021600 10800 1 EEST} - {3402770400 7200 0 EET} + {3402684000 7200 0 EET} {3415471200 10800 1 EEST} - {3434220000 7200 0 EET} + {3434133600 7200 0 EET} {3446920800 10800 1 EEST} - {3465669600 7200 0 EET} + {3465583200 7200 0 EET} {3478975200 10800 1 EEST} - {3497119200 7200 0 EET} + {3497032800 7200 0 EET} {3510424800 10800 1 EEST} - {3528568800 7200 0 EET} + {3529087200 7200 0 EET} {3541874400 10800 1 EEST} - {3560018400 7200 0 EET} + {3560536800 7200 0 EET} {3573324000 10800 1 EEST} - {3592072800 7200 0 EET} + {3591986400 7200 0 EET} {3604773600 10800 1 EEST} - {3623522400 7200 0 EET} + {3623436000 7200 0 EET} {3636223200 10800 1 EEST} - {3654972000 7200 0 EET} + {3654885600 7200 0 EET} {3668277600 10800 1 EEST} - {3686421600 7200 0 EET} + {3686335200 7200 0 EET} {3699727200 10800 1 EEST} - {3717871200 7200 0 EET} + {3718389600 7200 0 EET} {3731176800 10800 1 EEST} - {3749925600 7200 0 EET} + {3749839200 7200 0 EET} {3762626400 10800 1 EEST} - {3781375200 7200 0 EET} + {3781288800 7200 0 EET} {3794076000 10800 1 EEST} - {3812824800 7200 0 EET} + {3812738400 7200 0 EET} {3825525600 10800 1 EEST} - {3844274400 7200 0 EET} + {3844188000 7200 0 EET} {3857580000 10800 1 EEST} - {3875724000 7200 0 EET} + {3876242400 7200 0 EET} {3889029600 10800 1 EEST} - {3907173600 7200 0 EET} + {3907692000 7200 0 EET} {3920479200 10800 1 EEST} - {3939228000 7200 0 EET} + {3939141600 7200 0 EET} {3951928800 10800 1 EEST} - {3970677600 7200 0 EET} + {3970591200 7200 0 EET} {3983378400 10800 1 EEST} - {4002127200 7200 0 EET} + {4002040800 7200 0 EET} {4015432800 10800 1 EEST} - {4033576800 7200 0 EET} + {4033490400 7200 0 EET} {4046882400 10800 1 EEST} - {4065026400 7200 0 EET} + {4065544800 7200 0 EET} {4078332000 10800 1 EEST} - {4096476000 7200 0 EET} + {4096994400 7200 0 EET} } -- cgit v0.12 From dcb9d4c3309720439bdd85d44f94a4e9dc08a17f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 27 Oct 2021 07:00:53 +0000 Subject: Update platform version (1.0.17 -> 1.0.18) for MacOS Monterey support --- library/platform/pkgIndex.tcl | 2 +- library/platform/platform.tcl | 2 +- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/platform/pkgIndex.tcl b/library/platform/pkgIndex.tcl index 7983831..de28fd1 100644 --- a/library/platform/pkgIndex.tcl +++ b/library/platform/pkgIndex.tcl @@ -1,3 +1,3 @@ -package ifneeded platform 1.0.17 [list source [file join $dir platform.tcl]] +package ifneeded platform 1.0.18 [list source [file join $dir platform.tcl]] package ifneeded platform::shell 1.1.4 [list source [file join $dir shell.tcl]] diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index 0e92cf8..752f069 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -420,7 +420,7 @@ proc ::platform::patterns {id} { # ### ### ### ######### ######### ######### ## Ready -package provide platform 1.0.17 +package provide platform 1.0.18 # ### ### ### ######### ######### ######### ## Demo application diff --git a/unix/Makefile.in b/unix/Makefile.in index 50b5839..d25dfdd 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -789,8 +789,8 @@ install-libraries: libraries $(INSTALL_TZDATA) install-msgs @echo "Installing package tcltest 2.5.3 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.5.3.tm; - @echo "Installing package platform 1.0.17 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.17.tm; + @echo "Installing package platform 1.0.18 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.18.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform/shell-1.1.4.tm; diff --git a/win/Makefile.in b/win/Makefile.in index f7fe219..61e4a96 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -673,8 +673,8 @@ install-libraries: libraries install-tzdata install-msgs @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.2.tm; @echo "Installing package tcltest 2.5.3 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.5.3.tm; - @echo "Installing package platform 1.0.17 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.17.tm; + @echo "Installing package platform 1.0.18 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.18.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm; @echo "Installing encodings"; -- cgit v0.12 From 8e166381ae6537d190dcf8e471675d50653293f6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 27 Oct 2021 08:12:26 +0000 Subject: Bump to 8.6.12 for release --- README.md | 2 +- changes | 9 +++++++++ generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.in | 2 +- unix/tcl.spec | 2 +- win/configure | 2 +- win/configure.in | 2 +- 9 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7a2bca0..045a287 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # README: Tcl -This is the **Tcl 8.6.11** source distribution. +This is the **Tcl 8.6.12** source distribution. You can get any source release of Tcl from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). diff --git a/changes b/changes index 07e432d..e2d04be 100644 --- a/changes +++ b/changes @@ -9074,3 +9074,12 @@ See RFC 2045 2020-12-23 tzdata updated to Olson's tzdata2020e (jima) - Released 8.6.11, Dec 31, 2020 - details at https://core.tcl-lang.org/tcl/ - + +!!!! TODO !!!! + +2021-10-27 (new) support for MacOS Monterey (nijtmans) +=> platform 1.0.18 + +2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans) + +- Released 8.6.12, Nov ??, 2021 - details at https://core.tcl-lang.org/tcl/ - diff --git a/generic/tcl.h b/generic/tcl.h index 2dc3ae2..41025e7 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -51,10 +51,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 6 #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE -#define TCL_RELEASE_SERIAL 11 +#define TCL_RELEASE_SERIAL 12 #define TCL_VERSION "8.6" -#define TCL_PATCH_LEVEL "8.6.11" +#define TCL_PATCH_LEVEL "8.6.12" /* *---------------------------------------------------------------------------- diff --git a/library/init.tcl b/library/init.tcl index 0a1f53a..edf6bd5 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.6.11 +package require -exact Tcl 8.6.12 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index ba91f77..7c976ed 100755 --- a/unix/configure +++ b/unix/configure @@ -1335,7 +1335,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".11" +TCL_PATCH_LEVEL=".12" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.in b/unix/configure.in index 21e47376..c73f368 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -26,7 +26,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".11" +TCL_PATCH_LEVEL=".12" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/tcl.spec b/unix/tcl.spec index de6fa2b..2e4a433 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.6.11 +Version: 8.6.12 Release: 2 License: BSD Group: Development/Languages diff --git a/win/configure b/win/configure index d6a934e..f355e51 100755 --- a/win/configure +++ b/win/configure @@ -1325,7 +1325,7 @@ SHELL=/bin/sh TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".11" +TCL_PATCH_LEVEL=".12" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.in b/win/configure.in index 2453eab..0aa3224 100644 --- a/win/configure.in +++ b/win/configure.in @@ -15,7 +15,7 @@ SHELL=/bin/sh TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".11" +TCL_PATCH_LEVEL=".12" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From 4c9ef53c219b4743a1ce308b2ff981d4bb8d01af Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 30 Oct 2021 19:49:33 +0000 Subject: update changes --- changes | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/changes b/changes index e2d04be..fba75e3 100644 --- a/changes +++ b/changes @@ -9075,11 +9075,44 @@ See RFC 2045 - Released 8.6.11, Dec 31, 2020 - details at https://core.tcl-lang.org/tcl/ - -!!!! TODO !!!! +2021-02-02 (new) support for MacOS Big Sur updates (nijtmans) +=> platform 1.0.17 + +2021-02-15 (bug)[d43f96] [string trim*] broken for Emoji (werner) + +2021-02-16 (bug)[22324b] [string reverse] broken for Emoji (werner) + +2021-02-19 (bug)[1dab71,7c64aa] BRE broken by uninitialized value use (lane) + +2021-03-09 (bug)[8419c5] Unix tty channels tolerate EINTR (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2021-03-10 (bug)[4c591f] [string compare] EIAS violation (nijtmans) + +2021-04-08 (new) dde package installation compatible with Tcl 9 (nijtmans) +=> dde 1.4.4 + +2021-04-14 (bug)[266494] [concat foo [list #]] EIAS violation (porter) + +2021-05-03 (bug)[24b918] Save IO buffers from modern optimizers (rupprecht) + +2021-05-06 (new) support for POSIX error EILSEQ (nijtmans) + +2021-05-17 (bug)[688fcc] segfault during traced delete of alias (coulter) + +2021-06-22 (bug)[bad6cc] More secure build tool. CVE-2021-35331 (nijtmans) + +2021-07-17 (bug)[592a25] Win: segfault in Tcl_PutEnv() (danckaert,nijtmans) + +2021-09-02 (bug)[ccc448] segfault in ensemble rewrite machinery (coulter) + +2021-09-14 (new) Update to Unicode-14 (nijtmans) + +2021-10-08 (bug)[a8579d] failed proc argument spec processing (russell,coulter) 2021-10-27 (new) support for MacOS Monterey (nijtmans) => platform 1.0.18 2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans) -- Released 8.6.12, Nov ??, 2021 - details at https://core.tcl-lang.org/tcl/ - +- Released 8.6.12, Nov 5, 2021 - details at https://core.tcl-lang.org/tcl/ - -- cgit v0.12 From d9aca414329c5e94459a6ba1aa2956ff25bd8594 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 1 Nov 2021 13:21:12 +0000 Subject: Update DragonFly/FreeBSD configuration (requested by Pietro Cerutti) --- unix/configure | 47 +++++++++++++++-------------------------------- unix/tcl.m4 | 47 ++++++++++++++++------------------------------- 2 files changed, 31 insertions(+), 63 deletions(-) diff --git a/unix/configure b/unix/configure index ba91f77..dc71c08 100755 --- a/unix/configure +++ b/unix/configure @@ -7306,7 +7306,7 @@ fi fi ;; - Linux*|GNU*|NetBSD-Debian) + Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" @@ -7320,6 +7320,20 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" + + case $system in + DragonFly-*|FreeBSD-*) + if test "${TCL_THREADS}" = "1"; then + + # The -pthread needs to go in the LDFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LDFLAGS="$LDFLAGS $PTHREAD_LIBS" +fi + + ;; + esac + if test $doRpath = yes; then CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' @@ -7508,37 +7522,6 @@ fi fi ;; - DragonFly-*|FreeBSD-*) - # This configuration from FreeBSD Ports. - SHLIB_LD="${CC} -shared" - SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@" - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - if test $doRpath = yes; then - - CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' - LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' -fi - - if test "${TCL_THREADS}" = "1"; then - - # The -pthread needs to go in the LDFLAGS, not LIBS - LIBS=`echo $LIBS | sed s/-pthread//` - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LDFLAGS="$LDFLAGS $PTHREAD_LIBS" -fi - - case $system in - FreeBSD-3.*) - # Version numbers are dot-stripped by system policy. - TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - TCL_LIB_VERSIONS_OK=nodots - ;; - esac - ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 9b0363c..f3d08ec 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1372,7 +1372,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ]) ]) ;; - Linux*|GNU*|NetBSD-Debian) + Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" @@ -1386,6 +1386,17 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" + + case $system in + DragonFly-*|FreeBSD-*) + AS_IF([test "${TCL_THREADS}" = "1"], [ + # The -pthread needs to go in the LDFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LDFLAGS="$LDFLAGS $PTHREAD_LIBS"]) + ;; + esac + AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} @@ -1394,7 +1405,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_m64 = yes], [ CFLAGS="$CFLAGS -m64" @@ -1491,31 +1503,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LDFLAGS="$LDFLAGS -pthread" ]) ;; - DragonFly-*|FreeBSD-*) - # This configuration from FreeBSD Ports. - SHLIB_LD="${CC} -shared" - SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]" - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - AS_IF([test $doRpath = yes], [ - CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"' - LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"']) - AS_IF([test "${TCL_THREADS}" = "1"], [ - # The -pthread needs to go in the LDFLAGS, not LIBS - LIBS=`echo $LIBS | sed s/-pthread//` - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LDFLAGS="$LDFLAGS $PTHREAD_LIBS"]) - case $system in - FreeBSD-3.*) - # Version numbers are dot-stripped by system policy. - TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - TCL_LIB_VERSIONS_OK=nodots - ;; - esac - ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" @@ -1536,8 +1523,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [tcl_cv_cc_arch_ppc64=yes], - [tcl_cv_cc_arch_ppc64=no]) + [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" @@ -1549,8 +1535,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [tcl_cv_cc_arch_x86_64=yes], - [tcl_cv_cc_arch_x86_64=no]) + [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [ CFLAGS="$CFLAGS -arch x86_64" -- cgit v0.12 From 88129d2c87709cf17bab1c40ed7e01df9f99cd55 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 2 Nov 2021 16:40:29 +0000 Subject: Revise the interface routines for byte arrays to use "numBytes" rather than "length" as argument names. --- doc/ByteArrObj.3 | 51 +++++++++++++++-------------- generic/tcl.decls | 16 ++++----- generic/tclBinary.c | 94 ++++++++++++++++++++++++++++------------------------- generic/tclDecls.h | 32 +++++++++--------- 4 files changed, 99 insertions(+), 94 deletions(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index a8b70eb..0703164 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -8,44 +8,44 @@ .so man.macros .BS .SH NAME -Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetByteArrayFromObj, Tcl_GetBytesFromObj, Tcl_SetByteArrayLength \- manipulate Tcl values as a arrays of bytes +Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetBytesFromObj, Tcl_GetByteArrayFromObj, Tcl_SetByteArrayLength \- manipulate a Tcl value as an array of bytes .SH SYNOPSIS .nf \fB#include \fR .sp Tcl_Obj * -\fBTcl_NewByteArrayObj\fR(\fIbytes, length\fR) +\fBTcl_NewByteArrayObj\fR(\fIbytes, numBytes\fR) .sp void -\fBTcl_SetByteArrayObj\fR(\fIobjPtr, bytes, length\fR) +\fBTcl_SetByteArrayObj\fR(\fIobjPtr, bytes, numBytes\fR) .sp .VS TIP568 unsigned char * -\fBTcl_GetBytesFromObj\fR(\fIinterp, objPtr, lengthPtr\fR) +\fBTcl_GetBytesFromObj\fR(\fIinterp, objPtr, numBytesPtr\fR) .VE TIP568 .sp unsigned char * -\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, lengthPtr\fR) +\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, numBytesPtr\fR) .sp unsigned char * -\fBTcl_SetByteArrayLength\fR(\fIobjPtr, length\fR) +\fBTcl_SetByteArrayLength\fR(\fIobjPtr, numBytes\fR) .SH ARGUMENTS -.AS "const unsigned char" *lengthPtr in/out -.AP Tcl_Interp *interp in -Interpreter to use for error reporting. +.AS "const unsigned char" *numBytesPtr in/out .AP "const unsigned char" *bytes in The array of bytes used to initialize or set a byte-array value. May be NULL -even if \fIlength\fR is non-zero. -.AP int length in -The length of the array of bytes. It must be >= 0. +even if \fInumBytes\fR is non-zero. +.AP int numBytes in +The number of bytes in the array. It must be >= 0. .AP Tcl_Obj *objPtr in/out For \fBTcl_SetByteArrayObj\fR, this points to an unshared value to be overwritten by a byte-array value. For \fBTcl_GetBytesFromObj\fR, \fBTcl_GetByteArrayFromObj\fR and \fBTcl_SetByteArrayLength\fR, this points -to the value from which to extract a byte-array value. -.AP "size_t | int" *lengthPtr out -Points to space to be filled with the length of the array of bytes extracted -from \fIobjPtr\fR. May be NULL when the caller does not need the length. +to the value from which to extract an array of bytes. +.AP Tcl_Interp *interp in +Interpreter to use for error reporting. +.AP "size_t | int" *numBytesPtr out +Points to space where the number of bytes in the array may be written. +Caller may pass NULL when it does not need this information. .BE .SH DESCRIPTION @@ -66,11 +66,11 @@ Modified UTF-8 encoding. .PP \fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR create a new value or overwrite an existing unshared value, respectively, -to hold a byte-array value of \fIlength\fR bytes. \fBTcl_NewByteArrayObj\fR +to hold a byte-array value of \fInumBytes\fR bytes. \fBTcl_NewByteArrayObj\fR returns a pointer to the created value with a reference count of zero. \fBTcl_SetByteArrayObj\fR overwrites and invalidates any old contents as appropriate, and keeps the same reference count (0 or 1). When -the \fIbytes\fR argument passed to either routine is not NULL, \fIlength\fR +the \fIbytes\fR argument passed to either routine is not NULL, \fInumBytes\fR bytes are copied from \fIbytes\fR into the new value. When the \fIbytes\fR argument passed to either routine is NULL, the contents of the resulting byte array value are undefined. A \fIbytes\fR @@ -81,8 +81,8 @@ only on unshared values, and accompanied by all appropriate invalidations. .PP \fBTcl_GetByteArrayFromObj\fR converts a Tcl value to byte-array type and returns a pointer to the value's new internal representation as an array of -bytes. The length of this array is stored in \fIlengthPtr\fR if -\fIlengthPtr\fR is non-NULL. The storage for the array of bytes is owned by +bytes. The number of bytes in this array is stored in \fInumBytesPtr\fR if +\fInumBytesPtr\fR is non-NULL. The storage for the array of bytes is owned by the value and should not be freed. The contents of the array may be modified by the caller only if the value is not shared and the caller invalidates the string representation. @@ -92,11 +92,12 @@ the difference is that this function can error if the object contains characters > 255. If \fBinterp\fR is not NULL, an error-message will be left there. .PP \fBTcl_SetByteArrayLength\fR converts the Tcl value to byte-array type -and changes the length of the value's internal representation as an -array of bytes. If \fIlength\fR is greater than the space currently -allocated for the array, the array is reallocated to the new length; the -newly allocated bytes at the end of the array have arbitrary values. If -\fIlength\fR is less than the space currently allocated for the array, +and changes the number of bytes in the value's internal representation as an +array of bytes. If \fInumBytes\fR is greater than the space currently +allocated for the array, the array is reallocated be large enough to store +the larger number of bytes; the newly allocated bytes at the end of the +array have arbitrary values. If +\fInumBytes\fR is less than the space currently allocated for the array, the length of array is reduced to the new length. The return value is a pointer to the value's new array of bytes. diff --git a/generic/tcl.decls b/generic/tcl.decls index bf547c2..ffd2f95 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -108,7 +108,7 @@ declare 22 {deprecated {No longer in use, changed to macro}} { Tcl_Obj *Tcl_DbNewBooleanObj(int boolValue, const char *file, int line) } declare 23 { - Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int length, + Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int numBytes, const char *file, int line) } declare 24 { @@ -143,7 +143,7 @@ declare 32 { int *boolPtr) } declare 33 { - unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr) + unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *numBytesPtr) } declare 34 { int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr) @@ -202,7 +202,7 @@ declare 49 {deprecated {No longer in use, changed to macro}} { Tcl_Obj *Tcl_NewBooleanObj(int boolValue) } declare 50 { - Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int length) + Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int numBytes) } declare 51 { Tcl_Obj *Tcl_NewDoubleObj(double doubleValue) @@ -226,11 +226,11 @@ declare 57 {deprecated {No longer in use, changed to macro}} { void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue) } declare 58 { - unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length) + unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int numBytes) } declare 59 { void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, const unsigned char *bytes, - int length) + int numBytes) } declare 60 { void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue) @@ -2405,11 +2405,11 @@ declare 648 { # TIP #568 declare 649 { unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - int *lengthPtr) + int *numBytesPtr) } declare 650 { unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - size_t *lengthPtr) + size_t *numBytesPtr) } # TIP #481 @@ -2420,7 +2420,7 @@ declare 652 { Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lengthPtr) } declare 653 { - unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lengthPtr) + unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *numBytesPtr) } # TIP #575 diff --git a/generic/tclBinary.c b/generic/tclBinary.c index a133ed1..24f085b 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -294,16 +294,16 @@ Tcl_Obj * Tcl_NewByteArrayObj( const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ - int length) /* Length of the array of bytes, which must be - * >= 0. */ + int numBytes) /* Number of bytes in the array, + * must be >= 0. */ { #ifdef TCL_MEM_DEBUG - return Tcl_DbNewByteArrayObj(bytes, length, "unknown", 0); + return Tcl_DbNewByteArrayObj(bytes, numBytes, "unknown", 0); #else /* if not TCL_MEM_DEBUG */ Tcl_Obj *objPtr; TclNewObj(objPtr); - Tcl_SetByteArrayObj(objPtr, bytes, length); + Tcl_SetByteArrayObj(objPtr, bytes, numBytes); return objPtr; #endif /* TCL_MEM_DEBUG */ } @@ -338,8 +338,8 @@ Tcl_Obj * Tcl_DbNewByteArrayObj( const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ - int length, /* Length of the array of bytes, which must be - * >= 0. */ + int numBytes, /* Number of bytes in the array, + * must be >= 0. */ const char *file, /* The name of the source file calling this * procedure; used for debugging. */ int line) /* Line number in the source file; used for @@ -348,7 +348,7 @@ Tcl_DbNewByteArrayObj( Tcl_Obj *objPtr; TclDbNewObj(objPtr, file, line); - Tcl_SetByteArrayObj(objPtr, bytes, length); + Tcl_SetByteArrayObj(objPtr, bytes, numBytes); return objPtr; } #else /* if not TCL_MEM_DEBUG */ @@ -356,12 +356,12 @@ Tcl_Obj * Tcl_DbNewByteArrayObj( const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ - int length, /* Length of the array of bytes, which must be - * >= 0. */ + int numBytes, /* Number of bytes in the array, + * must be >= 0. */ TCL_UNUSED(const char *) /*file*/, TCL_UNUSED(int) /*line*/) { - return Tcl_NewByteArrayObj(bytes, length); + return Tcl_NewByteArrayObj(bytes, numBytes); } #endif /* TCL_MEM_DEBUG */ @@ -387,9 +387,9 @@ void Tcl_SetByteArrayObj( Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */ const unsigned char *bytes, /* The array of bytes to use as the new value. - * May be NULL even if length > 0. */ - int length) /* Length of the array of bytes, which must - * be >= 0. */ + * May be NULL even if numBytes > 0. */ + int numBytes) /* Number of bytes in the array, + * must be >= 0. */ { ByteArray *byteArrayPtr; Tcl_ObjInternalRep ir; @@ -399,16 +399,14 @@ Tcl_SetByteArrayObj( } TclInvalidateStringRep(objPtr); - if (length < 0) { - length = 0; - } - byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length)); - byteArrayPtr->bad = length; - byteArrayPtr->used = length; - byteArrayPtr->allocated = length; + assert(numBytes >= 0); + byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(numBytes)); + byteArrayPtr->bad = numBytes; + byteArrayPtr->used = numBytes; + byteArrayPtr->allocated = numBytes; - if ((bytes != NULL) && (length > 0)) { - memcpy(byteArrayPtr->bytes, bytes, length); + if ((bytes != NULL) && (numBytes > 0)) { + memcpy(byteArrayPtr->bytes, bytes, numBytes); } SET_BYTEARRAY(&ir, byteArrayPtr); @@ -427,7 +425,7 @@ Tcl_SetByteArrayObj( * * Results: * NULL or pointer to array of bytes representing the ByteArray object. - * Writes number of bytes in array to *lengthPtr. + * Writes number of bytes in array to *numBytesPtr. * *---------------------------------------------------------------------- */ @@ -436,8 +434,8 @@ unsigned char * TclGetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ - int *lengthPtr) /* If non-NULL, filled with length of the - * returned array of bytes. */ + int *numBytesPtr) /* If non-NULL, write the number of bytes + * in the array here */ { ByteArray *baPtr; const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &properByteArrayType); @@ -465,8 +463,8 @@ TclGetBytesFromObj( } baPtr = GET_BYTEARRAY(irPtr); - if (lengthPtr != NULL) { - *lengthPtr = baPtr->used; + if (numBytesPtr != NULL) { + *numBytesPtr = baPtr->used; } return baPtr->bytes; } @@ -475,8 +473,8 @@ unsigned char * Tcl_GetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ - size_t *lengthPtr) /* If non-NULL, filled with length of the - * array of bytes in the ByteArray object. */ + size_t *numBytesPtr) /* If non-NULL, write the number of bytes + * in the array here */ { ByteArray *baPtr; const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &properByteArrayType); @@ -504,8 +502,8 @@ Tcl_GetBytesFromObj( } baPtr = GET_BYTEARRAY(irPtr); - if (lengthPtr != NULL) { - *lengthPtr = baPtr->used; + if (numBytesPtr != NULL) { + *numBytesPtr = baPtr->used; } return baPtr->bytes; } @@ -532,12 +530,12 @@ Tcl_GetBytesFromObj( unsigned char * Tcl_GetByteArrayFromObj( Tcl_Obj *objPtr, /* The ByteArray object. */ - int *lengthPtr) /* If non-NULL, filled with length of the - * array of bytes in the ByteArray object. */ + int *numBytesPtr) /* If non-NULL, write the number of bytes + * in the array here */ { ByteArray *baPtr; const Tcl_ObjInternalRep *irPtr; - unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr); + unsigned char *result = TclGetBytesFromObj(NULL, objPtr, numBytesPtr); if (result) { return result; @@ -548,8 +546,8 @@ Tcl_GetByteArrayFromObj( baPtr = GET_BYTEARRAY(irPtr); - if (lengthPtr != NULL) { - *lengthPtr = baPtr->used; + if (numBytesPtr != NULL) { + *numBytesPtr = baPtr->used; } return (unsigned char *) baPtr->bytes; } @@ -557,12 +555,12 @@ Tcl_GetByteArrayFromObj( unsigned char * TclGetByteArrayFromObj( Tcl_Obj *objPtr, /* The ByteArray object. */ - size_t *lengthPtr) /* If non-NULL, filled with length of the - * array of bytes in the ByteArray object. */ + size_t *numBytesPtr) /* If non-NULL, write the number of bytes + * in the array here */ { ByteArray *baPtr; const Tcl_ObjInternalRep *irPtr; - unsigned char *result = TclGetBytesFromObj(NULL, objPtr, (int *)NULL); + unsigned char *result = Tcl_GetBytesFromObj(NULL, objPtr, numBytesPtr); if (result) { return result; @@ -573,12 +571,12 @@ TclGetByteArrayFromObj( baPtr = GET_BYTEARRAY(irPtr); - if (lengthPtr != NULL) { + if (numBytesPtr != NULL) { #if TCL_MAJOR_VERSION > 8 - *lengthPtr = baPtr->used; + *numBytesPtr = baPtr->used; #else /* TODO: What's going on here? Document or eliminate. */ - *lengthPtr = ((size_t)(unsigned)(baPtr->used + 1)) - 1; + *numBytesPtr = ((size_t)(unsigned)(baPtr->used + 1)) - 1; #endif } return baPtr->bytes; @@ -609,14 +607,14 @@ TclGetByteArrayFromObj( unsigned char * Tcl_SetByteArrayLength( Tcl_Obj *objPtr, /* The ByteArray object. */ - int length) /* New length for internal byte array. */ + int numBytes) /* Number of bytes in resized array */ { ByteArray *byteArrayPtr; unsigned newLength; Tcl_ObjInternalRep *irPtr; - assert(length >= 0); - newLength = (unsigned int)length; + assert(numBytes >= 0); + newLength = (unsigned int)numBytes; if (Tcl_IsShared(objPtr)) { Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength"); @@ -634,6 +632,9 @@ Tcl_SetByteArrayLength( } } + /* Note that during truncation, the implementation does not free + * memory that is no longer needed. */ + byteArrayPtr = GET_BYTEARRAY(irPtr); if (newLength > byteArrayPtr->allocated) { byteArrayPtr = (ByteArray *)ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(newLength)); @@ -686,6 +687,9 @@ SetByteArrayFromAny( length = bad = objPtr->length; srcEnd = src + length; + /* Note the allocation is over-sized, possibly by a factor of four, + * or even a factor of two with a proper byte array value. */ + byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length)); for (dst = byteArrayPtr->bytes; src < srcEnd; ) { src += TclUtfToUniChar(src, &ch); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 8a361ce..e93e41d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -124,7 +124,7 @@ Tcl_Obj * Tcl_DbNewBooleanObj(int boolValue, const char *file, int line); /* 23 */ EXTERN Tcl_Obj * Tcl_DbNewByteArrayObj(const unsigned char *bytes, - int length, const char *file, int line); + int numBytes, const char *file, int line); /* 24 */ EXTERN Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue, const char *file, int line); @@ -152,7 +152,7 @@ EXTERN int Tcl_GetBooleanFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 33 */ EXTERN unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, - int *lengthPtr); + int *numBytesPtr); /* 34 */ EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr); @@ -205,7 +205,7 @@ TCL_DEPRECATED("No longer in use, changed to macro") Tcl_Obj * Tcl_NewBooleanObj(int boolValue); /* 50 */ EXTERN Tcl_Obj * Tcl_NewByteArrayObj(const unsigned char *bytes, - int length); + int numBytes); /* 51 */ EXTERN Tcl_Obj * Tcl_NewDoubleObj(double doubleValue); /* 52 */ @@ -224,10 +224,10 @@ EXTERN Tcl_Obj * Tcl_NewStringObj(const char *bytes, int length); TCL_DEPRECATED("No longer in use, changed to macro") void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue); /* 58 */ -EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length); +EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int numBytes); /* 59 */ EXTERN void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, - const unsigned char *bytes, int length); + const unsigned char *bytes, int numBytes); /* 60 */ EXTERN void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue); /* 61 */ @@ -1922,10 +1922,10 @@ EXTERN int * Tcl_UtfToUniCharDString(const char *src, int length, Tcl_DString *dsPtr); /* 649 */ EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, int *lengthPtr); + Tcl_Obj *objPtr, int *numBytesPtr); /* 650 */ EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, size_t *lengthPtr); + Tcl_Obj *objPtr, size_t *numBytesPtr); /* 651 */ EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, size_t *lengthPtr); @@ -1934,7 +1934,7 @@ EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lengthPtr); /* 653 */ EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr, - size_t *lengthPtr); + size_t *numBytesPtr); /* 654 */ EXTERN int Tcl_UtfCharComplete(const char *src, int length); /* 655 */ @@ -1998,7 +1998,7 @@ typedef struct TclStubs { void (*tcl_DbIncrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 20 */ int (*tcl_DbIsShared) (Tcl_Obj *objPtr, const char *file, int line); /* 21 */ TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewBooleanObj) (int boolValue, const char *file, int line); /* 22 */ - Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int length, const char *file, int line); /* 23 */ + Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int numBytes, const char *file, int line); /* 23 */ Tcl_Obj * (*tcl_DbNewDoubleObj) (double doubleValue, const char *file, int line); /* 24 */ Tcl_Obj * (*tcl_DbNewListObj) (int objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */ TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewLongObj) (long longValue, const char *file, int line); /* 26 */ @@ -2008,7 +2008,7 @@ typedef struct TclStubs { void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */ int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *boolPtr); /* 31 */ int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 32 */ - unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */ + unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *numBytesPtr); /* 33 */ int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */ int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */ TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */ @@ -2025,7 +2025,7 @@ typedef struct TclStubs { int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */ int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, int first, int count, int objc, Tcl_Obj *const objv[]); /* 48 */ TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewBooleanObj) (int boolValue); /* 49 */ - Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int length); /* 50 */ + Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int numBytes); /* 50 */ Tcl_Obj * (*tcl_NewDoubleObj) (double doubleValue); /* 51 */ TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewIntObj) (int intValue); /* 52 */ Tcl_Obj * (*tcl_NewListObj) (int objc, Tcl_Obj *const objv[]); /* 53 */ @@ -2033,8 +2033,8 @@ typedef struct TclStubs { Tcl_Obj * (*tcl_NewObj) (void); /* 55 */ Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, int length); /* 56 */ TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetBooleanObj) (Tcl_Obj *objPtr, int boolValue); /* 57 */ - unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int length); /* 58 */ - void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int length); /* 59 */ + unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int numBytes); /* 58 */ + void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int numBytes); /* 59 */ void (*tcl_SetDoubleObj) (Tcl_Obj *objPtr, double doubleValue); /* 60 */ TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetIntObj) (Tcl_Obj *objPtr, int intValue); /* 61 */ void (*tcl_SetListObj) (Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]); /* 62 */ @@ -2632,11 +2632,11 @@ typedef struct TclStubs { int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, int uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 648 */ - unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); /* 649 */ - unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, size_t *lengthPtr); /* 650 */ + unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */ + unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, size_t *numBytesPtr); /* 650 */ char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */ Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 652 */ - unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 653 */ + unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *numBytesPtr); /* 653 */ int (*tcl_UtfCharComplete) (const char *src, int length); /* 654 */ const char * (*tcl_UtfNext) (const char *src); /* 655 */ const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */ -- cgit v0.12 From cf9ec4f29ada714b10771db9437f510c4f0a4c94 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 5 Nov 2021 19:47:03 +0000 Subject: Adapt documentation of the *ByteArray* routines to better match Tcl library functioning post-TIP 568. --- doc/ByteArrObj.3 | 148 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 105 insertions(+), 43 deletions(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index 0703164..13aa012 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -50,57 +50,119 @@ Caller may pass NULL when it does not need this information. .SH DESCRIPTION .PP -These procedures are used to create, modify, and read Tcl byte-array values -from C code. Byte-array values are typically used to hold the -results of binary IO operations, data structures created with the -\fBbinary\fR command, or other information, such as encrypted data, -represented as arbitrary binary data. -A byte-array is an array of 8-bit quantities (the integer range 0 - 255) -with no inherent meaning. When a byte-array value must be processed as -a string, the sequence of \fBN\fR bytes is transformed into the corresponding -sequence of \fBN\fR characters, where each byte value transforms to the same +These routines are used to create, modify, store, transfer, and retrieve +arbitrary binary data in Tcl values. Specifically, data that can be +represented as a sequence of arbitrary byte values is supported. +This includes data read from binary channels, values created by the +\fBbinary\fR command, encrypted data, or other information representable as +a finite byte sequence. +.PP +A byte is an 8-bit quantity with no inherent meaning. When the 8 bits are +interpreted as an integer value, the range of possible values is (0-255). +The C type best suited to store a byte is the \fBunsigned char\fR. +An \fBunsigned char\fR array of size \fIN\fR stores an aribtrary binary +value of size \fIN\fR bytes. We call this representation a byte-array. +Here we document the routines that allow us to operate on Tcl values as +byte-arrays. +.PP +All Tcl values must correspond to a string representation. +When a byte-array value must be processed as a string, the sequence +of \fIN\fR bytes is transformed into the corresponding sequence +of \fIN\fR characters, where each byte value transforms to the same character codepoint value in the range (U+0000 - U+00FF). Obtaining the string representation of a byte-array value (by calling -\fBTcl_GetStringFromObj\fR) produces this string in Tcl's usual +\fBTcl_GetStringFromObj\fR) produces this string in Tcl's usual Modified UTF-8 encoding. .PP \fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR create a new value or overwrite an existing unshared value, respectively, -to hold a byte-array value of \fInumBytes\fR bytes. \fBTcl_NewByteArrayObj\fR +to hold a byte-array value of \fInumBytes\fR bytes. When a caller +passes a non-NULL value of \fIbytes\fR, it must point to memory from +which \fInumBytes\fR bytes can be read. These routines +allocate \fInumBytes\fR bytes of memory, copy \fInumBytes\fR +bytes from \fIbytes\fR into it, and keep the result in the internal +representation of the new or overwritten value. +When the caller passes a NULL value of \fIbytes\fR, the data copying +step is skipped, and the bytes stored in the value are undefined. +A \fIbytes\fR value of NULL is useful only when the caller will arrange +to write known contents into the byte-array through a pointer retrieved +by a call to one of the routines explained below. \fBTcl_NewByteArrayObj\fR returns a pointer to the created value with a reference count of zero. \fBTcl_SetByteArrayObj\fR overwrites and invalidates any old contents -as appropriate, and keeps the same reference count (0 or 1). When -the \fIbytes\fR argument passed to either routine is not NULL, \fInumBytes\fR -bytes are copied from \fIbytes\fR into the new value. When -the \fIbytes\fR argument passed to either routine is NULL, the -contents of the resulting byte array value are undefined. A \fIbytes\fR -value of NULL is useful only when the caller will arrange to write -known contents into the byte array through a pointer retrieved by a call -to one of the routines explained below. Such manipulation must be performed -only on unshared values, and accompanied by all appropriate invalidations. +of the unshared \fIobjPtr\fR as appropriate, and keeps its reference +count (0 or 1) unchanged. The value produced by these routines has no +string representation. Any memory allocation failure may cause a panic. +Note that the type of the \fInumBytes\fR argument is \fBint\fR; consequently +the largest byte-array value that can be produced by these routines is one +holding \fBINT_MAX\fR bytes. Note also that the string representation of +any Tcl value is limited to \fBINT_MAX\fR bytes, so caution should be +taken with any byte-array of more than \fBINT_MAX / 2\fR bytes. .PP -\fBTcl_GetByteArrayFromObj\fR converts a Tcl value to byte-array type and -returns a pointer to the value's new internal representation as an array of -bytes. The number of bytes in this array is stored in \fInumBytesPtr\fR if -\fInumBytesPtr\fR is non-NULL. The storage for the array of bytes is owned by -the value and should not be freed. The contents of the array may be -modified by the caller only if the value is not shared and the caller -invalidates the string representation. +\fBTcl_GetBytesFromObj\fR performs the opposite function of +\fBTcl_SetByteArrayObj\fR, providing access to read a byte-array from +a Tcl value that was previously written into it. When \fIobjPtr\fR +is a value previously produced by \fBTcl_NewByteArrayObj\fR or +\fBTcl_SetByteArrayObj\fR, then \fBTcl_GetBytesFromObj\fR returns +a pointer to the byte-array kept in the value's internal representation. +If the caller provides a non-NULL value for \fInumBytesPtr\fR, it must +point to memory where \fBTcl_GetBytesFromObj\fR can write the number +of bytes in the value's internal byte-array. With both pieces of +information, the caller is able to retrieve any information about the +contents of that byte-array that it seeks. When \fIobjPtr\fR does +not already contain an internal byte-array, \fBTcl_GetBytesFromObj\fR +will try to create one from the value's string representation. Any +string value that does not include any character codepoints outside +the range (U+0000 - U+00FF) will successfully translate to a unique +byte-array value. With the created byte-array, the routine returns +as before. For any string representation which does contain +a forbidden character codepoint, the conversion fails, and +\fBTcl_GetBytesFromObj\fR returns NULL to signal that failure. On +failure, nothing will be written to \fInumBytesPtr\fR, and if +the \fIinterp\fR argument is non-NULL, then error messages and +codes are left in it recording the error. .PP -\fBTcl_GetBytesFromObj\fR does almost the same as \fBTcl_GetByteArrayFromObj\fR, -the difference is that this function can error if the object contains -characters > 255. If \fBinterp\fR is not NULL, an error-message will be left there. +\fBTcl_GetByteArrayFromObj\fR performs nearly the same function as +\fBTcl_GetBytesFromObj\fR. They differ only in the circumstance when +a byte-array internal value must be created by transformation of +a string representation, and that string representation contains a +character with codepoint greater than U+00FF. Instead of failing +the conversion, \fBTcl_GetByteArrayFromObj\fR will use the 8 least +significant bits of each codepoint to produce a valid byte value +from any character codepoint value. In any other circumstance, +\fBTcl_GetByteArrayFromObj\fR performs just as \fBTcl_GetBytesFromObj\fR +does. Since the conversion cannot fail, \fBTcl_GetByteArrayFromObj\fR +has no need for an \fIinterp\fR argument to record any errors and +the caller can assume \fBTcl_GetByteArrayFromObj\fR does not return NULL. .PP -\fBTcl_SetByteArrayLength\fR converts the Tcl value to byte-array type -and changes the number of bytes in the value's internal representation as an -array of bytes. If \fInumBytes\fR is greater than the space currently -allocated for the array, the array is reallocated be large enough to store -the larger number of bytes; the newly allocated bytes at the end of the -array have arbitrary values. If -\fInumBytes\fR is less than the space currently allocated for the array, -the length of array is reduced to the new length. The return value is a -pointer to the value's new array of bytes. - +\fBTcl_GetByteArrayFromObj\fR must be used with caution. Because of the +truncation on conversion, the byte-array made available to the caller +cannot reliably complete a round-trip back to the original string +representation. This creates opportunities for bugs due to blindness +to differences in values. This routine exists in this form primarily +for compatibility with codebases written for earlier releases of Tcl. +It is expected this routine will incompatibly change in Tcl 9 so that +it also signals failed conversions with a NULL return. +.PP +On success, both \fBTcl_GetByteFromObj\fR and \fBTcl_GetByteArrayFromObj\fR +return a pointer into the internal representation of a \fBTcl_Obj\fR. +That pointer must not be freed by the caller, and should not be retained +for use beyond the known time the internal representation of the value +has not been disturbed. The pointer may be used to overwrite the byte +contents of the internal representation, so long as the value is unshared +and any string representation is invalidated. +.PP +\fBTcl_SetByteArrayLength\fR enables a caller to change the size of a +byte-array in the internal representation of an unshared \fIobjPtr\fR to +become \fInumBytes\fR bytes. This is most often useful after the +bytes of the internal byte-array have been directly overwritten and it +has been discovered that the required size differs from the first +estimate used in the allocation. \fBTcl_SetByteArrayLength\fR returns +a pointer to the resized byte-array. Along with such resizing, any +string representation of \fIobjPtr\fR must be invalidated. If resizing +grows the byte-array, the new byte values are undefined. If \fIobjPtr\fR +does not already possess an internal byte-array, one is produced in the +same way that \fBTcl_GetByteArrayFromObj\fR does, with all the cautions +that go along with that. .SH "REFERENCE COUNT MANAGEMENT" .PP \fBTcl_NewByteArrayObj\fR always returns a zero-reference object, much @@ -110,11 +172,11 @@ like \fBTcl_NewObj\fR. reference count of their \fIobjPtr\fR arguments, but do require that the object be unshared. .PP -\fBTcl_GetByteArrayFromObj\fR does not modify the reference count of its -\fIobjPtr\fR argument; it only reads. +\fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR do not modify +the reference count of \fIobjPtr\fR; they only read. .SH "SEE ALSO" Tcl_GetStringFromObj, Tcl_NewObj, Tcl_IncrRefCount, Tcl_DecrRefCount .SH KEYWORDS -value, binary data, byte array, utf, unicode, internationalization +value, binary data, byte array, utf, unicode -- cgit v0.12 From f096016a8e791b2cc0d577bfe29ef772ef7681b7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 6 Nov 2021 08:02:01 +0000 Subject: Eliminate unused variables/function-arguments --- doc/ByteArrObj.3 | 10 +++++----- generic/tclBinary.c | 8 ++++---- generic/tclZipfs.c | 23 +++++++---------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index 13aa012..cf033f8 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -74,14 +74,14 @@ string representation of a byte-array value (by calling \fBTcl_GetStringFromObj\fR) produces this string in Tcl's usual Modified UTF-8 encoding. .PP -\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR +\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR create a new value or overwrite an existing unshared value, respectively, to hold a byte-array value of \fInumBytes\fR bytes. When a caller -passes a non-NULL value of \fIbytes\fR, it must point to memory from +passes a non-NULL value of \fIbytes\fR, it must point to memory from which \fInumBytes\fR bytes can be read. These routines allocate \fInumBytes\fR bytes of memory, copy \fInumBytes\fR bytes from \fIbytes\fR into it, and keep the result in the internal -representation of the new or overwritten value. +representation of the new or overwritten value. When the caller passes a NULL value of \fIbytes\fR, the data copying step is skipped, and the bytes stored in the value are undefined. A \fIbytes\fR value of NULL is useful only when the caller will arrange @@ -115,11 +115,11 @@ string value that does not include any character codepoints outside the range (U+0000 - U+00FF) will successfully translate to a unique byte-array value. With the created byte-array, the routine returns as before. For any string representation which does contain -a forbidden character codepoint, the conversion fails, and +a forbidden character codepoint, the conversion fails, and \fBTcl_GetBytesFromObj\fR returns NULL to signal that failure. On failure, nothing will be written to \fInumBytesPtr\fR, and if the \fIinterp\fR argument is non-NULL, then error messages and -codes are left in it recording the error. +codes are left in it recording the error. .PP \fBTcl_GetByteArrayFromObj\fR performs nearly the same function as \fBTcl_GetBytesFromObj\fR. They differ only in the circumstance when diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 24f085b..7b12f4c 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -180,7 +180,7 @@ static const EnsembleImplMap decodeMap[] = { * question arises what to do with strings outside that subset? That is, * those Tcl strings containing at least one codepoint greater than 255? The * obviously correct answer is to raise an error! That string value does not - * represent any valid bytearray value. + * represent any valid bytearray value. * * Unfortunately this was not the path taken by the authors of the original * tclByteArrayType. They chose to accept all Tcl string values as acceptable @@ -211,11 +211,11 @@ static const EnsembleImplMap decodeMap[] = { * what the retained "tclByteArrayType" provides. In those unusual * circumstances where we convert an invalid bytearray value to a bytearray * type, it is to this legacy type. Essentially any time this legacy type - * shows up, it's a signal of a bug being ignored. - * + * shows up, it's a signal of a bug being ignored. + * * In Tcl 9, the incompatibility in the behavior of these public routines * has been approved, and the legacy internal rep is no longer retained. - * The internal changes seen below are the limit of what can be done + * The internal changes seen below are the limit of what can be done * in a Tcl 8.* release. They provide a great expansion of the histories * over which bytearray values can be useful. */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index f649588..60d77f4 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -308,13 +308,11 @@ static inline int ListMountPoints(Tcl_Interp *interp); static void SerializeCentralDirectoryEntry( const unsigned char *start, const unsigned char *end, unsigned char *buf, - ZipEntry *z, size_t nameLength, - long long dataStartOffset); + ZipEntry *z, size_t nameLength); static void SerializeCentralDirectorySuffix( const unsigned char *start, const unsigned char *end, unsigned char *buf, - int entryCount, long long dataStartOffset, - long long directoryStartOffset, + int entryCount, long long directoryStartOffset, long long suffixStartOffset); static void SerializeLocalEntryHeader( const unsigned char *start, @@ -1191,7 +1189,7 @@ ZipFSFindTOC( const unsigned char *p, *q; const unsigned char *start = zf->data; const unsigned char *end = zf->data + zf->length; - + /* * Scan backwards from the end of the file for the signature. This is * necessary because ZIP archives aren't the only things that get tagged @@ -1294,7 +1292,7 @@ ZipFSFindTOC( } zf->passOffset = minoff + zf->baseOffset; - + /* * If there's also an encoded password, extract that too (but don't decode * yet). @@ -3005,8 +3003,6 @@ ZipFSMkZipOrImg( Tcl_Channel out; int pwlen = 0, slen = 0, count, ret = TCL_ERROR, lobjc; size_t len, i = 0; - long long dataStartOffset; /* The overall file offset of the start of the - * data section of the file. */ long long directoryStartOffset; /* The overall file offset of the start of the * central directory. */ @@ -3183,7 +3179,6 @@ ZipFSMkZipOrImg( */ Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS); - dataStartOffset = Tcl_Tell(out); if (mappingList == NULL && stripPrefix != NULL) { strip = Tcl_GetStringFromObj(stripPrefix, &slen); if (!slen) { @@ -3224,7 +3219,7 @@ ZipFSMkZipOrImg( name = Tcl_UtfToExternalDString(ZipFS.utf8, z->name, -1, &ds); len = Tcl_DStringLength(&ds); SerializeCentralDirectoryEntry(start, end, (unsigned char *) buf, - z, len, dataStartOffset); + z, len); if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != ZIP_CENTRAL_HEADER_LEN) || ((size_t) Tcl_Write(out, name, len) != len)) { @@ -3244,7 +3239,7 @@ ZipFSMkZipOrImg( Tcl_Flush(out); suffixStartOffset = Tcl_Tell(out); SerializeCentralDirectorySuffix(start, end, (unsigned char *) buf, - count, dataStartOffset, directoryStartOffset, suffixStartOffset); + count, directoryStartOffset, suffixStartOffset); if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "write error: %s", Tcl_PosixError(interp))); @@ -3401,9 +3396,7 @@ SerializeCentralDirectoryEntry( const unsigned char *end, /* The end of writable memory. */ unsigned char *buf, /* Where to serialize to */ ZipEntry *z, /* The description of what to serialize. */ - size_t nameLength, /* The length of the name. */ - long long dataStartOffset) /* The overall file offset of the start of the - * data section of the file. */ + size_t nameLength) /* The length of the name. */ { ZipWriteInt(start, end, buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); @@ -3437,8 +3430,6 @@ SerializeCentralDirectorySuffix( const unsigned char *end, /* The end of writable memory. */ unsigned char *buf, /* Where to serialize to */ int entryCount, /* The number of entries in the directory */ - long long dataStartOffset, /* The overall file offset of the start of the - * data section of the file. */ long long directoryStartOffset, /* The overall file offset of the start of the * central directory. */ -- cgit v0.12 From 038dfd11b370a3cfa4b3aba72975da86ffbf0f85 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 6 Nov 2021 15:35:39 +0000 Subject: Make more use of the Tcl_ObjCmdProc typedef for tidier branch merging. --- generic/tclBinary.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index eb85103..d42eb50 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -71,31 +71,15 @@ static int NeedReversing(int format); static void CopyNumber(const void *from, void *to, unsigned length, int type); /* Binary ensemble commands */ -static int BinaryFormatCmd(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int BinaryScanCmd(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc BinaryFormatCmd; +static Tcl_ObjCmdProc BinaryScanCmd; /* Binary encoding sub-ensemble commands */ -static int BinaryEncodeHex(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int BinaryDecodeHex(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int BinaryEncode64(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int BinaryDecode64(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int BinaryEncodeUu(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int BinaryDecodeUu(ClientData clientData, - Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc BinaryEncodeHex; +static Tcl_ObjCmdProc BinaryDecodeHex; +static Tcl_ObjCmdProc BinaryEncode64; +static Tcl_ObjCmdProc BinaryDecode64; +static Tcl_ObjCmdProc BinaryEncodeUu; +static Tcl_ObjCmdProc BinaryDecodeUu; /* * The following tables are used by the binary encoders -- cgit v0.12 From c9f5f714b785e31d0e8c5b9bbd3d0874d23a8aa7 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 6 Nov 2021 15:37:14 +0000 Subject: Missing static. --- generic/tclBinary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index d42eb50..0f8f77e 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1237,7 +1237,7 @@ BinaryFormatCmd( *---------------------------------------------------------------------- */ -int +static int BinaryScanCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ -- cgit v0.12 From 36909daded61c42954adfbd6350c5a0cb34af2ee Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 6 Nov 2021 20:33:09 +0000 Subject: Doc fix. There is no endianness in the encoding of a single byte. --- doc/binary.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/binary.n b/doc/binary.n index fd6b356..43df4cc 100644 --- a/doc/binary.n +++ b/doc/binary.n @@ -86,7 +86,7 @@ RFC 2045 calls for base64 decoders to be non-strict. \fBhex\fR . The \fBhex\fR binary encoding converts each byte to a pair of hexadecimal -digits in big-endian form. +digits that represent the byte value as a hexadecimal integer. .RS .PP No options are supported during encoding. During decoding, the following -- cgit v0.12 From 370e151c6988f658a43fa9a98afc99b5593fe195 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 6 Nov 2021 22:45:26 +0000 Subject: typo --- doc/ByteArrObj.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index cf033f8..16e0ea8 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -143,7 +143,7 @@ for compatibility with codebases written for earlier releases of Tcl. It is expected this routine will incompatibly change in Tcl 9 so that it also signals failed conversions with a NULL return. .PP -On success, both \fBTcl_GetByteFromObj\fR and \fBTcl_GetByteArrayFromObj\fR +On success, both \fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR return a pointer into the internal representation of a \fBTcl_Obj\fR. That pointer must not be freed by the caller, and should not be retained for use beyond the known time the internal representation of the value -- cgit v0.12 From 84ac71183dfabec3532a34011f88dc0d47f78118 Mon Sep 17 00:00:00 2001 From: dgp Date: Sun, 7 Nov 2021 03:20:54 +0000 Subject: More accurately describe the string rep invalidation performed by Tcl_SetByteArrayLength() --- doc/ByteArrObj.3 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index 16e0ea8..1702c3a 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -157,8 +157,9 @@ become \fInumBytes\fR bytes. This is most often useful after the bytes of the internal byte-array have been directly overwritten and it has been discovered that the required size differs from the first estimate used in the allocation. \fBTcl_SetByteArrayLength\fR returns -a pointer to the resized byte-array. Along with such resizing, any -string representation of \fIobjPtr\fR must be invalidated. If resizing +a pointer to the resized byte-array. Because resizing the byte-array +changes the internal representation, \fBTcl_SetByteArrayLength\fR +also invalidates any string representation in \fIobjPtr\fR. If resizing grows the byte-array, the new byte values are undefined. If \fIobjPtr\fR does not already possess an internal byte-array, one is produced in the same way that \fBTcl_GetByteArrayFromObj\fR does, with all the cautions -- cgit v0.12 From 6eceb08de21bddce6cacfd581a5b3bc08a1a431c Mon Sep 17 00:00:00 2001 From: dgp Date: Sun, 7 Nov 2021 20:39:32 +0000 Subject: Document the freedom to provide space of either type int or size_t. --- doc/ByteArrObj.3 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 index 1702c3a..fd7f245 100644 --- a/doc/ByteArrObj.3 +++ b/doc/ByteArrObj.3 @@ -151,6 +151,14 @@ has not been disturbed. The pointer may be used to overwrite the byte contents of the internal representation, so long as the value is unshared and any string representation is invalidated. .PP +On success, both \fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR +write the number of bytes in the byte-array value of \fIobjPtr\fR +to the space pointed to by \fInumBytesPtr\fR. This space may be of type +\fBsize_t\fR or of type \fBint\fR. In Tcl 8, the largest number of +bytes possible is \fBINT_MAX\fR, so either type can receive the value. +In codebases meant to migrate to Tcl 9, the option to write to a space +of type \fBsize_t\fR may aid in the migration. +.PP \fBTcl_SetByteArrayLength\fR enables a caller to change the size of a byte-array in the internal representation of an unshared \fIobjPtr\fR to become \fInumBytes\fR bytes. This is most often useful after the -- cgit v0.12 From 5eb33c5c7e9d6b703275b680f337691ecfe38f2a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 7 Nov 2021 21:34:08 +0000 Subject: Fix [15845d9fd8]: unix/tcl.m4: implicit declaration of exit() in timezone variable checks --- unix/configure | 2 ++ unix/tcl.m4 | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index 37cf113..0b5fa29 100755 --- a/unix/configure +++ b/unix/configure @@ -14133,6 +14133,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include +#include int main () { @@ -14199,6 +14200,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include +#include int main () { diff --git a/unix/tcl.m4 b/unix/tcl.m4 index f3d08ec..6305ef7 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2349,7 +2349,8 @@ AC_DEFUN([SC_TIME_HANDLER], [ # (like convex) have timezone functions, etc. # AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[extern long timezone; timezone += 1; exit (0);]])], @@ -2361,7 +2362,8 @@ AC_DEFUN([SC_TIME_HANDLER], [ # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], [[extern time_t timezone; timezone += 1; exit (0);]])], -- cgit v0.12 From a112105294460f178a371ba9116b11c263b29f00 Mon Sep 17 00:00:00 2001 From: dgp Date: Sun, 7 Nov 2021 22:39:40 +0000 Subject: Update and clarify usage of the TclInitStringRep macro. --- generic/tclInt.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 08445a5..03d005a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4486,15 +4486,21 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, /* *---------------------------------------------------------------- * Macro used by the Tcl core to set a Tcl_Obj's string representation to a - * copy of the "len" bytes starting at "bytePtr". This code works even if the - * byte array contains NULLs as long as the length is correct. Because "len" - * is referenced multiple times, it should be as simple an expression as - * possible. The ANSI C "prototype" for this macro is: + * copy of the "len" bytes starting at "bytePtr". The value of "len" must + * not be negative. When "len" is 0, then it is acceptable to pass + * "bytePtr" = NULL. When "len" > 0, "bytePtr" must not be NULL, and it + * must point to a location from which "len" bytes may be read. These + * constraints are not checked here. The validity of the bytes copied + * as a value string representation is also not verififed. This macro + * must not be called while "objPtr" is being freed. The caller must use + * this macro properly. Improper use can lead to dangerous results. + * Because "len" is referenced multiple times, take care that it is an + * expression with the same value each use. + * + * The ANSI C "prototype" for this macro is: * * MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, int len); * - * This macro should only be called on an unshared objPtr where - * objPtr->typePtr->freeIntRepProc == NULL *---------------------------------------------------------------- */ -- cgit v0.12 From 411fc46d4f5e5e93a7d69db7f50e42b53005e343 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Nov 2021 00:06:27 +0000 Subject: [9899c273ab] Rewrite Tcl_InitStringRep to account for all encounters with the non-allocated empty string rep. --- generic/tclBinary.c | 1 - generic/tclDictObj.c | 1 + generic/tclInt.h | 3 ++- generic/tclObj.c | 51 +++++++++++++++++++++++++++++++++------------------ 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 5eb5b54..a586f18 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -842,7 +842,6 @@ UpdateStringOfByteArray( for (i = 0; i < length; i++) { dst += Tcl_UniCharToUtf(src[i], dst); } - (void) Tcl_InitStringRep(objPtr, NULL, size); } } diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 900974f..b4249b8 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -566,6 +566,7 @@ UpdateStringOfDict( dst += TclConvertElement(elem, length, dst, flagPtr[i+1]); *dst++ = ' '; } + /* Last space overwrote the terminating NUL; cal T_ISR again to restore */ (void)Tcl_InitStringRep(dictPtr, NULL, bytesNeeded - 1); if (flagPtr != localFlags) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 03d005a..7b03502 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4492,7 +4492,8 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, * must point to a location from which "len" bytes may be read. These * constraints are not checked here. The validity of the bytes copied * as a value string representation is also not verififed. This macro - * must not be called while "objPtr" is being freed. The caller must use + * must not be called while "objPtr" is being freed or when "objPtr" + * already has a string representation. The caller must use * this macro properly. Improper use can lead to dangerous results. * Because "len" is referenced multiple times, take care that it is an * expression with the same value each use. diff --git a/generic/tclObj.c b/generic/tclObj.c index e5ec838..92c6655 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1815,32 +1815,48 @@ Tcl_InitStringRep( Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } - /* Allocate */ if (objPtr->bytes == NULL) { - /* Allocate only as empty - extend later if bytes copied */ - objPtr->length = 0; - if (numBytes) { + /* Start with no string rep */ + if (numBytes == 0) { + TclInitStringRep(objPtr, NULL, 0); + return objPtr->bytes; + } else { objPtr->bytes = (char *)attemptckalloc(numBytes + 1); - if (objPtr->bytes == NULL) { - return NULL; - } - if (bytes) { - /* Copy */ - memcpy(objPtr->bytes, bytes, numBytes); + if (objPtr->bytes) { objPtr->length = (int) numBytes; + if (bytes) { + memcpy(objPtr->bytes, bytes, numBytes); + } + objPtr->bytes[objPtr->length] = '\0'; } + } + } else if (objPtr->bytes == &tclEmptyString) { + /* Start with empty string rep (not allocated) */ + if (numBytes == 0) { + return objPtr->bytes; } else { - TclInitStringRep(objPtr, NULL, 0); + objPtr->bytes = (char *)attemptckalloc(numBytes + 1); + if (objPtr->bytes) { + objPtr->length = (int) numBytes; + objPtr->bytes[objPtr->length] = '\0'; + } } } else { - /* objPtr->bytes != NULL bytes == NULL - Truncate */ - objPtr->bytes = (char *)ckrealloc(objPtr->bytes, numBytes + 1); - objPtr->length = (int)numBytes; + /* Start with non-empty string rep (allocated) */ + if (numBytes == 0) { + ckfree(objPtr->bytes); + TclInitStringRep(objPtr, NULL, 0); + return objPtr->bytes; + } else { + objPtr->bytes = (char *)attemptckrealloc(objPtr->bytes, + numBytes + 1); + if (objPtr->bytes) { + objPtr->length = (int) numBytes; + objPtr->bytes[objPtr->length] = '\0'; + } + } } - /* Terminate */ - objPtr->bytes[objPtr->length] = '\0'; - return objPtr->bytes; } @@ -3517,7 +3533,6 @@ UpdateStringOfBignum( if (MP_OKAY != mp_to_radix(&bignumVal, stringVal, size, NULL, 10)) { Tcl_Panic("conversion failure in UpdateStringOfBignum"); } - (void) Tcl_InitStringRep(objPtr, NULL, size - 1); } /* -- cgit v0.12 From 8bfcb2b80c3f401b2ef6307ccee7cbf19a8ad3a4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Nov 2021 13:43:07 +0000 Subject: Make "changes" file chronological (again) --- changes | 346 ++++++++++++++++++++++++++++--------------------------- generic/tclInt.h | 2 +- 2 files changed, 176 insertions(+), 172 deletions(-) diff --git a/changes b/changes index 5609dcb..3f7f12f 100644 --- a/changes +++ b/changes @@ -8990,178 +8990,10 @@ in this changeset (new minor version) rather than bug fixes: 2019-11-15 (bug)[135804] segfault in [next] after destroy (coulter,sebres) -- Released 8.6.10, Nov 21, 2019 - details at https://core.tcl-lang.org/tcl/ - - -2019-12-03 (bug)[3cd9be] Corner case in surrogate handling (nijtmans) - -2019-12-09 (new) Add tcltest::(Setup|Eval|Cleanup|)Test (coulter,sebres) -=> tcltest 2.5.2 - -2019-12-12 (new) Add 3 libtommath functions to stub table (nijtmans) - -2019-12-23 (bug)[ce3b9f] compilation errors with clang, windows msys2 (nijtmans) - -2019-12-27 (bug)[1de6b0] [expr 1e2147483648] => 0.0 (kbk) - -2020-01-04 (bug)[912886] tis-620 encoding fails to load (coulter) - -2020-01-13 (bug)[0b9332] Win: support system encoding init to utf-8 (jedlička) - -2020-01-17 (bug)[8cd2fe] [unload] corrupted list of loaded packages (berc) - -2020-01-17 (bug)[5d989f] segfault in lsort for large list length (sebres) - -2020-01-30 (bug) Reset WSAGetLastError()/errno in channel close (nijtmans) - -2020-02-17 (bug) Win: avoid create of legacy error-vars on init phase (sebres) - -2020-02-25 (bug) release refs when setting class's superclasses fails (dkf) - -2020-02-26 (bug) C++ compiler compatibility for registry and dde (nijtmans) -=> registry 1.3.5 -=> dde 1.4.3 - -2020-03-05 (new) Update to Unicode-13 (nijtmans) - -2020-03-16 (bug)[8f89e2] Win: env var encoding, env-2.5 (sebres, nijtmans) - -2020-03-27 (bug)[767e07] Tcl_Get(Range|UniChar) validate index inputs (nijtmans) - -2020-03-28 (bug)[8edfce] [binary encode base64] & multi-byte wrapchars (dgp) - -2020-03-28 (bug)[ffeb20] [binary decode base64] ignore invalid chars (dgp) -See RFC 2045 - *** POTENTIAL INCOMPATIBILITY *** - -2020-03-31 (bug)[b8e82d] some -maxlen values break uuencode round trip (dgp) - *** POTENTIAL INCOMPATIBILITY *** - -2020-04-01 (bug)[f58371] Fileevent run in proper thread (bron,sebres) - -2020-04-13 (bug)[afa4b2] TclNeedSpace bug; tests util-8.5 .. util-8.11 (dgp) - -2020-04-13 (bug)[085913] Tcl_DStringAppendElement # quoting precision (dgp) - *** POTENTIAL INCOMPATIBILITY *** - -2020-04-13 (bug)[a7f685] test util-5.52 (dgp) - -2020-04-13 (bug)[c61818] Tcl_UtfPrev regression (dgp) - -2020-04-15 (bug)[8af92d] zlib transform issue, bad inflate (sebres) - -2020-04-16 (bug)[5e6346] Tcl_UtfPrev handling of overlong sequences (dgp) - -2020-04-27 (bug)[45ca23] [string tolower] inconsistency (dgp) - -2020-04-30 (bug)[da2352] init [info hostname] with DNS, not NetBIOS (nadkarni) - -2020-05-11 (bug)[d402ff] Win32 potential crash when using main() (werner) - -2020-05-13 (bug)[81242a] revised documentation for Tcl_UtfAtIndex() (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2020-05-13 (bug)[ed2980] Tcl_UtfToUniChar reads > TCL_UTF_MAX bytes (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2020-06-02 (bug) prevent segfault in parser (sebres) - -2020-06-21 (bug)[f81bec] http POST a binary file (alakendu,nash) -=> http 2.9.2 - -2020-06-23 (bug)[41c985] auto_path nonsense in Safe Base (nash) - -2020-06-24 (bug)[f70ce1] zlib multi-stream inflate acts only on first (sebres) - -2020-07-09 (bug)[a1bd37] [clock scan] new ISO format (clock-34.(19-24)) (sebres) - *** POTENTIAL INCOMPATIBILITY *** - -2020-07-10 (bug)[501974] [clock scan] +time zone (clock-34.(53-68)) (sebres) - *** POTENTIAL INCOMPATIBILITY *** - -2020-07-15 (bug)[3c6e47] compiled [lappend] performance, avoid copy (sebres) - -2020-07-16 (bug)[5bbd04] Fix index underflow (schwab) - -2020-07-27 (bug)[cb0373] http::geturl -keepalive fixes (nash) -=> http 2.9.3 - -2020-08-10 (bug)[29e884] cmd resolution cycle (namespace-57.0) (coulter,sebres) - -2020-08-12 (bug)[e87000] Tcl_BadChannelOption tolerate NULL (werner,nijtmans) - -2020-08-31 (TIP #581) disfavor Master/Slave terminology (nijtmans) -=> opt 0.4.8 - -2020-09-11 (bug)[3bc0f4] UBSan complains about body.chars[] usage (nijtmans) - -2020-09-17 (bug)[835c93] Support TIP 525 exit code for -singleproc 1 (nijtmans) -=> tcltest 2.5.3 - -2020-09-25 (new) force -eofchar \032 when evaluating library scripts (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2020-09-29 (bug)[0063cb] http::geturl -headers must be dict (oehlmann,nijtmans) - -2020-10-19 (bug)[cb4582] Update install-sh script (stu,nijtmans) - -2020-10-22 (bug)[c97593] Usage of gnu_printf in latest mingw-w64 (nijtmans) - -2020-10-26 (new)[48898a] improve error message consistency (stu) - *** POTENTIAL INCOMPATIBILITY *** - -2020-11-06 (new) revised case of module names (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2020-12-10 (bug)[ed5be7] Win: recognize "comx:" as serial port (oehlmann) - -2020-12-11 (new) support for msys2, Big Sur (nijtmans) -=> platform 1.0.15 - -2020-12-23 tzdata updated to Olson's tzdata2020e (jima) - -- Released 8.6.11, Dec 31, 2020 - details at https://core.tcl-lang.org/tcl/ - - -2021-02-02 (new) support for MacOS Big Sur updates (nijtmans) -=> platform 1.0.17 - -2021-02-15 (bug)[d43f96] [string trim*] broken for Emoji (werner) - -2021-02-16 (bug)[22324b] [string reverse] broken for Emoji (werner) - -2021-02-19 (bug)[1dab71,7c64aa] BRE broken by uninitialized value use (lane) - -2021-03-09 (bug)[8419c5] Unix tty channels tolerate EINTR (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2021-03-10 (bug)[4c591f] [string compare] EIAS violation (nijtmans) - -2021-04-08 (new) dde package installation compatible with Tcl 9 (nijtmans) -=> dde 1.4.4 - -2021-04-14 (bug)[266494] [concat foo [list #]] EIAS violation (porter) - -2021-05-03 (bug)[24b918] Save IO buffers from modern optimizers (rupprecht) +2019-11-18 (bug)[13657a] application/json us text, not binary (noe,nijtmans) +=> http 2.9.1 -2021-05-06 (new) support for POSIX error EILSEQ (nijtmans) - -2021-05-17 (bug)[688fcc] segfault during traced delete of alias (coulter) - -2021-06-22 (bug)[bad6cc] More secure build tool. CVE-2021-35331 (nijtmans) - -2021-07-17 (bug)[592a25] Win: segfault in Tcl_PutEnv() (danckaert,nijtmans) - -2021-09-02 (bug)[ccc448] segfault in ensemble rewrite machinery (coulter) - -2021-09-14 (new) Update to Unicode-14 (nijtmans) - -2021-10-08 (bug)[a8579d] failed proc argument spec processing (russell,coulter) - -2021-10-27 (new) support for MacOS Monterey (nijtmans) -=> platform 1.0.18 - -2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans) - -- Released 8.6.12, Nov 5, 2021 - details at https://core.tcl-lang.org/tcl/ - +- Released 8.6.10, Nov 21, 2019 - details at https://core.tcl-lang.org/tcl/ - Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10, plus the following, which focuses on the high-level feature changes @@ -9295,6 +9127,136 @@ in this changeset (new minor version) rather than bug fixes: - Released 8.7a3, Nov 21, 2019 --- http://core.tcl-lang.org/tcl/ for details - +2019-12-03 (bug)[3cd9be] Corner case in surrogate handling (nijtmans) + +2019-12-09 (new) Add tcltest::(Setup|Eval|Cleanup|)Test (coulter,sebres) +=> tcltest 2.5.2 + +2019-12-12 (new) Add 3 libtommath functions to stub table (nijtmans) + +2019-12-23 (bug)[ce3b9f] compilation errors with clang, windows msys2 (nijtmans) + +2019-12-27 (bug)[1de6b0] [expr 1e2147483648] => 0.0 (kbk) + +2020-01-04 (bug)[912886] tis-620 encoding fails to load (coulter) + +2020-01-13 (bug)[0b9332] Win: support system encoding init to utf-8 (jedlička) + +2020-01-17 (bug)[8cd2fe] [unload] corrupted list of loaded packages (berc) + +2020-01-17 (bug)[5d989f] segfault in lsort for large list length (sebres) + +2020-01-30 (bug) Reset WSAGetLastError()/errno in channel close (nijtmans) + +2020-02-17 (bug) Win: avoid create of legacy error-vars on init phase (sebres) + +2020-02-25 (bug) release refs when setting class's superclasses fails (dkf) + +2020-02-26 (bug) C++ compiler compatibility for registry and dde (nijtmans) +=> registry 1.3.5 +=> dde 1.4.3 + +2020-03-05 (new) Update to Unicode-13 (nijtmans) + +2020-03-16 (bug)[8f89e2] Win: env var encoding, env-2.5 (sebres, nijtmans) + +2020-03-27 (bug)[767e07] Tcl_Get(Range|UniChar) validate index inputs (nijtmans) + +2020-03-28 (bug)[8edfce] [binary encode base64] & multi-byte wrapchars (dgp) + +2020-03-28 (bug)[ffeb20] [binary decode base64] ignore invalid chars (dgp) +See RFC 2045 + *** POTENTIAL INCOMPATIBILITY *** + +2020-03-31 (bug)[b8e82d] some -maxlen values break uuencode round trip (dgp) + *** POTENTIAL INCOMPATIBILITY *** + +2020-04-01 (bug)[f58371] Fileevent run in proper thread (bron,sebres) + +2020-04-13 (bug)[afa4b2] TclNeedSpace bug; tests util-8.5 .. util-8.11 (dgp) + +2020-04-13 (bug)[085913] Tcl_DStringAppendElement # quoting precision (dgp) + *** POTENTIAL INCOMPATIBILITY *** + +2020-04-13 (bug)[a7f685] test util-5.52 (dgp) + +2020-04-13 (bug)[c61818] Tcl_UtfPrev regression (dgp) + +2020-04-15 (bug)[8af92d] zlib transform issue, bad inflate (sebres) + +2020-04-16 (bug)[5e6346] Tcl_UtfPrev handling of overlong sequences (dgp) + +2020-04-27 (bug)[45ca23] [string tolower] inconsistency (dgp) + +2020-04-30 (bug)[da2352] init [info hostname] with DNS, not NetBIOS (nadkarni) + +2020-05-11 (bug)[d402ff] Win32 potential crash when using main() (werner) + +2020-05-13 (bug)[81242a] revised documentation for Tcl_UtfAtIndex() (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2020-05-13 (bug)[ed2980] Tcl_UtfToUniChar reads > TCL_UTF_MAX bytes (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2020-06-02 (bug) prevent segfault in parser (sebres) + +2020-06-21 (bug)[f81bec] http POST a binary file (alakendu,nash) +=> http 2.9.2 + +2020-06-23 (bug)[41c985] auto_path nonsense in Safe Base (nash) + +2020-06-24 (bug)[f70ce1] zlib multi-stream inflate acts only on first (sebres) + +2020-07-09 (bug)[a1bd37] [clock scan] new ISO format (clock-34.(19-24)) (sebres) + *** POTENTIAL INCOMPATIBILITY *** + +2020-07-10 (bug)[501974] [clock scan] +time zone (clock-34.(53-68)) (sebres) + *** POTENTIAL INCOMPATIBILITY *** + +2020-07-15 (bug)[3c6e47] compiled [lappend] performance, avoid copy (sebres) + +2020-07-16 (bug)[5bbd04] Fix index underflow (schwab) + +2020-07-27 (bug)[cb0373] http::geturl -keepalive fixes (nash) +=> http 2.9.3 + +2020-08-10 (bug)[29e884] cmd resolution cycle (namespace-57.0) (coulter,sebres) + +2020-08-12 (bug)[e87000] Tcl_BadChannelOption tolerate NULL (werner,nijtmans) + +2020-08-31 (TIP #581) disfavor Master/Slave terminology (nijtmans) +=> opt 0.4.8 + +2020-09-11 (bug)[3bc0f4] UBSan complains about body.chars[] usage (nijtmans) + +2020-09-17 (bug)[835c93] Support TIP 525 exit code for -singleproc 1 (nijtmans) +=> tcltest 2.5.3 + +2020-09-25 (new) force -eofchar \032 when evaluating library scripts (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2020-09-29 (bug)[0063cb] http::geturl -headers must be dict (oehlmann,nijtmans) + +2020-10-19 (bug)[cb4582] Update install-sh script (stu,nijtmans) + +2020-10-22 (bug)[c97593] Usage of gnu_printf in latest mingw-w64 (nijtmans) + +2020-10-26 (new)[48898a] improve error message consistency (stu) + *** POTENTIAL INCOMPATIBILITY *** + +2020-11-06 (new) revised case of module names (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2020-12-10 (bug)[ed5be7] Win: recognize "comx:" as serial port (oehlmann) + +2020-12-11 (new) support for msys2, Big Sur (nijtmans) +=> platform 1.0.15 + +2020-12-23 tzdata updated to Olson's tzdata2020e (jima) + +- Released 8.6.11, Dec 31, 2020 - details at https://core.tcl-lang.org/tcl/ - + + Changes to 8.7a5 include all changes to the 8.6 line through 8.6.11, plus the following, which focuses on the high-level feature changes in this changeset (new minor version) rather than bug fixes: @@ -9372,3 +9334,45 @@ in this changeset (new minor version) rather than bug fixes: 2021-05-18 (bug)[688fcc,28027d] namespace teardown reform (coulter) - Released 8.7a5, Jun 18, 2021 --- http://core.tcl-lang.org/tcl/ for details - + +2021-02-02 (new) support for MacOS Big Sur updates (nijtmans) +=> platform 1.0.17 + +2021-02-15 (bug)[d43f96] [string trim*] broken for Emoji (werner) + +2021-02-16 (bug)[22324b] [string reverse] broken for Emoji (werner) + +2021-02-19 (bug)[1dab71,7c64aa] BRE broken by uninitialized value use (lane) + +2021-03-09 (bug)[8419c5] Unix tty channels tolerate EINTR (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2021-03-10 (bug)[4c591f] [string compare] EIAS violation (nijtmans) + +2021-04-08 (new) dde package installation compatible with Tcl 9 (nijtmans) +=> dde 1.4.4 + +2021-04-14 (bug)[266494] [concat foo [list #]] EIAS violation (porter) + +2021-05-03 (bug)[24b918] Save IO buffers from modern optimizers (rupprecht) + +2021-05-06 (new) support for POSIX error EILSEQ (nijtmans) + +2021-05-17 (bug)[688fcc] segfault during traced delete of alias (coulter) + +2021-06-22 (bug)[bad6cc] More secure build tool. CVE-2021-35331 (nijtmans) + +2021-07-17 (bug)[592a25] Win: segfault in Tcl_PutEnv() (danckaert,nijtmans) + +2021-09-02 (bug)[ccc448] segfault in ensemble rewrite machinery (coulter) + +2021-09-14 (new) Update to Unicode-14 (nijtmans) + +2021-10-08 (bug)[a8579d] failed proc argument spec processing (russell,coulter) + +2021-10-27 (new) support for MacOS Monterey (nijtmans) +=> platform 1.0.18 + +2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans) + +- Released 8.6.12, Nov 5, 2021 - details at https://core.tcl-lang.org/tcl/ - diff --git a/generic/tclInt.h b/generic/tclInt.h index 7b03502..4e26bf3 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4496,7 +4496,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, * already has a string representation. The caller must use * this macro properly. Improper use can lead to dangerous results. * Because "len" is referenced multiple times, take care that it is an - * expression with the same value each use. + * expression with the same value each use. * * The ANSI C "prototype" for this macro is: * -- cgit v0.12 From fabf9b4e5371867db54cc26cabadd71ff07dabc9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Nov 2021 14:02:30 +0000 Subject: mingw-w64 website changed --- win/README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/README b/win/README index 7435cff..d332557 100644 --- a/win/README +++ b/win/README @@ -24,7 +24,7 @@ In order to compile Tcl for Windows, you need the following: or - Linux + MinGW-w64 [http://mingw-w64.sourceforge.net/] + Linux + MinGW-w64 [https://www.mingw-w64.org/] (win32 or win64) or @@ -34,12 +34,12 @@ In order to compile Tcl for Windows, you need the following: or - Darwin + MinGW-w64 [http://mingw-w64.sourceforge.net/] + Darwin + MinGW-w64 [https://www.mingw-w64.org/] (win32 or win64) or - Msys + MinGW-w64 [http://mingw-w64.sourceforge.net/] + Msys + MinGW-w64 [https://www.mingw-w64.org/] (win32 or win64) -- cgit v0.12