diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-06-29 20:28:54 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-06-29 20:28:54 (GMT) |
commit | 94741577ee73184dd04e947e9a87bc9227c4ebab (patch) | |
tree | fd68415e372f7051c71d212b2bd274ed2c5c5b2c /generic/tclStringObj.c | |
parent | 709f9278ffe0739b8bc246247ff82868eff8b467 (diff) | |
download | tcl-94741577ee73184dd04e947e9a87bc9227c4ebab.zip tcl-94741577ee73184dd04e947e9a87bc9227c4ebab.tar.gz tcl-94741577ee73184dd04e947e9a87bc9227c4ebab.tar.bz2 |
Another round of size_t'isms, this time also for Tcl_DString
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 1e84ce2..786a0be 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3086,7 +3086,7 @@ TclStringCat( first = last = objc - oc - 1; if (oc && (length == 0)) { - int numBytes; + size_t numBytes; /* assert ( pendingPtr != NULL ) */ @@ -3098,7 +3098,8 @@ TclStringCat( do { Tcl_Obj *objPtr = *ov++; - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + Tcl_GetString(objPtr); /* PANIC? */ + numBytes = objPtr->length; } while (--oc && numBytes == 0 && pendingPtr->bytes == NULL); if (numBytes) { @@ -3111,7 +3112,7 @@ TclStringCat( if (numBytes) { first = last; } - } else if (numBytes > INT_MAX - length) { + } else if (numBytes + length > (size_t)INT_MAX) { goto overflow; } length += numBytes; @@ -3119,15 +3120,16 @@ TclStringCat( } while (oc && (length == 0)); while (oc) { - int numBytes; + size_t numBytes; Tcl_Obj *objPtr = *ov++; /* assert ( length > 0 && pendingPtr == NULL ) */ - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + Tcl_GetString(objPtr); /* PANIC? */ + numBytes = objPtr->length; if (numBytes) { last = objc - oc; - if (numBytes > INT_MAX - length) { + if (numBytes + length > (size_t)INT_MAX) { goto overflow; } length += numBytes; |