diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-04-18 19:42:02 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-04-18 19:42:02 (GMT) |
commit | 49cfc0317e60291c8ed8e25b07d725058ec72bb2 (patch) | |
tree | d4f1dd446e58fa1b7172feac092b80cf3ce6e801 /generic/tclObj.c | |
parent | db8e59ed80acf95cad3f0d0da9e36f46ae2de2d7 (diff) | |
download | tcl-49cfc0317e60291c8ed8e25b07d725058ec72bb2.zip tcl-49cfc0317e60291c8ed8e25b07d725058ec72bb2.tar.gz tcl-49cfc0317e60291c8ed8e25b07d725058ec72bb2.tar.bz2 |
Adapt TIP's #494/#481/#537/#544/#568/#616/#623/#627/#630 to TIP #660 changes
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index fae401d..e60042c 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1721,7 +1721,7 @@ char * TclGetStringFromObj( Tcl_Obj *objPtr, /* Object whose string rep byte pointer should * be returned. */ - size_t *lengthPtr) /* If non-NULL, the location where the string + ptrdiff_t *lengthPtr) /* If non-NULL, the location where the string * rep's byte array length should * be stored. * If NULL, no length is stored. */ { @@ -1751,11 +1751,7 @@ TclGetStringFromObj( } } if (lengthPtr != NULL) { -#if TCL_MAJOR_VERSION > 8 - *lengthPtr = objPtr->length; -#else - *lengthPtr = ((size_t)(unsigned)(objPtr->length + 1)) - 1; -#endif + *lengthPtr = ((ptrdiff_t)(unsigned)(objPtr->length + 1)) - 1; } return objPtr->bytes; } @@ -4041,7 +4037,7 @@ int Tcl_GetNumber( Tcl_Interp *interp, const char *bytes, - size_t numBytes, + ptrdiff_t numBytes, void **clientDataPtr, int *typePtr) { @@ -4055,10 +4051,10 @@ Tcl_GetNumber( bytes = &tclEmptyString; numBytes = 0; } - if (numBytes == (size_t)TCL_INDEX_NONE) { - numBytes = strlen(bytes); + if (numBytes < 0) { + numBytes = (ptrdiff_t)strlen(bytes); } - if (numBytes > INT_MAX) { + if ((size_t)numBytes > INT_MAX) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); |