diff options
Diffstat (limited to 'generic/tclIOGT.c')
| -rw-r--r-- | generic/tclIOGT.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index c1e8c44..7ba2f2a 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -116,7 +116,7 @@ static inline void ResultAdd(ResultBuffer *r, unsigned char *buf, * transformations. */ -static const Tcl_ChannelType transformChannelType = { +static Tcl_ChannelType transformChannelType = { "transform", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ TransformCloseProc, /* Close proc. */ @@ -211,7 +211,7 @@ struct TransformChannelData { * a transformation of incoming data. Also * serves as buffer of all data not yet * consumed by the reader. */ - size_t refCount; + int refCount; }; static void @@ -225,12 +225,12 @@ static void ReleaseData( TransformChannelData *dataPtr) { - if (dataPtr->refCount-- > 1) { + if (--dataPtr->refCount) { return; } ResultClear(&dataPtr->result); Tcl_DecrRefCount(dataPtr->command); - ckfree(dataPtr); + ckfree((char *) dataPtr); } /* @@ -287,7 +287,7 @@ TclChannelTransform( * regime of the underlying channel and to use the same for us too. */ - dataPtr = ckalloc(sizeof(TransformChannelData)); + dataPtr = (TransformChannelData *) ckalloc(sizeof(TransformChannelData)); dataPtr->refCount = 1; Tcl_DStringInit(&ds); @@ -313,8 +313,8 @@ TclChannelTransform( dataPtr->self = Tcl_StackChannel(interp, &transformChannelType, dataPtr, mode, chan); if (dataPtr->self == NULL) { - Tcl_AppendPrintfToObj(Tcl_GetObjResult(interp), - "\nfailed to stack channel \"%s\"", Tcl_GetChannelName(chan)); + Tcl_AppendResult(interp, "\nfailed to stack channel \"", + Tcl_GetChannelName(chan), "\"", NULL); ReleaseData(dataPtr); return TCL_ERROR; } @@ -683,7 +683,7 @@ TransformInputProc( * Already saw EOF from downChan; don't ask again. * NOTE: Could move this up to avoid the last maxRead * execution. Believe this would still be correct behavior, - * but the test suite tests the whole command callback + * but the test suite tests the whole command callback * sequence, so leave it unchanged for now. */ @@ -696,6 +696,7 @@ TransformInputProc( read = Tcl_ReadRaw(downChan, buf, toRead); if (read < 0) { + if (Tcl_InputBlocked(downChan) && (gotBytes > 0)) { /* * Zero bytes available from downChan because blocked. @@ -837,7 +838,7 @@ TransformSeekProc( { TransformChannelData *dataPtr = instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); - const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); + Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType); if ((offset == 0) && (mode == SEEK_CUR)) { @@ -904,7 +905,7 @@ TransformWideSeekProc( { TransformChannelData *dataPtr = instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); - const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); + Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType); Tcl_DriverWideSeekProc *parentWideSeekProc = Tcl_ChannelWideSeekProc(parentType); @@ -1273,7 +1274,7 @@ ResultClear( r->used = 0; if (r->allocated) { - ckfree(r->buf); + ckfree((char *) r->buf); r->buf = NULL; r->allocated = 0; } @@ -1417,10 +1418,10 @@ ResultAdd( if (r->allocated == 0) { r->allocated = toWrite + INCREMENT; - r->buf = ckalloc(r->allocated); + r->buf = UCHARP(ckalloc(r->allocated)); } else { r->allocated += toWrite + INCREMENT; - r->buf = ckrealloc(r->buf, r->allocated); + r->buf = UCHARP(ckrealloc((char *) r->buf, r->allocated)); } } |
