From cd51753d86cde24e24f0fa1c6edf6821ba25d0aa Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Apr 2023 15:53:40 +0000 Subject: More size_t -> Tcl_Size changes, which were missed before. Also (experimental) make the wrapper macro's produce compiler warnings is Tcl_Size is not used. --- generic/tclDecls.h | 46 +++++++++++++++++++++++----------------------- generic/tclExecute.c | 4 ++-- generic/tclIO.c | 4 ++-- generic/tclIOGT.c | 2 +- generic/tclIORTrans.c | 18 +++++++++--------- generic/tclObj.c | 2 +- generic/tclZlib.c | 2 +- win/tclWinFCmd.c | 2 +- win/tclWinFile.c | 10 +++++----- win/tclWinInit.c | 2 +- win/tclWinPipe.c | 2 +- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index bab0fd3..23a322b 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4041,15 +4041,15 @@ extern const TclStubs *tclStubsPtr; # define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (Tcl_Size *)(void *)(sizePtr))) + tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (sizePtr))) # define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ tclStubsPtr->tclGetStringFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetStringFromObj(objPtr, (Tcl_Size *)(void *)(sizePtr))) + tclStubsPtr->tcl_GetStringFromObj(objPtr, (sizePtr))) # define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ tclStubsPtr->tclGetUnicodeFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (Tcl_Size *)(void *)(sizePtr))) + tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (sizePtr))) # endif #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), \ @@ -4064,18 +4064,18 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ tclStubsPtr->tclGetBytesFromObj(NULL, objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetBytesFromObj(NULL, objPtr, (Tcl_Size *)(void *)(sizePtr))) + tclStubsPtr->tcl_GetBytesFromObj(NULL, objPtr, (sizePtr))) #else #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ tclStubsPtr->tclGetByteArrayFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (Tcl_Size *)(void *)(sizePtr))) + tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (sizePtr))) #endif #else #define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclGetBytesFromObj(interp, objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetBytesFromObj)(interp, objPtr, (Tcl_Size *)(void *)(sizePtr))) + (Tcl_GetBytesFromObj)(interp, objPtr, (sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), \ (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) @@ -4088,15 +4088,15 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclGetStringFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetStringFromObj)(objPtr, (Tcl_Size *)(void *)(sizePtr))) + (Tcl_GetStringFromObj)(objPtr, (sizePtr))) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclGetBytesFromObj(NULL, objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetBytesFromObj)(NULL, objPtr, (Tcl_Size *)(void *)(sizePtr))) + (Tcl_GetBytesFromObj)(NULL, objPtr, (sizePtr))) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ TclGetUnicodeFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetUnicodeFromObj)(objPtr, (Tcl_Size *)(void *)(sizePtr))) + (Tcl_GetUnicodeFromObj)(objPtr, (sizePtr))) #endif #ifdef TCL_MEM_DEBUG @@ -4172,31 +4172,31 @@ extern const TclStubs *tclStubsPtr; # undef Tcl_ListObjGetElements # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \ ? tclStubsPtr->tclListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ - : tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (Tcl_Size *)(void *)(objcPtr), (objvPtr))) + : tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr))) # undef Tcl_ListObjLength # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \ ? tclStubsPtr->tclListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \ - : tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (Tcl_Size *)(void *)(lengthPtr))) + : tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (lengthPtr))) # undef Tcl_DictObjSize # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \ ? tclStubsPtr->tclDictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \ - : tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (Tcl_Size *)(void *)(sizePtr))) + : tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (sizePtr))) # undef Tcl_SplitList # define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? tclStubsPtr->tclSplitList((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \ - : tclStubsPtr->tcl_SplitList((interp), (listStr), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) + : tclStubsPtr->tcl_SplitList((interp), (listStr), (argcPtr), (argvPtr))) # undef Tcl_SplitPath # define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? tclStubsPtr->tclSplitPath((path), (int *)(void *)(argcPtr), (argvPtr)) \ - : tclStubsPtr->tcl_SplitPath((path), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) + : tclStubsPtr->tcl_SplitPath((path), (argcPtr), (argvPtr))) # undef Tcl_FSSplitPath # define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \ ? tclStubsPtr->tclFSSplitPath((pathPtr), (int *)(void *)(lenPtr)) \ - : tclStubsPtr->tcl_FSSplitPath((pathPtr), (Tcl_Size *)(void *)(lenPtr))) + : tclStubsPtr->tcl_FSSplitPath((pathPtr), (lenPtr))) # undef Tcl_ParseArgsObjv # define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \ ? tclStubsPtr->tclParseArgsObjv((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \ - : tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (Tcl_Size *)(void *)(objcPtr), (objv), (remObjv))) + : tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv))) #endif /* TCL_MAJOR_VERSION < 9 || !defined(TCL_NO_DEPRECATED) */ #else # define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \ @@ -4214,25 +4214,25 @@ extern const TclStubs *tclStubsPtr; #if !defined(BUILD_tcl) && !defined(TCL_NO_DEPRECATED) # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \ ? TclListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ - : (Tcl_ListObjGetElements)((interp), (listPtr), (Tcl_Size *)(void *)(objcPtr), (objvPtr))) + : (Tcl_ListObjGetElements)((interp), (listPtr), (objcPtr), (objvPtr))) # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \ ? TclListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \ - : (Tcl_ListObjLength)((interp), (listPtr), (Tcl_Size *)(void *)(lengthPtr))) + : (Tcl_ListObjLength)((interp), (listPtr), (lengthPtr))) # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \ ? TclDictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \ - : (Tcl_DictObjSize)((interp), (dictPtr), (Tcl_Size *)(void *)(sizePtr))) + : (Tcl_DictObjSize)((interp), (dictPtr), (sizePtr))) # define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? TclSplitList((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \ - : (Tcl_SplitList)((interp), (listStr), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) + : (Tcl_SplitList)((interp), (listStr), (argcPtr), (argvPtr))) # define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? TclSplitPath((path), (int *)(void *)(argcPtr), (argvPtr)) \ - : (Tcl_SplitPath)((path), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) + : (Tcl_SplitPath)((path), (argcPtr), (argvPtr))) # define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \ ? TclFSSplitPath((pathPtr), (int *)(void *)(lenPtr)) \ - : (Tcl_FSSplitPath)((pathPtr), (Tcl_Size *)(void *)(lenPtr))) + : (Tcl_FSSplitPath)((pathPtr), (lenPtr))) # define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \ ? TclParseArgsObjv((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \ - : (Tcl_ParseArgsObjv)((interp), (argTable), (Tcl_Size *)(void *)(objcPtr), (objv), (remObjv))) + : (Tcl_ParseArgsObjv)((interp), (argTable), (objcPtr), (objv), (remObjv))) #endif /* !defined(BUILD_tcl) */ #endif diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 31a8695..789c139 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5272,7 +5272,7 @@ TEBCresume( TclNewObj(objResultPtr); } else if (TclIsPureByteArray(valuePtr)) { objResultPtr = Tcl_NewByteArrayObj( - Tcl_GetByteArrayFromObj(valuePtr, (size_t *)NULL)+index, 1); + Tcl_GetByteArrayFromObj(valuePtr, (Tcl_Size *)NULL)+index, 1); } else if (valuePtr->bytes && slength == valuePtr->length) { objResultPtr = Tcl_NewStringObj((const char *) valuePtr->bytes+index, 1); @@ -5536,7 +5536,7 @@ TEBCresume( nocase); } else if (TclIsPureByteArray(valuePtr) && TclIsPureByteArray(value2Ptr) && !nocase) { unsigned char *bytes1, *bytes2; - size_t wlen1 = 0, wlen2 = 0; + Tcl_Size wlen1 = 0, wlen2 = 0; bytes1 = Tcl_GetByteArrayFromObj(valuePtr, &wlen1); bytes2 = Tcl_GetByteArrayFromObj(value2Ptr, &wlen2); diff --git a/generic/tclIO.c b/generic/tclIO.c index 4e2e37d..7c05696 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -4649,7 +4649,7 @@ Tcl_GetsObj( if (statePtr->encoding == GetBinaryEncoding() && ((statePtr->inputTranslation == TCL_TRANSLATE_LF) || (statePtr->inputTranslation == TCL_TRANSLATE_CR)) - && Tcl_GetByteArrayFromObj(objPtr, (size_t *)NULL) != NULL) { + && Tcl_GetByteArrayFromObj(objPtr, (Tcl_Size *)NULL) != NULL) { return TclGetsObjBinary(chan, objPtr); } @@ -5990,7 +5990,7 @@ DoReadChars( && (statePtr->inEofChar == '\0'); if (appendFlag) { - if (binaryMode && (NULL == Tcl_GetByteArrayFromObj(objPtr, (size_t *)NULL))) { + if (binaryMode && (NULL == Tcl_GetByteArrayFromObj(objPtr, (Tcl_Size *)NULL))) { binaryMode = 0; } } else { diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 1290ac7..98a1dd3 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -375,7 +375,7 @@ ExecuteCallback( * interpreters. */ { Tcl_Obj *resObj; /* See below, switch (transmit). */ - size_t resLen = 0; + Tcl_Size resLen = 0; unsigned char *resBuf; Tcl_InterpState state = NULL; int res = TCL_OK; diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 3c54366..90e7195 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -264,7 +264,7 @@ struct ForwardParamTransform { ForwardParamBase base; /* "Supertype". MUST COME FIRST. */ char *buf; /* I: Bytes to transform, * O: Bytes in transform result */ - size_t size; /* I: #bytes to transform, + Tcl_Size size; /* I: #bytes to transform, * O: #bytes in the transform result */ }; struct ForwardParamLimit { @@ -2562,7 +2562,7 @@ ForwardProc( * Sent it back to the request originator. */ - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ @@ -2596,7 +2596,7 @@ ForwardProc( * Sent it back to the request originator. */ - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ @@ -2626,7 +2626,7 @@ ForwardProc( * Sent it back to the request originator. */ - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ bytev = Tcl_GetByteArrayFromObj(resObj, &bytec); @@ -2652,7 +2652,7 @@ ForwardProc( * Sent it back to the request originator. */ - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ @@ -3045,7 +3045,7 @@ TransformRead( Tcl_Obj *bufObj) { Tcl_Obj *resObj; - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ /* @@ -3100,7 +3100,7 @@ TransformWrite( { Tcl_Obj *bufObj; Tcl_Obj *resObj; - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ int res; @@ -3167,7 +3167,7 @@ TransformDrain( int *errorCodePtr) { Tcl_Obj *resObj; - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ /* @@ -3216,7 +3216,7 @@ TransformFlush( int op) { Tcl_Obj *resObj; - size_t bytec = 0; /* Number of returned bytes */ + Tcl_Size bytec = 0; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ int res; diff --git a/generic/tclObj.c b/generic/tclObj.c index a978a09..9d27fca 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1702,7 +1702,7 @@ TclGetStringFromObj( if (lengthPtr != NULL) { if (objPtr->length > INT_MAX) { Tcl_Panic("Tcl_GetStringFromObj with 'int' lengthPtr" - " cannot handle such long strings. Please use 'size_t'"); + " cannot handle such long strings. Please use 'Tcl_Size'"); } *lengthPtr = (int)objPtr->length; } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 1399ec9..e083243 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -3761,7 +3761,7 @@ ZlibStackChannelTransform( if (compDictObj != NULL) { cd->compDictObj = Tcl_DuplicateObj(compDictObj); Tcl_IncrRefCount(cd->compDictObj); - Tcl_GetByteArrayFromObj(cd->compDictObj, (size_t *)NULL); + Tcl_GetByteArrayFromObj(cd->compDictObj, (Tcl_Size *)NULL); } if (format == TCL_ZLIB_FORMAT_RAW) { diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 391c119..37f0834 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1536,7 +1536,7 @@ GetWinFileAttributes( * We test for, and fix that case, here. */ - size_t len; + Tcl_Size len; const char *str = Tcl_GetStringFromObj(fileName, &len); if (len < 4) { diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 0410356..bcd0920 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -921,7 +921,7 @@ TclpMatchInDirectory( DWORD attr; WIN32_FILE_ATTRIBUTE_DATA data; - size_t len = 0; + Tcl_Size len = 0; const char *str = Tcl_GetStringFromObj(norm, &len); native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr); @@ -943,7 +943,7 @@ TclpMatchInDirectory( WIN32_FIND_DATAW data; const char *dirName; /* UTF-8 dir name, later with pattern * appended. */ - size_t dirLength; + Tcl_Size dirLength; int matchSpecialDots; Tcl_DString ds; /* Native encoding of dir, also used * temporarily for other things. */ @@ -2796,7 +2796,7 @@ TclpObjNormalizePath( */ Tcl_Obj *tmpPathPtr; - size_t len; + Tcl_Size len; tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), nextCheckpoint); @@ -2885,7 +2885,7 @@ TclWinVolumeRelativeNormalize( * also on drive C. */ - size_t cwdLen; + Tcl_Size cwdLen; const char *drive = Tcl_GetStringFromObj(useThisCwd, &cwdLen); char drive_cur = path[0]; @@ -3022,7 +3022,7 @@ TclNativeCreateNativeRep( WCHAR *nativePathPtr = NULL; const char *str; Tcl_Obj *validPathPtr; - size_t len; + Tcl_Size len; WCHAR *wp; if (TclFSCwdIsNative()) { diff --git a/win/tclWinInit.c b/win/tclWinInit.c index ec27837..510b6df 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -131,7 +131,7 @@ TclpInitLibraryPath( Tcl_Obj *pathPtr; char installLib[LIBRARY_SIZE]; const char *bytes; - size_t length; + Tcl_Size length; TclNewObj(pathPtr); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index da24306..d9cee73 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3191,7 +3191,7 @@ TclpOpenTemporaryFile( char *namePtr; HANDLE handle; DWORD flags = FILE_ATTRIBUTE_TEMPORARY; - size_t length; + Tcl_Size length; int counter, counter2; Tcl_DString buf; -- cgit v0.12 From 372bf743344195cfcf84a7c71e9891071184b867 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Apr 2023 19:29:44 +0000 Subject: Reduce number of needed type-casts. No change in functionality --- generic/tcl.decls | 22 ++++----- generic/tclBinary.c | 4 +- generic/tclDecls.h | 123 +++++++++++++++++++++++++------------------------ generic/tclObj.c | 4 +- generic/tclStringObj.c | 4 +- generic/tclStubInit.c | 30 ++++++------ 6 files changed, 94 insertions(+), 93 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 0b3daa3..d52b710 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -146,7 +146,7 @@ declare 32 { } # Only available in Tcl 8.x, NULL in Tcl 9.0 declare 33 { - unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, int *numBytesPtr) + unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, void *numBytesPtr) } declare 34 { int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr) @@ -173,7 +173,7 @@ declare 40 { const Tcl_ObjType *Tcl_GetObjType(const char *typeName) } declare 41 { - char *TclGetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr) + char *TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr) } declare 42 { void Tcl_InvalidateStringRep(Tcl_Obj *objPtr) @@ -188,7 +188,7 @@ declare 44 { } declare 45 { int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, - int *objcPtr, Tcl_Obj ***objvPtr) + void *objcPtr, Tcl_Obj ***objvPtr) } declare 46 { int Tcl_ListObjIndex(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size index, @@ -196,7 +196,7 @@ declare 46 { } declare 47 { int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, - int *lengthPtr) + void *lengthPtr) } declare 48 { int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size first, @@ -881,12 +881,12 @@ declare 241 { void Tcl_SourceRCFile(Tcl_Interp *interp) } declare 242 { - int TclSplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, + int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr) } # Obsolete, use Tcl_FSSplitPath declare 243 { - void TclSplitPath(const char *path, int *argcPtr, const char ***argvPtr) + void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr) } # Removed in 9.0 (stub entry only) #declare 244 { @@ -1601,7 +1601,7 @@ declare 433 { # introduced in 8.4a3 declare 434 { - Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr) + Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, void *lengthPtr) } # TIP#15 (math function introspection) dkf @@ -1702,7 +1702,7 @@ declare 460 { Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, Tcl_Size elements) } declare 461 { - Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, int *lenPtr) + Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr) } declare 462 { int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, Tcl_Obj *secondPtr) @@ -1841,7 +1841,7 @@ declare 496 { Tcl_Obj *keyPtr) } declare 497 { - int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr) + int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr) } declare 498 { int Tcl_DictObjFirst(Tcl_Interp *interp, Tcl_Obj *dictPtr, @@ -2270,7 +2270,7 @@ declare 603 { # TIP#265 (option parser) dkf for Sam Bromley declare 604 { int TclParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, - int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) + void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) } # TIP#336 (manipulate the error line) dgp @@ -2468,7 +2468,7 @@ declare 648 { # TIP #568 declare 649 { unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - int *numBytesPtr) + void *numBytesPtr) } declare 650 { unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, diff --git a/generic/tclBinary.c b/generic/tclBinary.c index f8f006d..dd8b292 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -386,7 +386,7 @@ unsigned char * TclGetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ - int *numBytesPtr) /* If non-NULL, write the number of bytes + void *numBytesPtr) /* If non-NULL, write the number of bytes * in the array here */ { Tcl_Size numBytes = 0; @@ -404,7 +404,7 @@ TclGetBytesFromObj( } return NULL; } else { - *numBytesPtr = (int) numBytes; + *(int *)numBytesPtr = (int) numBytes; } } return bytes; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 23a322b..db8f957 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -136,7 +136,7 @@ EXTERN int Tcl_GetBooleanFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 33 */ EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr, - int *numBytesPtr); + void *numBytesPtr); /* 34 */ EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr); @@ -156,7 +156,7 @@ EXTERN int Tcl_GetLongFromObj(Tcl_Interp *interp, /* 40 */ EXTERN const Tcl_ObjType * Tcl_GetObjType(const char *typeName); /* 41 */ -EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr); +EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr); /* 42 */ EXTERN void Tcl_InvalidateStringRep(Tcl_Obj *objPtr); /* 43 */ @@ -167,7 +167,7 @@ EXTERN int Tcl_ListObjAppendElement(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 45 */ EXTERN int TclListObjGetElements(Tcl_Interp *interp, - Tcl_Obj *listPtr, int *objcPtr, + Tcl_Obj *listPtr, void *objcPtr, Tcl_Obj ***objvPtr); /* 46 */ EXTERN int Tcl_ListObjIndex(Tcl_Interp *interp, @@ -175,7 +175,7 @@ EXTERN int Tcl_ListObjIndex(Tcl_Interp *interp, Tcl_Obj **objPtrPtr); /* 47 */ EXTERN int TclListObjLength(Tcl_Interp *interp, - Tcl_Obj *listPtr, int *lengthPtr); + Tcl_Obj *listPtr, void *lengthPtr); /* 48 */ EXTERN int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size first, @@ -665,9 +665,9 @@ EXTERN const char * Tcl_SignalMsg(int sig); EXTERN void Tcl_SourceRCFile(Tcl_Interp *interp); /* 242 */ EXTERN int TclSplitList(Tcl_Interp *interp, const char *listStr, - int *argcPtr, const char ***argvPtr); + void *argcPtr, const char ***argvPtr); /* 243 */ -EXTERN void TclSplitPath(const char *path, int *argcPtr, +EXTERN void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr); /* Slot 244 is reserved */ /* Slot 245 is reserved */ @@ -1137,7 +1137,8 @@ EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, /* 433 */ EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel); /* 434 */ -EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr); +EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr, + void *lengthPtr); /* Slot 435 is reserved */ /* Slot 436 is reserved */ /* 437 */ @@ -1209,7 +1210,7 @@ EXTERN int Tcl_FSConvertToPathType(Tcl_Interp *interp, /* 460 */ EXTERN Tcl_Obj * Tcl_FSJoinPath(Tcl_Obj *listObj, Tcl_Size elements); /* 461 */ -EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, int *lenPtr); +EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr); /* 462 */ EXTERN int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, Tcl_Obj *secondPtr); @@ -1306,7 +1307,7 @@ EXTERN int Tcl_DictObjRemove(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); /* 497 */ EXTERN int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, - int *sizePtr); + void *sizePtr); /* 498 */ EXTERN int Tcl_DictObjFirst(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_DictSearch *searchPtr, @@ -1612,7 +1613,7 @@ EXTERN int Tcl_GetEnsembleParameterList(Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 604 */ EXTERN int TclParseArgsObjv(Tcl_Interp *interp, - const Tcl_ArgvInfo *argTable, int *objcPtr, + const Tcl_ArgvInfo *argTable, void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 605 */ EXTERN int Tcl_GetErrorLine(Tcl_Interp *interp); @@ -1744,7 +1745,7 @@ EXTERN int * Tcl_UtfToUniCharDString(const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 649 */ EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, int *numBytesPtr); + Tcl_Obj *objPtr, void *numBytesPtr); /* 650 */ EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *numBytesPtr); @@ -1911,7 +1912,7 @@ typedef struct TclStubs { void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */ int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *intPtr); /* 31 */ int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 32 */ - unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, int *numBytesPtr); /* 33 */ + unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, void *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 */ void (*reserved36)(void); @@ -1919,13 +1920,13 @@ typedef struct TclStubs { int (*tcl_GetIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 38 */ int (*tcl_GetLongFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr); /* 39 */ const Tcl_ObjType * (*tcl_GetObjType) (const char *typeName); /* 40 */ - char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 41 */ + char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 41 */ void (*tcl_InvalidateStringRep) (Tcl_Obj *objPtr); /* 42 */ int (*tcl_ListObjAppendList) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); /* 43 */ int (*tcl_ListObjAppendElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 44 */ - int (*tclListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr); /* 45 */ + int (*tclListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, void *objcPtr, Tcl_Obj ***objvPtr); /* 45 */ int (*tcl_ListObjIndex) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size index, Tcl_Obj **objPtrPtr); /* 46 */ - int (*tclListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */ + int (*tclListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, void *lengthPtr); /* 47 */ int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size first, Tcl_Size count, Tcl_Size objc, Tcl_Obj *const objv[]); /* 48 */ void (*reserved49)(void); Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, Tcl_Size numBytes); /* 50 */ @@ -2120,8 +2121,8 @@ typedef struct TclStubs { const char * (*tcl_SignalId) (int sig); /* 239 */ const char * (*tcl_SignalMsg) (int sig); /* 240 */ void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */ - int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */ - void (*tclSplitPath) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */ + int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr); /* 242 */ + void (*tclSplitPath) (const char *path, void *argcPtr, const char ***argvPtr); /* 243 */ void (*reserved244)(void); void (*reserved245)(void); void (*reserved246)(void); @@ -2312,7 +2313,7 @@ typedef struct TclStubs { void * (*tcl_AttemptDbCkrealloc) (void *ptr, TCL_HASH_TYPE size, const char *file, int line); /* 431 */ int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, Tcl_Size length); /* 432 */ Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */ - Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */ + Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 434 */ void (*reserved435)(void); void (*reserved436)(void); Tcl_Obj * (*tcl_SubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 437 */ @@ -2339,7 +2340,7 @@ typedef struct TclStubs { int (*tcl_FSChdir) (Tcl_Obj *pathPtr); /* 458 */ int (*tcl_FSConvertToPathType) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 459 */ Tcl_Obj * (*tcl_FSJoinPath) (Tcl_Obj *listObj, Tcl_Size elements); /* 460 */ - Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, int *lenPtr); /* 461 */ + Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, void *lenPtr); /* 461 */ int (*tcl_FSEqualPaths) (Tcl_Obj *firstPtr, Tcl_Obj *secondPtr); /* 462 */ Tcl_Obj * (*tcl_FSGetNormalizedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 463 */ Tcl_Obj * (*tcl_FSJoinToPath) (Tcl_Obj *pathPtr, Tcl_Size objc, Tcl_Obj *const objv[]); /* 464 */ @@ -2375,7 +2376,7 @@ typedef struct TclStubs { int (*tcl_DictObjPut) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj *valuePtr); /* 494 */ int (*tcl_DictObjGet) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); /* 495 */ int (*tcl_DictObjRemove) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); /* 496 */ - int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr); /* 497 */ + int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr); /* 497 */ int (*tcl_DictObjFirst) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_DictSearch *searchPtr, Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr); /* 498 */ void (*tcl_DictObjNext) (Tcl_DictSearch *searchPtr, Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr); /* 499 */ void (*tcl_DictObjDone) (Tcl_DictSearch *searchPtr); /* 500 */ @@ -2482,7 +2483,7 @@ typedef struct TclStubs { unsigned (*tcl_GetBlockSizeFromStat) (const Tcl_StatBuf *statPtr); /* 601 */ int (*tcl_SetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *paramList); /* 602 */ int (*tcl_GetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 603 */ - int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */ + int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */ int (*tcl_GetErrorLine) (Tcl_Interp *interp); /* 605 */ void (*tcl_SetErrorLine) (Tcl_Interp *interp, int lineNum); /* 606 */ void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int code, Tcl_Interp *targetInterp); /* 607 */ @@ -2527,7 +2528,7 @@ typedef struct TclStubs { Tcl_Size (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */ char * (*tcl_UniCharToUtfDString) (const int *uniStr, Tcl_Size uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 648 */ - unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */ + unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void *numBytesPtr); /* 649 */ unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *numBytesPtr); /* 650 */ char * (*tcl_GetStringFromObj) (Tcl_Obj *objPtr, Tcl_Size *lengthPtr); /* 651 */ Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, Tcl_Size *lengthPtr); /* 652 */ @@ -4040,16 +4041,16 @@ extern const TclStubs *tclStubsPtr; # if TCL_MAJOR_VERSION < 9 || !defined(TCL_NO_DEPRECATED) # define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (sizePtr))) + tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (sizePtr)) : \ + tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (Tcl_Size *)(void *)(sizePtr))) # define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - tclStubsPtr->tclGetStringFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetStringFromObj(objPtr, (sizePtr))) + tclStubsPtr->tclGetStringFromObj(objPtr, (sizePtr)) : \ + tclStubsPtr->tcl_GetStringFromObj(objPtr, (Tcl_Size *)(void *)(sizePtr))) # define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - tclStubsPtr->tclGetUnicodeFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (sizePtr))) + tclStubsPtr->tclGetUnicodeFromObj(objPtr, (sizePtr)) : \ + tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (Tcl_Size *)(void *)(sizePtr))) # endif #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), \ @@ -4063,19 +4064,19 @@ extern const TclStubs *tclStubsPtr; #if TCL_MAJOR_VERSION > 8 #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - tclStubsPtr->tclGetBytesFromObj(NULL, objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetBytesFromObj(NULL, objPtr, (sizePtr))) + tclStubsPtr->tclGetBytesFromObj(NULL, objPtr, (sizePtr)) : \ + tclStubsPtr->tcl_GetBytesFromObj(NULL, objPtr, (Tcl_Size *)(void *)(sizePtr))) #else #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - tclStubsPtr->tclGetByteArrayFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (sizePtr))) + tclStubsPtr->tclGetByteArrayFromObj(objPtr, (sizePtr)) : \ + tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (Tcl_Size *)(void *)(sizePtr))) #endif #else #define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - TclGetBytesFromObj(interp, objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetBytesFromObj)(interp, objPtr, (sizePtr))) + TclGetBytesFromObj(interp, objPtr, (sizePtr)) : \ + (Tcl_GetBytesFromObj)(interp, objPtr, (Tcl_Size *)(void *)(sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), \ (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) @@ -4087,16 +4088,16 @@ extern const TclStubs *tclStubsPtr; Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr))) #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - TclGetStringFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetStringFromObj)(objPtr, (sizePtr))) + TclGetStringFromObj(objPtr, (sizePtr)) : \ + (Tcl_GetStringFromObj)(objPtr, (Tcl_Size *)(void *)(sizePtr))) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - TclGetBytesFromObj(NULL, objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetBytesFromObj)(NULL, objPtr, (sizePtr))) + TclGetBytesFromObj(NULL, objPtr, (sizePtr)) : \ + (Tcl_GetBytesFromObj)(NULL, objPtr, (Tcl_Size *)(void *)(sizePtr))) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? \ - TclGetUnicodeFromObj(objPtr, (int *)(void *)(sizePtr)) : \ - (Tcl_GetUnicodeFromObj)(objPtr, (sizePtr))) + TclGetUnicodeFromObj(objPtr, (sizePtr)) : \ + (Tcl_GetUnicodeFromObj)(objPtr, (Tcl_Size *)(void *)(sizePtr))) #endif #ifdef TCL_MEM_DEBUG @@ -4172,31 +4173,31 @@ extern const TclStubs *tclStubsPtr; # undef Tcl_ListObjGetElements # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \ ? tclStubsPtr->tclListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ - : tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr))) + : tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (Tcl_Size *)(void *)(objcPtr), (objvPtr))) # undef Tcl_ListObjLength # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \ ? tclStubsPtr->tclListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \ - : tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (lengthPtr))) + : tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (Tcl_Size *)(void *)(lengthPtr))) # undef Tcl_DictObjSize # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \ ? tclStubsPtr->tclDictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \ - : tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (sizePtr))) + : tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (Tcl_Size *)(void *)(sizePtr))) # undef Tcl_SplitList # define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? tclStubsPtr->tclSplitList((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \ - : tclStubsPtr->tcl_SplitList((interp), (listStr), (argcPtr), (argvPtr))) + : tclStubsPtr->tcl_SplitList((interp), (listStr), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) # undef Tcl_SplitPath # define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? tclStubsPtr->tclSplitPath((path), (int *)(void *)(argcPtr), (argvPtr)) \ - : tclStubsPtr->tcl_SplitPath((path), (argcPtr), (argvPtr))) + : tclStubsPtr->tcl_SplitPath((path), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) # undef Tcl_FSSplitPath # define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \ ? tclStubsPtr->tclFSSplitPath((pathPtr), (int *)(void *)(lenPtr)) \ - : tclStubsPtr->tcl_FSSplitPath((pathPtr), (lenPtr))) + : tclStubsPtr->tcl_FSSplitPath((pathPtr), (Tcl_Size *)(void *)(lenPtr))) # undef Tcl_ParseArgsObjv # define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \ ? tclStubsPtr->tclParseArgsObjv((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \ - : tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv))) + : tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (Tcl_Size *)(void *)(objcPtr), (objv), (remObjv))) #endif /* TCL_MAJOR_VERSION < 9 || !defined(TCL_NO_DEPRECATED) */ #else # define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \ @@ -4213,26 +4214,26 @@ extern const TclStubs *tclStubsPtr; : (Tcl_Size (*)(wchar_t *))Tcl_Char16Len) #if !defined(BUILD_tcl) && !defined(TCL_NO_DEPRECATED) # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \ - ? TclListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ - : (Tcl_ListObjGetElements)((interp), (listPtr), (objcPtr), (objvPtr))) + ? TclListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr)) \ + : (Tcl_ListObjGetElements)((interp), (listPtr), (Tcl_Size *)(void *)(objcPtr), (objvPtr))) # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \ - ? TclListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \ - : (Tcl_ListObjLength)((interp), (listPtr), (lengthPtr))) + ? TclListObjLength((interp), (listPtr), (lengthPtr)) \ + : (Tcl_ListObjLength)((interp), (listPtr), (Tcl_Size *)(void *)(lengthPtr))) # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \ - ? TclDictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \ - : (Tcl_DictObjSize)((interp), (dictPtr), (sizePtr))) + ? TclDictObjSize((interp), (dictPtr), (sizePtr)) \ + : (Tcl_DictObjSize)((interp), (dictPtr), (Tcl_Size *)(void *)(sizePtr))) # define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ - ? TclSplitList((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \ - : (Tcl_SplitList)((interp), (listStr), (argcPtr), (argvPtr))) + ? TclSplitList((interp), (listStr), (argcPtr), (argvPtr)) \ + : (Tcl_SplitList)((interp), (listStr), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) # define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ - ? TclSplitPath((path), (int *)(void *)(argcPtr), (argvPtr)) \ - : (Tcl_SplitPath)((path), (argcPtr), (argvPtr))) + ? TclSplitPath((path), (argcPtr), (argvPtr)) \ + : (Tcl_SplitPath)((path), (Tcl_Size *)(void *)(argcPtr), (argvPtr))) # define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \ - ? TclFSSplitPath((pathPtr), (int *)(void *)(lenPtr)) \ - : (Tcl_FSSplitPath)((pathPtr), (lenPtr))) + ? TclFSSplitPath((pathPtr), (lenPtr)) \ + : (Tcl_FSSplitPath)((pathPtr), (Tcl_Size *)(void *)(lenPtr))) # define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \ - ? TclParseArgsObjv((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \ - : (Tcl_ParseArgsObjv)((interp), (argTable), (objcPtr), (objv), (remObjv))) + ? TclParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv)) \ + : (Tcl_ParseArgsObjv)((interp), (argTable), (Tcl_Size *)(void *)(objcPtr), (objv), (remObjv))) #endif /* !defined(BUILD_tcl) */ #endif diff --git a/generic/tclObj.c b/generic/tclObj.c index 9d27fca..0c9c405 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1670,7 +1670,7 @@ char * TclGetStringFromObj( Tcl_Obj *objPtr, /* Object whose string rep byte pointer should * be returned. */ - int *lengthPtr) /* If non-NULL, the location where the string + void *lengthPtr) /* If non-NULL, the location where the string * rep's byte array length should * be stored. * If NULL, no length is stored. */ { @@ -1704,7 +1704,7 @@ TclGetStringFromObj( Tcl_Panic("Tcl_GetStringFromObj with 'int' lengthPtr" " cannot handle such long strings. Please use 'Tcl_Size'"); } - *lengthPtr = (int)objPtr->length; + *(int *)lengthPtr = (int)objPtr->length; } return objPtr->bytes; } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index fb7294b..22a686f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -685,7 +685,7 @@ Tcl_UniChar * TclGetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the Unicode string * for. */ - int *lengthPtr) /* If non-NULL, the location where the string + void *lengthPtr) /* If non-NULL, the location where the string * rep's Tcl_UniChar length should be stored. If * NULL, no length is stored. */ { @@ -704,7 +704,7 @@ TclGetUnicodeFromObj( Tcl_Panic("Tcl_GetUnicodeFromObj with 'int' lengthPtr" " cannot handle such long strings. Please use 'Tcl_Size'"); } - *lengthPtr = (int)stringPtr->numChars; + *(int *)lengthPtr = (int)stringPtr->numChars; } return stringPtr->unicode; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index b28f190..92632e8 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -123,7 +123,7 @@ static void uniCodePanic() { # define TclParseArgsObjv 0 #else /* !defined(TCL_NO_DEPRECATED) */ int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, - int *objcPtr, Tcl_Obj ***objvPtr) { + void *objcPtr, Tcl_Obj ***objvPtr) { Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_ListObjGetElements(interp, listPtr, &n, objvPtr); if (objcPtr) { @@ -133,12 +133,12 @@ int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, } return TCL_ERROR; } - *objcPtr = n; + *(int *)objcPtr = (int)n; } return result; } int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, - int *lengthPtr) { + void *lengthPtr) { Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_ListObjLength(interp, listPtr, &n); if (lengthPtr) { @@ -148,12 +148,12 @@ int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, } return TCL_ERROR; } - *lengthPtr = n; + *(int *)lengthPtr = (int)n; } return result; } int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, - int *sizePtr) { + void *sizePtr) { Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_DictObjSize(interp, dictPtr, &n); if (sizePtr) { @@ -163,11 +163,11 @@ int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, } return TCL_ERROR; } - *sizePtr = n; + *(int *)sizePtr = (int)n; } return result; } -int TclSplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, +int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr) { Tcl_Size n = TCL_INDEX_NONE; int result = Tcl_SplitList(interp, listStr, &n, argvPtr); @@ -179,11 +179,11 @@ int TclSplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, Tcl_Free((void *)*argvPtr); return TCL_ERROR; } - *argcPtr = n; + *(int *)argcPtr = (int)n; } return result; } -void TclSplitPath(const char *path, int *argcPtr, const char ***argvPtr) { +void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr) { Tcl_Size n = TCL_INDEX_NONE; Tcl_SplitPath(path, &n, argvPtr); if (argcPtr) { @@ -192,10 +192,10 @@ void TclSplitPath(const char *path, int *argcPtr, const char ***argvPtr) { Tcl_Free((void *)*argvPtr); *argvPtr = NULL; } - *argcPtr = n; + *(int *)argcPtr = (int)n; } } -Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, int *lenPtr) { +Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr) { Tcl_Size n = TCL_INDEX_NONE; Tcl_Obj *result = Tcl_FSSplitPath(pathPtr, &n); if (lenPtr) { @@ -203,16 +203,16 @@ Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, int *lenPtr) { Tcl_DecrRefCount(result); return NULL; } - *lenPtr = n; + *(int *)lenPtr = (int)n; } return result; } int TclParseArgsObjv(Tcl_Interp *interp, - const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, + const Tcl_ArgvInfo *argTable, void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) { - Tcl_Size n = (*objcPtr < 0) ? TCL_INDEX_NONE: *objcPtr ; + Tcl_Size n = (*(int *)objcPtr < 0) ? TCL_INDEX_NONE: (Tcl_Size)*(int *)objcPtr ; int result = Tcl_ParseArgsObjv(interp, argTable, &n, objv, remObjv); - *objcPtr = (int)n; + *(int *)objcPtr = (int)n; return result; } #endif /* !defined(TCL_NO_DEPRECATED) */ -- cgit v0.12 From 54b8f460977c12181e89d16fd8e35e45a5ebf878 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Apr 2023 20:24:01 +0000 Subject: RingSizeT -> Tcl_Size --- win/tclWinConsole.c | 77 ++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 1a10324..47aba5d 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -84,18 +84,11 @@ static int gInitialized = 0; * Ring buffer for storing data. Actual data is from bufPtr[start]:bufPtr[size-1] * and bufPtr[0]:bufPtr[length - (size-start)]. */ -#if TCL_MAJOR_VERSION > 8 -typedef ptrdiff_t RingSizeT; /* Tcl9 TODO */ -#define RingSizeT_MAX PTRDIFF_MAX -#else -typedef int RingSizeT; -#define RingSizeT_MAX INT_MAX -#endif typedef struct RingBuffer { char *bufPtr; /* Pointer to buffer storage */ - RingSizeT capacity; /* Size of the buffer in RingBufferChar */ - RingSizeT start; /* Start of the data within the buffer. */ - RingSizeT length; /* Number of RingBufferChar*/ + Tcl_Size capacity; /* Size of the buffer in RingBufferChar */ + Tcl_Size start; /* Start of the data within the buffer. */ + Tcl_Size length; /* Number of RingBufferChar*/ } RingBuffer; #define RingBufferLength(ringPtr_) ((ringPtr_)->length) #define RingBufferHasFreeSpace(ringPtr_) ((ringPtr_)->length < (ringPtr_)->capacity) @@ -234,16 +227,16 @@ static void ConsoleWatchProc(ClientData instanceData, int mask); static void ProcExitHandler(ClientData clientData); static void ConsoleThreadActionProc(ClientData instanceData, int action); static DWORD ReadConsoleChars(HANDLE hConsole, WCHAR *lpBuffer, - RingSizeT nChars, RingSizeT *nCharsReadPtr); + Tcl_Size nChars, Tcl_Size *nCharsReadPtr); static DWORD WriteConsoleChars(HANDLE hConsole, - const WCHAR *lpBuffer, RingSizeT nChars, - RingSizeT *nCharsWritten); -static void RingBufferInit(RingBuffer *ringPtr, RingSizeT capacity); + const WCHAR *lpBuffer, Tcl_Size nChars, + Tcl_Size *nCharsWritten); +static void RingBufferInit(RingBuffer *ringPtr, Tcl_Size capacity); static void RingBufferClear(RingBuffer *ringPtr); -static RingSizeT RingBufferIn(RingBuffer *ringPtr, const char *srcPtr, - RingSizeT srcLen, int partialCopyOk); -static RingSizeT RingBufferOut(RingBuffer *ringPtr, char *dstPtr, - RingSizeT dstCapacity, int partialCopyOk); +static Tcl_Size RingBufferIn(RingBuffer *ringPtr, const char *srcPtr, + Tcl_Size srcLen, int partialCopyOk); +static Tcl_Size RingBufferOut(RingBuffer *ringPtr, char *dstPtr, + Tcl_Size dstCapacity, int partialCopyOk); static ConsoleHandleInfo *AllocateConsoleHandleInfo(HANDLE consoleHandle, int permissions); static ConsoleHandleInfo *FindConsoleInfo(const ConsoleChannelInfo *); @@ -331,9 +324,9 @@ static const Tcl_ChannelType consoleChannelType = { *------------------------------------------------------------------------ */ static void -RingBufferInit(RingBuffer *ringPtr, RingSizeT capacity) +RingBufferInit(RingBuffer *ringPtr, Tcl_Size capacity) { - if (capacity <= 0 || capacity > RingSizeT_MAX) { + if (capacity <= 0 || capacity > TCL_SIZE_MAX) { Tcl_Panic("Internal error: invalid ring buffer capacity requested."); } ringPtr->bufPtr = (char *)ckalloc(capacity); @@ -384,15 +377,15 @@ RingBufferClear(RingBuffer *ringPtr) * *------------------------------------------------------------------------ */ -static RingSizeT +static Tcl_Size RingBufferIn( RingBuffer *ringPtr, const char *srcPtr, /* Source to be copied */ - RingSizeT srcLen, /* Length of source */ + Tcl_Size srcLen, /* Length of source */ int partialCopyOk /* If true, partial copy is permitted */ ) { - RingSizeT freeSpace; + Tcl_Size freeSpace; RINGBUFFER_ASSERT(ringPtr); @@ -407,8 +400,8 @@ RingBufferIn( if (ringPtr->capacity - ringPtr->start > ringPtr->length) { /* There is room at the back */ - RingSizeT endSpaceStart = ringPtr->start + ringPtr->length; - RingSizeT endSpace = ringPtr->capacity - endSpaceStart; + Tcl_Size endSpaceStart = ringPtr->start + ringPtr->length; + Tcl_Size endSpace = ringPtr->capacity - endSpaceStart; if (endSpace >= srcLen) { /* Everything fits at the back */ memmove(endSpaceStart + ringPtr->bufPtr, srcPtr, srcLen); @@ -419,7 +412,7 @@ RingBufferIn( } } else { /* No room at the back. Existing data wrap to front. */ - RingSizeT wrapLen = + Tcl_Size wrapLen = ringPtr->start + ringPtr->length - ringPtr->capacity; memmove(wrapLen + ringPtr->bufPtr, srcPtr, srcLen); } @@ -447,13 +440,13 @@ RingBufferIn( * *------------------------------------------------------------------------ */ -static RingSizeT +static Tcl_Size RingBufferOut(RingBuffer *ringPtr, char *dstPtr, /* Buffer for output data. May be NULL */ - RingSizeT dstCapacity, /* Size of buffer */ + Tcl_Size dstCapacity, /* Size of buffer */ int partialCopyOk) /* If true, return what's available */ { - RingSizeT leadLen; + Tcl_Size leadLen; RINGBUFFER_ASSERT(ringPtr); @@ -477,7 +470,7 @@ RingBufferOut(RingBuffer *ringPtr, } ringPtr->start += dstCapacity; } else { - RingSizeT wrapLen = dstCapacity - leadLen; + Tcl_Size wrapLen = dstCapacity - leadLen; if (dstPtr) { memmove(dstPtr, ringPtr->start + ringPtr->bufPtr, @@ -529,8 +522,8 @@ static DWORD ReadConsoleChars( HANDLE hConsole, WCHAR *lpBuffer, - RingSizeT nChars, - RingSizeT *nCharsReadPtr) + Tcl_Size nChars, + Tcl_Size *nCharsReadPtr) { DWORD nRead; BOOL result; @@ -589,8 +582,8 @@ static DWORD WriteConsoleChars( HANDLE hConsole, const WCHAR *lpBuffer, - RingSizeT nChars, - RingSizeT *nCharsWrittenPtr) + Tcl_Size nChars, + Tcl_Size *nCharsWrittenPtr) { DWORD nCharsWritten; BOOL result; @@ -1090,7 +1083,7 @@ ConsoleInputProc( { ConsoleChannelInfo *chanInfoPtr = (ConsoleChannelInfo *)instanceData; ConsoleHandleInfo *handleInfoPtr; - RingSizeT numRead; + Tcl_Size numRead; if (chanInfoPtr->handle == INVALID_HANDLE_VALUE) { return 0; /* EOF */ @@ -1160,7 +1153,7 @@ ConsoleInputProc( && bufSize > 1 /* Not single byte read */ ) { DWORD lastError; - RingSizeT numChars; + Tcl_Size numChars; ReleaseSRWLockExclusive(&handleInfoPtr->lock); lastError = ReadConsoleChars(chanInfoPtr->handle, (WCHAR *)bufPtr, @@ -1242,7 +1235,7 @@ ConsoleOutputProc( { ConsoleChannelInfo *chanInfoPtr = (ConsoleChannelInfo *)instanceData; ConsoleHandleInfo *handleInfoPtr; - RingSizeT numWritten; + Tcl_Size numWritten; *errorCode = 0; @@ -1638,8 +1631,8 @@ ConsoleReaderThread( ConsoleHandleInfo *handleInfoPtr = (ConsoleHandleInfo *) arg; ConsoleHandleInfo **iterator; char inputChars[200]; /* Temporary buffer */ - RingSizeT inputLen = 0; - RingSizeT inputOffset = 0; + Tcl_Size inputLen = 0; + Tcl_Size inputOffset = 0; /* * Keep looping until one of the following happens. @@ -1670,7 +1663,7 @@ ConsoleReaderThread( HANDLE consoleHandle; if (inputLen > 0) { /* Private buffer has data. Copy it over. */ - RingSizeT nStored; + Tcl_Size nStored; assert((inputLen - inputOffset) > 0); @@ -1833,7 +1826,7 @@ ConsoleWriterThread(LPVOID arg) ConsoleHandleInfo *handleInfoPtr = (ConsoleHandleInfo *) arg; ConsoleHandleInfo **iterator; BOOL success; - RingSizeT numBytes; + Tcl_Size numBytes; /* * This buffer size has no relation really with the size of the shared * buffer. Could be bigger or smaller. Make larger as multiple threads @@ -1904,7 +1897,7 @@ ConsoleWriterThread(LPVOID arg) ReleaseSRWLockExclusive(&handleInfoPtr->lock); offset = 0; while (numBytes > 0) { - RingSizeT numWChars = numBytes / sizeof(WCHAR); + Tcl_Size numWChars = numBytes / sizeof(WCHAR); DWORD status; status = WriteConsoleChars(handleInfoPtr->console, (WCHAR *)(offset + buffer), -- cgit v0.12 From 8bfaaa8337b18264aac9bcc0f66a70bcc9f2c68d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 27 Apr 2023 13:52:42 +0000 Subject: Simplify Tcl 9 compatibility macro's. No change in functionality. --- generic/tcl.decls | 22 ++++++------ generic/tclBinary.c | 16 ++++----- generic/tclDecls.h | 92 ++++++++++++++++++++++++-------------------------- generic/tclObj.c | 4 +-- generic/tclStringObj.c | 4 +-- generic/tclStubInit.c | 32 +++++++++--------- 6 files changed, 84 insertions(+), 86 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index daa2f2b..2e5d7b4 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2413,19 +2413,19 @@ declare 649 { } declare 650 { unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - ptrdiff_t *numBytesPtr) + void *numBytesPtr) } # TIP #481 declare 651 { - char *TclGetStringFromObj(Tcl_Obj *objPtr, ptrdiff_t *lengthPtr) + char *TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr) } declare 652 { - unsigned short *TclGetUnicodeFromObj(Tcl_Obj *objPtr, ptrdiff_t *lengthPtr) + unsigned short *TclGetUnicodeFromObj(Tcl_Obj *objPtr, void *lengthPtr) } # Only available in Tcl 8.x, NULL in Tcl 9.0 declare 653 { - unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, ptrdiff_t *numBytesPtr) + unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, void *numBytesPtr) } # TIP #575 @@ -2462,28 +2462,28 @@ declare 660 { # TIP #616 declare 661 { int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, - ptrdiff_t *objcPtr, Tcl_Obj ***objvPtr) + void *objcPtr, Tcl_Obj ***objvPtr) } declare 662 { int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, - ptrdiff_t *lengthPtr) + void *lengthPtr) } declare 663 { - int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, ptrdiff_t *sizePtr) + int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr) } declare 664 { - int TclSplitList(Tcl_Interp *interp, const char *listStr, ptrdiff_t *argcPtr, + int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr) } declare 665 { - void TclSplitPath(const char *path, ptrdiff_t *argcPtr, const char ***argvPtr) + void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr) } declare 666 { - Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, ptrdiff_t *lenPtr) + Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr) } declare 667 { int TclParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, - ptrdiff_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) + void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) } # TIP #617 diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 710ed0b..183d545 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 value internal representation for binary data. + * command and the Tcl binary data object. * * Copyright © 1997 Sun Microsystems, Inc. * Copyright © 1998-1999 Scriptics Corporation. @@ -64,7 +64,7 @@ static int FormatNumber(Tcl_Interp *interp, int type, static void FreeByteArrayInternalRep(Tcl_Obj *objPtr); static void FreeProperByteArrayInternalRep(Tcl_Obj *objPtr); static int GetFormatSpec(const char **formatPtr, char *cmdPtr, - int *countPtr, int *flagsPtr); + Tcl_Size *countPtr, int *flagsPtr); static Tcl_Obj * ScanNumber(unsigned char *buffer, int type, int flags, Tcl_HashTable **numberCachePtr); static int SetByteArrayFromAny(Tcl_Interp *interp, @@ -143,7 +143,7 @@ static const EnsembleImplMap decodeMap[] = { }; /* - * The following object types represent an array of bytes. The intent is to + * The following Tcl_ObjType represents an array of bytes. The intent is to * allow arbitrary binary data to pass through Tcl as a Tcl value without loss * or damage. Such values are useful for things like encoded strings or Tk * images to name just two. @@ -457,7 +457,7 @@ unsigned char * Tcl_GetBytesFromObj( Tcl_Interp *interp, /* For error reporting */ Tcl_Obj *objPtr, /* Value to extract from */ - ptrdiff_t *numBytesPtr) /* If non-NULL, write the number of bytes + void *numBytesPtr) /* If non-NULL, write the number of bytes * in the array here */ { ByteArray *baPtr; @@ -487,7 +487,7 @@ Tcl_GetBytesFromObj( baPtr = GET_BYTEARRAY(irPtr); if (numBytesPtr != NULL) { - *numBytesPtr = baPtr->used; + *(ptrdiff_t *)numBytesPtr = baPtr->used; } return baPtr->bytes; } @@ -539,7 +539,7 @@ Tcl_GetByteArrayFromObj( unsigned char * TclGetByteArrayFromObj( Tcl_Obj *objPtr, /* The ByteArray object. */ - ptrdiff_t *numBytesPtr) /* If non-NULL, write the number of bytes + void *numBytesPtr) /* If non-NULL, write the number of bytes * in the array here */ { ByteArray *baPtr; @@ -556,8 +556,8 @@ TclGetByteArrayFromObj( baPtr = GET_BYTEARRAY(irPtr); if (numBytesPtr != NULL) { - /* Make sure we return a value between 0 and UINT_MAX-1, or (size_t)-1 */ - *numBytesPtr = ((ptrdiff_t)(unsigned int)(baPtr->used + 1)) - 1; + /* Make sure we return a value between 0 and UINT_MAX-1, or (ptrdiff_t)-1 */ + *(ptrdiff_t *)numBytesPtr = ((ptrdiff_t)(unsigned int)(baPtr->used + 1)) - 1; } return baPtr->bytes; } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d4e4381..9602e07 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1936,16 +1936,15 @@ EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 650 */ EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, ptrdiff_t *numBytesPtr); + Tcl_Obj *objPtr, void *numBytesPtr); /* 651 */ -EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, - ptrdiff_t *lengthPtr); +EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr, void *lengthPtr); /* 652 */ EXTERN unsigned short * TclGetUnicodeFromObj(Tcl_Obj *objPtr, - ptrdiff_t *lengthPtr); + void *lengthPtr); /* 653 */ EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr, - ptrdiff_t *numBytesPtr); + void *numBytesPtr); /* 654 */ EXTERN int Tcl_UtfCharComplete(const char *src, Tcl_Size length); /* 655 */ @@ -1971,27 +1970,26 @@ EXTERN int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async, int sigNumber); /* 661 */ EXTERN int TclListObjGetElements(Tcl_Interp *interp, - Tcl_Obj *listPtr, ptrdiff_t *objcPtr, + Tcl_Obj *listPtr, void *objcPtr, Tcl_Obj ***objvPtr); /* 662 */ EXTERN int TclListObjLength(Tcl_Interp *interp, - Tcl_Obj *listPtr, ptrdiff_t *lengthPtr); + Tcl_Obj *listPtr, void *lengthPtr); /* 663 */ EXTERN int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, - ptrdiff_t *sizePtr); + void *sizePtr); /* 664 */ EXTERN int TclSplitList(Tcl_Interp *interp, const char *listStr, - ptrdiff_t *argcPtr, const char ***argvPtr); + void *argcPtr, const char ***argvPtr); /* 665 */ -EXTERN void TclSplitPath(const char *path, ptrdiff_t *argcPtr, +EXTERN void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr); /* 666 */ -EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, ptrdiff_t *lenPtr); +EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr); /* 667 */ EXTERN int TclParseArgsObjv(Tcl_Interp *interp, - const Tcl_ArgvInfo *argTable, - ptrdiff_t *objcPtr, Tcl_Obj *const *objv, - Tcl_Obj ***remObjv); + const Tcl_ArgvInfo *argTable, void *objcPtr, + Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 668 */ EXTERN Tcl_Size Tcl_UniCharLen(const int *uniStr); /* 669 */ @@ -2738,10 +2736,10 @@ typedef struct TclStubs { char * (*tcl_UniCharToUtfDString) (const int *uniStr, Tcl_Size uniLength, Tcl_DString *dsPtr); /* 647 */ int * (*tcl_UtfToUniCharDString) (const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 648 */ unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */ - unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, ptrdiff_t *numBytesPtr); /* 650 */ - char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, ptrdiff_t *lengthPtr); /* 651 */ - unsigned short * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, ptrdiff_t *lengthPtr); /* 652 */ - unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, ptrdiff_t *numBytesPtr); /* 653 */ + unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, void *numBytesPtr); /* 650 */ + char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 651 */ + unsigned short * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, void *lengthPtr); /* 652 */ + unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, void *numBytesPtr); /* 653 */ int (*tcl_UtfCharComplete) (const char *src, Tcl_Size length); /* 654 */ const char * (*tcl_UtfNext) (const char *src); /* 655 */ const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */ @@ -2749,13 +2747,13 @@ typedef struct TclStubs { int (*tcl_ExternalToUtfDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 658 */ int (*tcl_UtfToExternalDStringEx) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, Tcl_Size srcLen, int flags, Tcl_DString *dsPtr, Tcl_Size *errorLocationPtr); /* 659 */ int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */ - int (*tclListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, ptrdiff_t *objcPtr, Tcl_Obj ***objvPtr); /* 661 */ - int (*tclListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, ptrdiff_t *lengthPtr); /* 662 */ - int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, ptrdiff_t *sizePtr); /* 663 */ - int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, ptrdiff_t *argcPtr, const char ***argvPtr); /* 664 */ - void (*tclSplitPath) (const char *path, ptrdiff_t *argcPtr, const char ***argvPtr); /* 665 */ - Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, ptrdiff_t *lenPtr); /* 666 */ - int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, ptrdiff_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */ + int (*tclListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, void *objcPtr, Tcl_Obj ***objvPtr); /* 661 */ + int (*tclListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, void *lengthPtr); /* 662 */ + int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, void *sizePtr); /* 663 */ + int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr); /* 664 */ + void (*tclSplitPath) (const char *path, void *argcPtr, const char ***argvPtr); /* 665 */ + Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, void *lenPtr); /* 666 */ + int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */ Tcl_Size (*tcl_UniCharLen) (const int *uniStr); /* 668 */ Tcl_Size (*tclNumUtfChars) (const char *src, Tcl_Size length); /* 669 */ Tcl_Size (*tclGetCharLength) (Tcl_Obj *objPtr); /* 670 */ @@ -4394,7 +4392,7 @@ extern const TclStubs *tclStubsPtr; #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, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)(sizePtr)) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) #define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) \ @@ -4405,15 +4403,15 @@ extern const TclStubs *tclStubsPtr; Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr))) #ifdef TCL_NO_DEPRECATED #define Tcl_GetStringFromObj(objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetStringFromObj(objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetStringFromObj(objPtr, (sizePtr))) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetByteArrayFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetByteArrayFromObj(objPtr, (sizePtr))) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (sizePtr))) #endif #else #define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)(sizePtr)) : (Tcl_GetBytesFromObj)(interp, objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)(sizePtr)) : (Tcl_GetBytesFromObj)(interp, objPtr, (sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) #define Tcl_GetBooleanFromObj(interp, objPtr, boolPtr) \ @@ -4424,11 +4422,11 @@ extern const TclStubs *tclStubsPtr; Tcl_GetBool(interp, src, (TCL_NULL_OK-2)&(int)sizeof((*(boolPtr))), (char *)(boolPtr))) #ifdef TCL_NO_DEPRECATED #define Tcl_GetStringFromObj(objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)(sizePtr)) : (TclGetStringFromObj)(objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)(sizePtr)) : (TclGetStringFromObj)(objPtr, (sizePtr))) #define Tcl_GetByteArrayFromObj(objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)(sizePtr)) : TclGetByteArrayFromObj(objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetByteArrayFromObj)(objPtr, (int *)(sizePtr)) : TclGetByteArrayFromObj(objPtr, (sizePtr))) #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ - (sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetUnicodeFromObj)(objPtr, (int *)(sizePtr)) : TclGetUnicodeFromObj(objPtr, (ptrdiff_t *)(sizePtr))) + (sizeof(*(sizePtr)) <= sizeof(int) ? (Tcl_GetUnicodeFromObj)(objPtr, (int *)(sizePtr)) : TclGetUnicodeFromObj(objPtr, (sizePtr))) #endif #endif @@ -4485,31 +4483,31 @@ extern const TclStubs *tclStubsPtr; # undef Tcl_ListObjGetElements # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \ ? tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ - : tclStubsPtr->tclListObjGetElements((interp), (listPtr), (ptrdiff_t *)(void *)(objcPtr), (objvPtr))) + : tclStubsPtr->tclListObjGetElements((interp), (listPtr), (void *)(objcPtr), (objvPtr))) # undef Tcl_ListObjLength # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \ ? tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (int *)(void *)(lengthPtr)) \ - : tclStubsPtr->tclListObjLength((interp), (listPtr), (ptrdiff_t *)(void *)(lengthPtr))) + : tclStubsPtr->tclListObjLength((interp), (listPtr), (void *)(lengthPtr))) # undef Tcl_DictObjSize # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \ ? tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (int *)(void *)(sizePtr)) \ - : tclStubsPtr->tclDictObjSize((interp), (dictPtr), (ptrdiff_t *)(void *)(sizePtr))) + : tclStubsPtr->tclDictObjSize((interp), (dictPtr), (void *)(sizePtr))) # undef Tcl_SplitList # define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? tclStubsPtr->tcl_SplitList((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \ - : tclStubsPtr->tclSplitList((interp), (listStr), (ptrdiff_t *)(void *)(argcPtr), (argvPtr))) + : tclStubsPtr->tclSplitList((interp), (listStr), (void *)(argcPtr), (argvPtr))) # undef Tcl_SplitPath # define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? tclStubsPtr->tcl_SplitPath((path), (int *)(void *)(argcPtr), (argvPtr)) \ - : tclStubsPtr->tclSplitPath((path), (ptrdiff_t *)(void *)(argcPtr), (argvPtr))) + : tclStubsPtr->tclSplitPath((path), (void *)(argcPtr), (argvPtr))) # undef Tcl_FSSplitPath # define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \ ? tclStubsPtr->tcl_FSSplitPath((pathPtr), (int *)(void *)(lenPtr)) \ - : tclStubsPtr->tclFSSplitPath((pathPtr), (ptrdiff_t *)(void *)(lenPtr))) + : tclStubsPtr->tclFSSplitPath((pathPtr), (void *)(lenPtr))) # undef Tcl_ParseArgsObjv # define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \ ? tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \ - : tclStubsPtr->tclParseArgsObjv((interp), (argTable), (ptrdiff_t *)(void *)(objcPtr), (objv), (remObjv))) + : tclStubsPtr->tclParseArgsObjv((interp), (argTable), (void *)(objcPtr), (objv), (remObjv))) #endif /* TCL_NO_DEPRECATED */ #else # define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \ @@ -4527,25 +4525,25 @@ extern const TclStubs *tclStubsPtr; #ifdef TCL_NO_DEPRECATED # define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*(objcPtr)) == sizeof(int) \ ? (Tcl_ListObjGetElements)((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr)) \ - : TclListObjGetElements((interp), (listPtr), (ptrdiff_t *)(void *)(objcPtr), (objvPtr))) + : TclListObjGetElements((interp), (listPtr), (objcPtr), (objvPtr))) # define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*(lengthPtr)) == sizeof(int) \ ? (Tcl_ListObjLength)((interp), (listPtr), (int *)(void *)(lengthPtr)) \ - : TclListObjLength((interp), (listPtr), (ptrdiff_t *)(void *)(lengthPtr))) + : TclListObjLength((interp), (listPtr), (lengthPtr))) # define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*(sizePtr)) == sizeof(int) \ ? (Tcl_DictObjSize)((interp), (dictPtr), (int *)(void *)(sizePtr)) \ - : TclDictObjSize((interp), (dictPtr), (ptrdiff_t *)(void *)(sizePtr))) + : TclDictObjSize((interp), (dictPtr), (sizePtr))) # define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? (Tcl_SplitList)((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr)) \ - : TclSplitList((interp), (listStr), (ptrdiff_t *)(void *)(argcPtr), (argvPtr))) + : TclSplitList((interp), (listStr), (argcPtr), (argvPtr))) # define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*(argcPtr)) == sizeof(int) \ ? (Tcl_SplitPath)((path), (int *)(void *)(argcPtr), (argvPtr)) \ - : TclSplitPath((path), (ptrdiff_t *)(void *)(argcPtr), (argvPtr))) + : TclSplitPath((path), (argcPtr), (argvPtr))) # define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*(lenPtr)) == sizeof(int) \ ? (Tcl_FSSplitPath)((pathPtr), (int *)(void *)(lenPtr)) \ - : TclFSSplitPath((pathPtr), (ptrdiff_t *)(void *)(lenPtr))) + : TclFSSplitPath((pathPtr), (lenPtr))) # define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*(objcPtr)) == sizeof(int) \ ? (Tcl_ParseArgsObjv)((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv)) \ - : TclParseArgsObjv((interp), (argTable), (ptrdiff_t *)(void *)(objcPtr), (objv), (remObjv))) + : TclParseArgsObjv((interp), (argTable), (objcPtr), (objv), (remObjv))) #endif /* TCL_NO_DEPRECATED */ #endif diff --git a/generic/tclObj.c b/generic/tclObj.c index 7c433d1..933138c 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1726,7 +1726,7 @@ char * TclGetStringFromObj( Tcl_Obj *objPtr, /* Object whose string rep byte pointer should * be returned. */ - ptrdiff_t *lengthPtr) /* If non-NULL, the location where the string + void *lengthPtr) /* If non-NULL, the location where the string * rep's byte array length should * be stored. * If NULL, no length is stored. */ { @@ -1756,7 +1756,7 @@ TclGetStringFromObj( } } if (lengthPtr != NULL) { - *lengthPtr = ((ptrdiff_t)(unsigned)(objPtr->length + 1)) - 1; + *(ptrdiff_t *)lengthPtr = ((ptrdiff_t)(unsigned)(objPtr->length + 1)) - 1; } return objPtr->bytes; } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 010d822..d3a17d1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -988,7 +988,7 @@ unsigned short * TclGetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the unicode string * for. */ - ptrdiff_t *lengthPtr) /* If non-NULL, the location where the string + void *lengthPtr) /* If non-NULL, the location where the string * rep's unichar length should be stored. If * NULL, no length is stored. */ { @@ -1002,7 +1002,7 @@ TclGetUnicodeFromObj( stringPtr = GET_STRING(objPtr); if (lengthPtr != NULL) { - *lengthPtr = stringPtr->numChars; + *(ptrdiff_t *)lengthPtr = stringPtr->numChars; } return stringPtr->unicode; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index e09d74d..e2d52b9 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -138,67 +138,67 @@ static const char *TclUtfPrev(const char *src, const char *start) { } int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, - ptrdiff_t *objcPtr, Tcl_Obj ***objvPtr) { + void *objcPtr, Tcl_Obj ***objvPtr) { int n, result = Tcl_ListObjGetElements(interp, listPtr, &n, objvPtr); if ((result == TCL_OK) && objcPtr) { - *objcPtr = n; + *(ptrdiff_t *)objcPtr = n; } return result; } int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, - ptrdiff_t *lengthPtr) { + void *lengthPtr) { int n; int result = Tcl_ListObjLength(interp, listPtr, &n); if ((result == TCL_OK) && lengthPtr) { - *lengthPtr = n; + *(ptrdiff_t *)lengthPtr = n; } return result; } int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, - ptrdiff_t *sizePtr) { + void *sizePtr) { int n, result = Tcl_DictObjSize(interp, dictPtr, &n); if ((result == TCL_OK) && sizePtr) { - *sizePtr = n; + *(ptrdiff_t *)sizePtr = n; } return result; } -int TclSplitList(Tcl_Interp *interp, const char *listStr, ptrdiff_t *argcPtr, +int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr, const char ***argvPtr) { int n; int result = Tcl_SplitList(interp, listStr, &n, argvPtr); if ((result == TCL_OK) && argcPtr) { - *argcPtr = n; + *(ptrdiff_t *)argcPtr = n; } return result; } -void TclSplitPath(const char *path, ptrdiff_t *argcPtr, const char ***argvPtr) { +void TclSplitPath(const char *path, void *argcPtr, const char ***argvPtr) { int n; Tcl_SplitPath(path, &n, argvPtr); if (argcPtr) { - *argcPtr = n; + *(ptrdiff_t *)argcPtr = n; } } -Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, ptrdiff_t *lenPtr) { +Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, void *lenPtr) { int n; Tcl_Obj *result = Tcl_FSSplitPath(pathPtr, &n); if (result && lenPtr) { - *lenPtr = n; + *(ptrdiff_t *)lenPtr = n; } return result; } int TclParseArgsObjv(Tcl_Interp *interp, - const Tcl_ArgvInfo *argTable, ptrdiff_t *objcPtr, Tcl_Obj *const *objv, + const Tcl_ArgvInfo *argTable, void *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) { int n, result; - if (*objcPtr > INT_MAX) { + if (*(ptrdiff_t *)objcPtr > INT_MAX) { if (interp) { Tcl_AppendResult(interp, "Tcl_ParseArgsObjv cannot handle *objcPtr > INT_MAX", NULL); } return TCL_ERROR; } - n = (int)*objcPtr; + n = *(ptrdiff_t *)objcPtr; result = Tcl_ParseArgsObjv(interp, argTable, &n, objv, remObjv); - *objcPtr = n; + *(ptrdiff_t *)objcPtr = n; return result; } -- cgit v0.12