summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-14 10:10:30 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-14 10:10:30 (GMT)
commitf1b74b07572c8ac168a3313a6c71ec30f1a7485c (patch)
treef0aed383ff3df3c53cde48d4c9d5717d0580289b
parent8a90d26eafca6f78203e2af6e227e6404041b851 (diff)
parenta9eaf6765198716158f4927d71f64d20182f1ad2 (diff)
downloadtcl-f1b74b07572c8ac168a3313a6c71ec30f1a7485c.zip
tcl-f1b74b07572c8ac168a3313a6c71ec30f1a7485c.tar.gz
tcl-f1b74b07572c8ac168a3313a6c71ec30f1a7485c.tar.bz2
Merge 8.6
-rw-r--r--generic/tclCkalloc.c2
-rw-r--r--generic/tclCompile.c2
-rw-r--r--generic/tclIOGT.c8
-rw-r--r--generic/tclIORTrans.c28
-rw-r--r--generic/tclObj.c2
-rw-r--r--generic/tclProc.c2
-rw-r--r--generic/tclStringObj.c6
-rw-r--r--generic/tclStringRep.h2
8 files changed, 26 insertions, 26 deletions
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index c664783..d0fa300 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -41,7 +41,7 @@ typedef struct MemTag {
* last field in the structure. */
} MemTag;
-#define TAG_SIZE(bytesInString) ((offsetof(MemTag, string) + 1) + (bytesInString))
+#define TAG_SIZE(bytesInString) ((offsetof(MemTag, string) + 1U) + (bytesInString))
static MemTag *curTagPtr = NULL;/* Tag to use in all future mem_headers (set
* by "memory tag" command). */
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index c89fedb..f7479f0 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -3065,7 +3065,7 @@ TclFindCompiledLocal(
if (create || (name == NULL)) {
localVar = procPtr->numCompiledLocals;
- localPtr = (CompiledLocal *)ckalloc(offsetof(CompiledLocal, name) + nameBytes + 1);
+ localPtr = (CompiledLocal *)ckalloc(offsetof(CompiledLocal, name) + 1U + nameBytes);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index f03fcca..6194187 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -108,7 +108,7 @@ typedef struct ResultBuffer ResultBuffer;
static inline void ResultClear(ResultBuffer *r);
static inline void ResultInit(ResultBuffer *r);
static inline int ResultEmpty(ResultBuffer *r);
-static inline int ResultCopy(ResultBuffer *r, unsigned char *buf,
+static inline size_t ResultCopy(ResultBuffer *r, unsigned char *buf,
size_t toRead);
static inline void ResultAdd(ResultBuffer *r, unsigned char *buf,
size_t toWrite);
@@ -1368,13 +1368,13 @@ ResultEmpty(
*----------------------------------------------------------------------
*/
-static inline int
+static inline size_t
ResultCopy(
ResultBuffer *r, /* The buffer to read from. */
unsigned char *buf, /* The buffer to copy into. */
size_t toRead) /* Number of requested bytes. */
{
- if (r->used == 0) {
+ if (ResultEmpty(r)) {
/*
* Nothing to copy in the case of an empty buffer.
*/
@@ -1431,7 +1431,7 @@ ResultAdd(
unsigned char *buf, /* The buffer to read from. */
size_t toWrite) /* The number of bytes in 'buf'. */
{
- if (r->used + toWrite > r->allocated) {
+ if ((r->used + toWrite + 1) > r->allocated) {
/*
* Extension of the internal buffer is required.
*/
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index c143497..dc6c9a7 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -91,20 +91,20 @@ static const Tcl_ChannelType tclRTransformType = {
typedef struct {
unsigned char *buf; /* Reference to the buffer area. */
- int allocated; /* Allocated size of the buffer area. */
- int used; /* Number of bytes in the buffer,
+ size_t allocated; /* Allocated size of the buffer area. */
+ size_t used; /* Number of bytes in the buffer,
* <= allocated. */
} ResultBuffer;
#define ResultLength(r) ((r)->used)
/* static int ResultLength(ResultBuffer *r); */
-static void ResultClear(ResultBuffer *r);
-static void ResultInit(ResultBuffer *r);
-static void ResultAdd(ResultBuffer *r, unsigned char *buf,
- int toWrite);
-static int ResultCopy(ResultBuffer *r, unsigned char *buf,
- int toRead);
+static inline void ResultClear(ResultBuffer *r);
+static inline void ResultInit(ResultBuffer *r);
+static inline void ResultAdd(ResultBuffer *r, unsigned char *buf,
+ size_t toWrite);
+static inline size_t ResultCopy(ResultBuffer *r, unsigned char *buf,
+ size_t toRead);
#define RB_INCREMENT (512)
@@ -2924,7 +2924,7 @@ TimerRun(
*----------------------------------------------------------------------
*/
-static void
+static inline void
ResultInit(
ResultBuffer *rPtr) /* Reference to the structure to
* initialize. */
@@ -2949,7 +2949,7 @@ ResultInit(
*----------------------------------------------------------------------
*/
-static void
+static inline void
ResultClear(
ResultBuffer *rPtr) /* Reference to the buffer to clear out */
{
@@ -2980,11 +2980,11 @@ ResultClear(
*----------------------------------------------------------------------
*/
-static void
+static inline void
ResultAdd(
ResultBuffer *rPtr, /* The buffer to extend */
unsigned char *buf, /* The buffer to read from */
- int toWrite) /* The number of bytes in 'buf' */
+ size_t toWrite) /* The number of bytes in 'buf' */
{
if ((rPtr->used + toWrite + 1) > rPtr->allocated) {
/*
@@ -3028,11 +3028,11 @@ ResultAdd(
*----------------------------------------------------------------------
*/
-static int
+static inline size_t
ResultCopy(
ResultBuffer *rPtr, /* The buffer to read from */
unsigned char *buf, /* The buffer to copy into */
- int toRead) /* Number of requested bytes */
+ size_t toRead) /* Number of requested bytes */
{
int copied;
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 92c6655..16a95cd 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -567,7 +567,7 @@ TclContinuationsEnter(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
Tcl_CreateHashEntry(tsdPtr->lineCLPtr, objPtr, &newEntry);
- ContLineLoc *clLocPtr = (ContLineLoc *)ckalloc(offsetof(ContLineLoc, loc) + (num + 1) *sizeof(int));
+ ContLineLoc *clLocPtr = (ContLineLoc *)ckalloc(offsetof(ContLineLoc, loc) + (num + 1U) *sizeof(int));
if (!newEntry) {
/*
diff --git a/generic/tclProc.c b/generic/tclProc.c
index afe846e..72a3c2a 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -633,7 +633,7 @@ TclCreateProc(
*/
localPtr = (CompiledLocal *)ckalloc(
- offsetof(CompiledLocal, name) + fieldValues[0]->length + 1);
+ offsetof(CompiledLocal, name) + 1U + fieldValues[0]->length);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 5b8f3a6..a1d6602 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -148,7 +148,7 @@ GrowStringBuffer(
if (flag == 0 || stringPtr->allocated > 0) {
if (needed <= INT_MAX / 2) {
attempt = 2 * needed;
- ptr = (char *)attemptckrealloc(objPtr->bytes, attempt + 1);
+ ptr = (char *)attemptckrealloc(objPtr->bytes, attempt + 1U);
}
if (ptr == NULL) {
/*
@@ -161,7 +161,7 @@ GrowStringBuffer(
int growth = (int) ((extra > limit) ? limit : extra);
attempt = needed + growth;
- ptr = (char *)attemptckrealloc(objPtr->bytes, attempt + 1);
+ ptr = (char *)attemptckrealloc(objPtr->bytes, attempt + 1U);
}
}
if (ptr == NULL) {
@@ -170,7 +170,7 @@ GrowStringBuffer(
*/
attempt = needed;
- ptr = (char *)ckrealloc(objPtr->bytes, attempt + 1);
+ ptr = (char *)ckrealloc(objPtr->bytes, attempt + 1U);
}
objPtr->bytes = ptr;
stringPtr->allocated = attempt;
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index 7fea9b3..672210a 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -67,7 +67,7 @@ typedef struct {
#define STRING_MAXCHARS \
(int)(((size_t)UINT_MAX - 1 - offsetof(String, unicode))/sizeof(Tcl_UniChar))
#define STRING_SIZE(numChars) \
- (offsetof(String, unicode) + (((numChars) + 1) * sizeof(Tcl_UniChar)))
+ (offsetof(String, unicode) + (((numChars) + 1U) * sizeof(Tcl_UniChar)))
#define stringCheckLimits(numChars) \
do { \
if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \