summaryrefslogtreecommitdiffstats
path: root/generic/tclIOGT.c
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 /generic/tclIOGT.c
parent8a90d26eafca6f78203e2af6e227e6404041b851 (diff)
parenta9eaf6765198716158f4927d71f64d20182f1ad2 (diff)
downloadtcl-f1b74b07572c8ac168a3313a6c71ec30f1a7485c.zip
tcl-f1b74b07572c8ac168a3313a6c71ec30f1a7485c.tar.gz
tcl-f1b74b07572c8ac168a3313a6c71ec30f1a7485c.tar.bz2
Merge 8.6
Diffstat (limited to 'generic/tclIOGT.c')
-rw-r--r--generic/tclIOGT.c8
1 files changed, 4 insertions, 4 deletions
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.
*/