summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-06 09:45:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-06 09:45:49 (GMT)
commit65254e27f9238b5be5dac497f9267fb484024829 (patch)
tree0d25d8a9635cbe7ee3116e23902d8a1df121b25c /generic/tclUtil.c
parent3cb6c489a3c0515c7b3aade0aaa139e637400559 (diff)
parent0b94a6293a785dce24805809dbceabca179de113 (diff)
downloadtcl-65254e27f9238b5be5dac497f9267fb484024829.zip
tcl-65254e27f9238b5be5dac497f9267fb484024829.tar.gz
tcl-65254e27f9238b5be5dac497f9267fb484024829.tar.bz2
Merge 8.6
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 7ab6eae..bae7bc6 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -106,8 +106,8 @@ static Tcl_ThreadDataKey precisionKey;
*/
static void ClearHash(Tcl_HashTable *tablePtr);
-static void FreeProcessGlobalValue(ClientData clientData);
-static void FreeThreadHash(ClientData clientData);
+static void FreeProcessGlobalValue(void *clientData);
+static void FreeThreadHash(void *clientData);
static int GetEndOffsetFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t endValue, Tcl_WideInt *indexPtr);
static Tcl_HashTable * GetThreadHash(Tcl_ThreadDataKey *keyPtr);
@@ -1017,7 +1017,7 @@ Tcl_ScanCountedElement(
*----------------------------------------------------------------------
*/
-int
+unsigned int
TclScanElement(
const char *src, /* String to convert to Tcl list element. */
int length, /* Number of bytes in src, or -1. */
@@ -1033,7 +1033,7 @@ TclScanElement(
int extra = 0; /* Count of number of extra bytes needed for
* formatted element, assuming we use escape
* sequences in formatting. */
- int bytesNeeded; /* Buffer length computed to complete the
+ unsigned int bytesNeeded; /* Buffer length computed to complete the
* element formatting in the selected mode. */
#if COMPAT
int preferEscape = 0; /* Use preferences to track whether to use */
@@ -1297,7 +1297,7 @@ TclScanElement(
*flagPtr = CONVERT_NONE;
overflowCheck:
- if (bytesNeeded < 0) {
+ if (bytesNeeded > INT_MAX) {
Tcl_Panic("TclScanElement: string length overflow");
}
return bytesNeeded;
@@ -1575,7 +1575,8 @@ Tcl_Merge(
{
#define LOCAL_SIZE 64
char localFlags[LOCAL_SIZE], *flagPtr = NULL;
- int i, bytesNeeded = 0;
+ int i;
+ unsigned int bytesNeeded = 0;
char *result, *dst;
/*
@@ -1601,11 +1602,11 @@ Tcl_Merge(
for (i = 0; i < argc; i++) {
flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 );
bytesNeeded += TclScanElement(argv[i], -1, &flagPtr[i]);
- if (bytesNeeded < 0) {
+ if (bytesNeeded > INT_MAX) {
Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
}
- if (bytesNeeded > INT_MAX - argc + 1) {
+ if (bytesNeeded + argc > INT_MAX + 1U) {
Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
bytesNeeded += argc;
@@ -3391,7 +3392,7 @@ Tcl_PrintDouble(
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
char *
TclPrecTraceProc(
- ClientData clientData,
+ void *clientData,
Tcl_Interp *interp, /* Interpreter containing variable. */
const char *name1, /* Name of variable. */
const char *name2, /* Second part of variable name. */
@@ -3643,7 +3644,7 @@ GetWideForIndex(
* representing an index. */
{
int numType;
- ClientData cd;
+ void *cd;
int code = TclGetNumberFromObj(NULL, objPtr, &cd, &numType);
if (code == TCL_OK) {
@@ -3757,7 +3758,7 @@ GetEndOffsetFromObj(
{
Tcl_ObjInternalRep *irPtr;
Tcl_WideInt offset = -1; /* Offset in the "end-offset" expression - 1 */
- ClientData cd;
+ void *cd;
while ((irPtr = TclFetchInternalRep(objPtr, &endOffsetType)) == NULL) {
Tcl_ObjInternalRep ir;
@@ -4251,7 +4252,7 @@ GetThreadHash(
static void
FreeThreadHash(
- ClientData clientData)
+ void *clientData)
{
Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData;
@@ -4273,7 +4274,7 @@ FreeThreadHash(
static void
FreeProcessGlobalValue(
- ClientData clientData)
+ void *clientData)
{
ProcessGlobalValue *pgvPtr = (ProcessGlobalValue *)clientData;