diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-04-27 13:52:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-04-27 13:52:42 (GMT) |
commit | 8bfaaa8337b18264aac9bcc0f66a70bcc9f2c68d (patch) | |
tree | e67b17ab9f154fa50507049ca47d3ab1b503f880 | |
parent | 54b8f460977c12181e89d16fd8e35e45a5ebf878 (diff) | |
download | tcl-8bfaaa8337b18264aac9bcc0f66a70bcc9f2c68d.zip tcl-8bfaaa8337b18264aac9bcc0f66a70bcc9f2c68d.tar.gz tcl-8bfaaa8337b18264aac9bcc0f66a70bcc9f2c68d.tar.bz2 |
Simplify Tcl 9 compatibility macro's. No change in functionality.
-rw-r--r-- | generic/tcl.decls | 22 | ||||
-rw-r--r-- | generic/tclBinary.c | 16 | ||||
-rw-r--r-- | generic/tclDecls.h | 92 | ||||
-rw-r--r-- | generic/tclObj.c | 4 | ||||
-rw-r--r-- | generic/tclStringObj.c | 4 | ||||
-rw-r--r-- | 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; } |