diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-04 14:33:19 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-04 14:33:19 (GMT) |
| commit | 026ddaafb820733fbe5b5ab302938195685702e3 (patch) | |
| tree | fcf2f3ffecb2f824b341180c2f688dc602af01e7 | |
| parent | c3d90415a2bd6070f125ea866438ce263a74e462 (diff) | |
| parent | f67e0871803fd2f7cd43ac5229188fe322550fa5 (diff) | |
| download | tcl-026ddaafb820733fbe5b5ab302938195685702e3.zip tcl-026ddaafb820733fbe5b5ab302938195685702e3.tar.gz tcl-026ddaafb820733fbe5b5ab302938195685702e3.tar.bz2 | |
Merge 8.7.
Remove documentation and typedefs related to old channel types.
| -rw-r--r-- | doc/ChnlStack.3 | 7 | ||||
| -rw-r--r-- | doc/CrtChannel.3 | 188 | ||||
| -rw-r--r-- | doc/SetChanErr.3 | 4 | ||||
| -rw-r--r-- | generic/tcl.h | 31 | ||||
| -rw-r--r-- | generic/tclIO.c | 80 | ||||
| -rw-r--r-- | generic/tclIORChan.c | 18 | ||||
| -rw-r--r-- | win/tclWinInit.c | 4 | ||||
| -rw-r--r-- | win/tclWinSock.c | 2 |
8 files changed, 96 insertions, 238 deletions
diff --git a/doc/ChnlStack.3 b/doc/ChnlStack.3 index 70d1050..9233a88 100644 --- a/doc/ChnlStack.3 +++ b/doc/ChnlStack.3 @@ -49,11 +49,8 @@ I/O channels. Examples include compression and encryption modules. These functions transparently stack and unstack a new channel on top of an existing one. Any number of channels can be stacked together. .PP -The implementation of the Tcl channel code was rewritten in 8.3.2 to -correct some problems with the previous implementation with regard to -stacked channels. Anyone using stacked channels or creating stacked -channel drivers should update to the new \fBTCL_CHANNEL_VERSION_2\fR -\fBTcl_ChannelType\fR structure. See \fBTcl_CreateChannel\fR for details. +The \fBTcl_ChannelType\fR version currently supported is +\fBTCL_CHANNEL_VERSION_5\fR. See \fBTcl_CreateChannel\fR for details. .PP \fBTcl_StackChannel\fR stacks a new \fIchannel\fR on an existing channel with the same name that was registered for \fIchannel\fR by diff --git a/doc/CrtChannel.3 b/doc/CrtChannel.3 index c113efb..9edb782 100644 --- a/doc/CrtChannel.3 +++ b/doc/CrtChannel.3 @@ -9,7 +9,7 @@ .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME -Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelWideSeekProc, Tcl_ChannelTruncateProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_ChannelThreadActionProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels +Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelWideSeekProc, Tcl_ChannelTruncateProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_ChannelThreadActionProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels .SH SYNOPSIS .nf \fB#include <tcl.h>\fR @@ -75,9 +75,6 @@ Tcl_ChannelTypeVersion Tcl_DriverBlockModeProc * \fBTcl_ChannelBlockModeProc\fR(\fItypePtr\fR) .sp -Tcl_DriverCloseProc * -\fBTcl_ChannelCloseProc\fR(\fItypePtr\fR) -.sp Tcl_DriverClose2Proc * \fBTcl_ChannelClose2Proc\fR(\fItypePtr\fR) .sp @@ -87,9 +84,6 @@ Tcl_DriverInputProc * Tcl_DriverOutputProc * \fBTcl_ChannelOutputProc\fR(\fItypePtr\fR) .sp -Tcl_DriverSeekProc * -\fBTcl_ChannelSeekProc\fR(\fItypePtr\fR) -.sp Tcl_DriverWideSeekProc * \fBTcl_ChannelWideSeekProc\fR(\fItypePtr\fR) .sp @@ -286,16 +280,13 @@ name is registered in the (thread)-global list of all channels (result (thread)global list of all channels (of the current thread). Application to a channel still registered in some interpreter is not allowed. -Also notifies the driver if the \fBTcl_ChannelType\fR version is -\fBTCL_CHANNEL_VERSION_4\fR (or higher), and +Also notifies the driver if \fBTcl_DriverThreadActionProc\fR is defined for it. .PP \fBTcl_SpliceChannel\fR adds the specified \fIchannel\fR to the (thread)global list of all channels (of the current thread). Application to a channel registered in some interpreter is not allowed. -Also notifies the driver if the \fBTcl_ChannelType\fR version is -\fBTCL_CHANNEL_VERSION_4\fR (or higher), and -\fBTcl_DriverThreadActionProc\fR is defined for it. +Also notifies the driver if \fBTcl_DriverThreadActionProc\fR is defined for it. .PP \fBTcl_ClearChannelHandlers\fR removes all channel handlers and event scripts associated with the specified \fIchannel\fR, thus shutting @@ -315,10 +306,10 @@ The \fBTcl_ChannelType\fR structure contains the following fields: typedef struct Tcl_ChannelType { const char *\fItypeName\fR; Tcl_ChannelTypeVersion \fIversion\fR; - Tcl_DriverCloseProc *\fIcloseProc\fR; + void *\fIcloseProc\fR; /* Not used any more*/ Tcl_DriverInputProc *\fIinputProc\fR; Tcl_DriverOutputProc *\fIoutputProc\fR; - Tcl_DriverSeekProc *\fIseekProc\fR; + void *\fIseekProc\fR; /* Not used any more */ Tcl_DriverSetOptionProc *\fIsetOptionProc\fR; Tcl_DriverGetOptionProc *\fIgetOptionProc\fR; Tcl_DriverWatchProc *\fIwatchProc\fR; @@ -347,9 +338,8 @@ The user should only use the above structure for \fBTcl_ChannelType\fR instantiation. When referencing fields in a \fBTcl_ChannelType\fR structure, the following functions should be used to obtain the values: \fBTcl_ChannelName\fR, \fBTcl_ChannelVersion\fR, -\fBTcl_ChannelBlockModeProc\fR, \fBTcl_ChannelCloseProc\fR, -\fBTcl_ChannelClose2Proc\fR, \fBTcl_ChannelInputProc\fR, -\fBTcl_ChannelOutputProc\fR, \fBTcl_ChannelSeekProc\fR, +\fBTcl_ChannelBlockModeProc\fR, \fBTcl_ChannelClose2Proc\fR, +\fBTcl_ChannelInputProc\fR, \fBTcl_ChannelOutputProc\fR, \fBTcl_ChannelWideSeekProc\fR, \fBTcl_ChannelThreadActionProc\fR, \fBTcl_ChannelTruncateProc\fR, \fBTcl_ChannelSetOptionProc\fR, \fBTcl_ChannelGetOptionProc\fR, @@ -372,25 +362,9 @@ a pointer to the string. .PP The \fIversion\fR field should be set to the version of the structure -that you require. \fBTCL_CHANNEL_VERSION_2\fR is the minimum recommended. -\fBTCL_CHANNEL_VERSION_3\fR must be set to specify the \fIwideSeekProc\fR member. -\fBTCL_CHANNEL_VERSION_4\fR must be set to specify the \fIthreadActionProc\fR member -(includes \fIwideSeekProc\fR). -\fBTCL_CHANNEL_VERSION_5\fR must be set to specify the -\fItruncateProc\fR members (includes -\fIwideSeekProc\fR and \fIthreadActionProc\fR). -If it is not set to any of these, then this -\fBTcl_ChannelType\fR is assumed to have the original structure. See -\fBOLD CHANNEL TYPES\fR for more details. While Tcl will recognize -and function with either structures, stacked channels must be of at -least \fBTCL_CHANNEL_VERSION_2\fR to function correctly. -.PP -This value can be retrieved with \fBTcl_ChannelVersion\fR, which returns -one of -\fBTCL_CHANNEL_VERSION_5\fR, -\fBTCL_CHANNEL_VERSION_4\fR, -\fBTCL_CHANNEL_VERSION_3\fR, -\fBTCL_CHANNEL_VERSION_2\fR or \fBTCL_CHANNEL_VERSION_1\fR. +that you require. \fBTCL_CHANNEL_VERSION_5\fR is the minimum supported. +.PP +This value can be retrieved with \fBTcl_ChannelVersion\fR. .SS BLOCKMODEPROC .PP The \fIblockModeProc\fR field contains the address of a function called by @@ -426,22 +400,23 @@ blocking mode is acceptable to it, and should this also document for the user so that the blocking mode of the channel is not changed to an unacceptable value. Any confusion here may lead the interpreter into a (spurious and difficult to find) deadlock. -.SS "CLOSEPROC AND CLOSE2PROC" +.SS "CLOSE2PROC" .PP -The \fIcloseProc\fR field contains the address of a function called by the +The \fIclose2Proc\fR field contains the address of a function called by the generic layer to clean up driver-related information when the channel is -closed. \fICloseProc\fR must match the following prototype: +closed. \fIClose2Proc\fR must match the following prototype: .PP .CS -typedef int \fBTcl_DriverCloseProc\fR( +typedef int \fBTcl_DriverClose2Proc\fR( void *\fIinstanceData\fR, - Tcl_Interp *\fIinterp\fR); + Tcl_Interp *\fIinterp\fR, + int \fIflags\fR); .CE .PP -The \fIinstanceData\fR argument is the same as the value provided to -\fBTcl_CreateChannel\fR when the channel was created. The function should -release any storage maintained by the channel driver for this channel, and -close the input and output devices encapsulated by this channel. All queued +If \fIflags\fR is 0, the \fIinstanceData\fR argument is the same as the value +provided to \fBTcl_CreateChannel\fR when the channel was created. The function +should release any storage maintained by the channel driver for this channel, +and close the input and output devices encapsulated by this channel. All queued output will have been flushed to the device before this function is called, and no further driver operations will be invoked on this instance after calling the \fIcloseProc\fR. If the close operation is successful, the @@ -450,35 +425,20 @@ error code. In addition, if an error occurs and \fIinterp\fR is not NULL, the procedure should store an error message in the interpreter's result. .PP Alternatively, channels that support closing the read and write sides -independently may set \fIcloseProc\fR to \fBTCL_CLOSE2PROC\fR and set -\fIclose2Proc\fR to the address of a function that matches the -following prototype: -.PP -.CS -typedef int \fBTcl_DriverClose2Proc\fR( - void *\fIinstanceData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIflags\fR); -.CE -.PP -The \fIclose2Proc\fR will be called with \fIflags\fR set to an OR'ed +independently may accept other flag values than 0. +Then \fIclose2Proc\fR will be called with \fIflags\fR set to an OR'ed combination of \fBTCL_CLOSE_READ\fR or \fBTCL_CLOSE_WRITE\fR to indicate that the driver should close the read and/or write side of the channel. The channel driver may be invoked to perform additional operations on the channel after \fIclose2Proc\fR is -called to close one or both sides of the channel. If \fIflags\fR is -\fB0\fR (zero), the driver should close the channel in the manner -described above for \fIcloseProc\fR. No further operations will be -invoked on this instance after \fIclose2Proc\fR is called with all -flags cleared. In all cases, the \fIclose2Proc\fR function should -return zero if the close operation was successful; otherwise it should -return a nonzero POSIX error code. In addition, if an error occurs and -\fIinterp\fR is not NULL, the procedure should store an error message -in the interpreter's result. -.PP -The \fIcloseProc\fR and \fIclose2Proc\fR values can be retrieved with -\fBTcl_ChannelCloseProc\fR or \fBTcl_ChannelClose2Proc\fR, which -return a pointer to the respective function. +called to close one or both sides of the channel. In all cases, the +\fIclose2Proc\fR function should return zero if the close operation was +successful; otherwise it should return a nonzero POSIX error code. +In addition, if an error occurs and \fIinterp\fR is not NULL, the procedure +should store an error message in the interpreter's result. +.PP +The \fIclose2Proc\fR value can be retrieved with \fBTcl_ChannelClose2Proc\fR, +which returns a pointer to the function. .SS INPUTPROC .PP The \fIinputProc\fR field contains the address of a function called by the @@ -561,17 +521,17 @@ without writing any data. .PP This value can be retrieved with \fBTcl_ChannelOutputProc\fR, which returns a pointer to the function. -.SS "SEEKPROC AND WIDESEEKPROC" +.SS "WIDESEEKPROC" .PP -The \fIseekProc\fR field contains the address of a function called by the +The \fIwideSeekProc\fR field contains the address of a function called by the generic layer to move the access point at which subsequent input or output -operations will be applied. \fISeekProc\fR must match the following +operations will be applied. \fIWideSeekProc\fR must match the following prototype: .PP .CS -typedef int \fBTcl_DriverSeekProc\fR( +typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR( void *\fIinstanceData\fR, - long \fIoffset\fR, + Tcl_WideInt \fIoffset\fR, int \fIseekMode\fR, int *\fIerrorCodePtr\fR); .CE @@ -590,30 +550,8 @@ does not implement seeking. The return value is the new access point or -1 in case of error. If an error occurred, the function should not move the access point. .PP -If there is a non-NULL \fIseekProc\fR field, the \fIwideSeekProc\fR -field may contain the address of an alternative function to use which -handles wide (i.e. larger than 32-bit) offsets, so allowing seeks -within files larger than 2GB. The \fIwideSeekProc\fR will be called -in preference to the \fIseekProc\fR, but both must be defined if the -\fIwideSeekProc\fR is defined. \fIWideSeekProc\fR must match the -following prototype: -.PP -.CS -typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR( - void *\fIinstanceData\fR, - Tcl_WideInt \fIoffset\fR, - int \fIseekMode\fR, - int *\fIerrorCodePtr\fR); -.CE -.PP -The arguments and return values mean the same thing as with -\fIseekProc\fR above, except that the type of offsets and the return -type are different. -.PP -The \fIseekProc\fR value can be retrieved with -\fBTcl_ChannelSeekProc\fR, which returns a pointer to the function, -and similarly the \fIwideSeekProc\fR can be retrieved with -\fBTcl_ChannelWideSeekProc\fR. +The \fIwideSseekProc\fR value can be retrieved with +\fBTcl_ChannelWideSeekProc\fR, which returns a pointer to the function. .SS SETOPTIONPROC .PP The \fIsetOptionProc\fR field contains the address of a function called by @@ -870,58 +808,6 @@ The function takes good care of inserting minus signs before each option, commas after, and an .QW or before the last option. -.SH "OLD CHANNEL TYPES" -The original (8.3.1 and below) \fBTcl_ChannelType\fR structure contains -the following fields: -.PP -.CS -typedef struct Tcl_ChannelType { - const char *\fItypeName\fR; - Tcl_DriverBlockModeProc *\fIblockModeProc\fR; - Tcl_DriverCloseProc *\fIcloseProc\fR; - Tcl_DriverInputProc *\fIinputProc\fR; - Tcl_DriverOutputProc *\fIoutputProc\fR; - Tcl_DriverSeekProc *\fIseekProc\fR; - Tcl_DriverSetOptionProc *\fIsetOptionProc\fR; - Tcl_DriverGetOptionProc *\fIgetOptionProc\fR; - Tcl_DriverWatchProc *\fIwatchProc\fR; - Tcl_DriverGetHandleProc *\fIgetHandleProc\fR; - Tcl_DriverClose2Proc *\fIclose2Proc\fR; -} \fBTcl_ChannelType\fR; -.CE -.PP -It is still possible to create channel with the above structure. The -internal channel code will determine the version. It is imperative to use -the new \fBTcl_ChannelType\fR structure if you are creating a stacked -channel driver, due to problems with the earlier stacked channel -implementation (in 8.2.0 to 8.3.1). -.PP -Prior to 8.4.0 (i.e. during the later releases of 8.3 and early part -of the 8.4 development cycle) the \fBTcl_ChannelType\fR structure -contained the following fields: -.PP -.CS -typedef struct Tcl_ChannelType { - const char *\fItypeName\fR; - Tcl_ChannelTypeVersion \fIversion\fR; - Tcl_DriverCloseProc *\fIcloseProc\fR; - Tcl_DriverInputProc *\fIinputProc\fR; - Tcl_DriverOutputProc *\fIoutputProc\fR; - Tcl_DriverSeekProc *\fIseekProc\fR; - Tcl_DriverSetOptionProc *\fIsetOptionProc\fR; - Tcl_DriverGetOptionProc *\fIgetOptionProc\fR; - Tcl_DriverWatchProc *\fIwatchProc\fR; - Tcl_DriverGetHandleProc *\fIgetHandleProc\fR; - Tcl_DriverClose2Proc *\fIclose2Proc\fR; - Tcl_DriverBlockModeProc *\fIblockModeProc\fR; - Tcl_DriverFlushProc *\fIflushProc\fR; - Tcl_DriverHandlerProc *\fIhandlerProc\fR; - Tcl_DriverTruncateProc *\fItruncateProc\fR; -} \fBTcl_ChannelType\fR; -.CE -.PP -When the above structure is registered as a channel type, the -\fIversion\fR field should always be \fBTCL_CHANNEL_VERSION_2\fR. .SH "SEE ALSO" Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3), Tcl_QueueEvent(3), Tcl_StackChannel(3), Tcl_GetStdChannel(3) .SH KEYWORDS diff --git a/doc/SetChanErr.3 b/doc/SetChanErr.3 index 5bb86be..e73c38f 100644 --- a/doc/SetChanErr.3 +++ b/doc/SetChanErr.3 @@ -87,14 +87,10 @@ the value. Which functions of a channel driver are allowed to use which bypass function is listed below, as is which functions of the public channel API may leave a messages in the bypass areas. -.IP \fBTcl_DriverCloseProc\fR -May use \fBTcl_SetChannelErrorInterp\fR, and only this function. .IP \fBTcl_DriverInputProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverOutputProc\fR May use \fBTcl_SetChannelError\fR, and only this function. -.IP \fBTcl_DriverSeekProc\fR -May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverWideSeekProc\fR May use \fBTcl_SetChannelError\fR, and only this function. .IP \fBTcl_DriverSetOptionProc\fR diff --git a/generic/tcl.h b/generic/tcl.h index 8dbf5fe..29f64bc 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1220,7 +1220,7 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData); * interface. */ -#define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *) 1) +#define TCL_CLOSE2PROC NULL /* * Channel version tag. This was introduced in 8.3.2/8.4. @@ -1240,16 +1240,12 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData); */ typedef int (Tcl_DriverBlockModeProc) (void *instanceData, int mode); -typedef int (Tcl_DriverCloseProc) (void *instanceData, - Tcl_Interp *interp); typedef int (Tcl_DriverClose2Proc) (void *instanceData, Tcl_Interp *interp, int flags); typedef int (Tcl_DriverInputProc) (void *instanceData, char *buf, int toRead, int *errorCodePtr); typedef int (Tcl_DriverOutputProc) (void *instanceData, const char *buf, int toWrite, int *errorCodePtr); -typedef int (Tcl_DriverSeekProc) (void *instanceData, long offset, - int mode, int *errorCodePtr); typedef int (Tcl_DriverSetOptionProc) (void *instanceData, Tcl_Interp *interp, const char *optionName, const char *value); @@ -1292,17 +1288,14 @@ typedef struct Tcl_ChannelType { * type. */ Tcl_ChannelTypeVersion version; /* Version of the channel type. */ - Tcl_DriverCloseProc *closeProc; - /* Function to call to close the channel, or - * NULL or TCL_CLOSE2PROC if the close2Proc should be - * used instead. */ + void *closeProc; + /* Not used any more. */ Tcl_DriverInputProc *inputProc; /* Function to call for input on channel. */ Tcl_DriverOutputProc *outputProc; /* Function to call for output on channel. */ - Tcl_DriverSeekProc *seekProc; - /* Function to call to seek on the channel. - * May be NULL. */ + void *seekProc; + /* Not used any more. */ Tcl_DriverSetOptionProc *setOptionProc; /* Set an option on a channel. */ Tcl_DriverGetOptionProc *getOptionProc; @@ -1320,9 +1313,6 @@ typedef struct Tcl_ChannelType { Tcl_DriverBlockModeProc *blockModeProc; /* Set blocking mode for the raw channel. May * be NULL. */ - /* - * Only valid in TCL_CHANNEL_VERSION_2 channels or later. - */ Tcl_DriverFlushProc *flushProc; /* Function to call to flush a channel. May be * NULL. */ @@ -1330,26 +1320,15 @@ typedef struct Tcl_ChannelType { /* Function to call to handle a channel event. * This will be passed up the stacked channel * chain. */ - /* - * Only valid in TCL_CHANNEL_VERSION_3 channels or later. - */ Tcl_DriverWideSeekProc *wideSeekProc; /* Function to call to seek on the channel * which can handle 64-bit offsets. May be * NULL, and must be NULL if seekProc is * NULL. */ - /* - * Only valid in TCL_CHANNEL_VERSION_4 channels or later. - * TIP #218, Channel Thread Actions. - */ Tcl_DriverThreadActionProc *threadActionProc; /* Function to call to notify the driver of * thread specific activity for a channel. May * be NULL. */ - /* - * Only valid in TCL_CHANNEL_VERSION_5 channels or later. - * TIP #208, File Truncation. - */ Tcl_DriverTruncateProc *truncateProc; /* Function to call to truncate the underlying * file to a particular length. May be NULL if diff --git a/generic/tclIO.c b/generic/tclIO.c index fcf8085..49bdc96 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -1531,8 +1531,8 @@ TclGetChannelFromObj( /* No epoch change in channel since lookup */ && (resPtr->epoch == statePtr->epoch)) { /* - * Have a valid saved lookup. Jump to end to return it. - */ + * Have a valid saved lookup. Jump to end to return it. + */ goto valid; } @@ -2869,9 +2869,9 @@ FlushChannel( break; } else { /* - * TODO: Consider detecting and reacting to short writes on + * TODO: Consider detecting and reacting to short writes on * blocking channels. Ought not happen. See iocmd-24.2. - */ + */ wroteSome = 1; } @@ -3474,7 +3474,10 @@ TclClose( * it anymore and this will help avoid deadlocks on some channel types. */ - (void)chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ); + result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ); + if (result == EINVAL) { + result = 0; + } /* * The call to FlushChannel will flush any queued output and invoke the @@ -4221,8 +4224,8 @@ WillRead( { if (chanPtr->typePtr == NULL) { /* - * Prevent read attempts on a closed channel. - */ + * Prevent read attempts on a closed channel. + */ DiscardInputQueued(chanPtr->state, 0); Tcl_SetErrno(EINVAL); @@ -4330,15 +4333,15 @@ Write( dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); /* - * See chan-io-1.[89]. Tcl Bug 506297. - */ + * See chan-io-1.[89]. Tcl Bug 506297. + */ statePtr->outputEncodingFlags &= ~TCL_ENCODING_START; if ((result != TCL_OK) && (srcRead + dstWrote == 0)) { /* - * We're reading from invalid/incomplete UTF-8. - */ + * We're reading from invalid/incomplete UTF-8. + */ ReleaseChannelBuffer(bufPtr); if (total == 0) { @@ -5652,8 +5655,8 @@ Tcl_ReadRaw( : (int)bytesToRead; /* - * Copy the current chunk into the read buffer. - */ + * Copy the current chunk into the read buffer. + */ memcpy(readBuf, RemovePoint(bufPtr), toCopy); bufPtr->nextRemoved += toCopy; @@ -6347,8 +6350,8 @@ ReadChars( ChannelBuffer *nextPtr; /* - * We were not able to read any chars. - */ + * We were not able to read any chars. + */ assert(numChars == 0); @@ -6368,7 +6371,7 @@ ReadChars( } /* - * Otherwise, reading zero characters indicates there's something + * Otherwise, reading zero characters indicates there's something * incomplete at the end of the src buffer. Maybe there were not * enough src bytes to decode into a char. Maybe a lone \r could * not be translated (crlf mode). Need to combine any unused src @@ -6477,17 +6480,17 @@ TranslateInputEOL( case TCL_TRANSLATE_LF: case TCL_TRANSLATE_CR: if (srcLen > dstLen) { - /* - * In these modes, each src byte become a dst byte. - */ + /* + * In these modes, each src byte become a dst byte. + */ srcLen = dstLen; } break; default: /* - * In other modes, at most 2 src bytes become a dst byte. - */ + * In other modes, at most 2 src bytes become a dst byte. + */ if (srcLen/2 > dstLen) { srcLen = 2 * dstLen; @@ -9571,8 +9574,8 @@ CopyData( if (size == 0) { if (!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) { /* - * We allowed a short read. Keep trying. - */ + * We allowed a short read. Keep trying. + */ continue; } @@ -9853,16 +9856,16 @@ DoRead( if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) { /* - * Further reads cannot do any more. - */ + * Further reads cannot do any more. + */ break; } if (code) { /* - * Read error - */ + * Read error + */ UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); @@ -9914,28 +9917,28 @@ DoRead( if (bufPtr->nextPtr == NULL) { /* - * There's no more buffered data... - */ + * There's no more buffered data... + */ if (statePtr->flags & CHANNEL_EOF) { /* - * ...and there never will be. - */ + * ...and there never will be. + */ *p++ = '\r'; bytesToRead--; bufPtr->nextRemoved++; } else if (statePtr->flags & CHANNEL_BLOCKED) { /* - * ...and we cannot get more now. - */ + * ...and we cannot get more now. + */ SetFlag(statePtr, CHANNEL_NEED_MORE_DATA); break; } else { /* - * ...so we need to get some. - */ + * ...so we need to get some. + */ goto moreData; } @@ -9943,8 +9946,8 @@ DoRead( if (bufPtr->nextPtr) { /* - * There's a next buffer. Shift orphan \r to it. - */ + * There's a next buffer. Shift orphan \r to it. + */ ChannelBuffer *nextPtr = bufPtr->nextPtr; @@ -11082,9 +11085,6 @@ Tcl_ChannelTruncateProc( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (Tcl_ChannelVersion(chanTypePtr) < TCL_CHANNEL_VERSION_5) { - return NULL; - } return chanTypePtr->truncateProc; } diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 018c59f..9a57a65 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -79,7 +79,7 @@ static const Tcl_ChannelType tclRChannelType = { #if TCL_THREADS ReflectThread, /* thread action, tracking owner */ #else - (void *)-1, /* thread action */ + NULL, /* thread action */ #endif NULL /* truncate */ }; @@ -1336,8 +1336,8 @@ ReflectInput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { /* - * No error message, this is an errno signal. - */ + * No error message, this is an errno signal. + */ *errorCodePtr = -p.base.code; } else { @@ -1442,8 +1442,8 @@ ReflectOutput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { /* - * No error message, this is an errno signal. - */ + * No error message, this is an errno signal. + */ *errorCodePtr = -p.base.code; } else { @@ -2614,8 +2614,8 @@ DeleteReflectedChannelMap( evPtr = resultPtr->evPtr; /* - * Basic crash safety until this routine can get revised [3411310] - */ + * Basic crash safety until this routine can get revised [3411310] + */ if (evPtr == NULL) { continue; @@ -2765,8 +2765,8 @@ DeleteThreadReflectedChannelMap( evPtr = resultPtr->evPtr; /* - * Basic crash safety until this routine can get revised [3411310] - */ + * Basic crash safety until this routine can get revised [3411310] + */ if (evPtr == NULL ) { continue; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 1dfc9b5..5524850 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -157,7 +157,7 @@ TclpInitPlatform(void) */ handle = GetModuleHandleW(L"KERNEL32"); tclWinProcs.cancelSynchronousIo = - (BOOL (WINAPI *)(HANDLE)) GetProcAddress(handle, + (BOOL (WINAPI *)(HANDLE))(void *)GetProcAddress(handle, "CancelSynchronousIo"); } @@ -525,7 +525,7 @@ TclpSetVariables( if (!osInfoInitialized) { HMODULE handle = GetModuleHandleW(L"NTDLL"); int(__stdcall *getversion)(void *) = - (int(__stdcall *)(void *)) GetProcAddress(handle, "RtlGetVersion"); + (int(__stdcall *)(void *))(void *)GetProcAddress(handle, "RtlGetVersion"); osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); if (!getversion || getversion(&osInfo)) { GetVersionExW(&osInfo); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index a1eaa18..5dc32a2 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -258,12 +258,12 @@ static int FindFDInList(TcpState *statePtr, SOCKET socket); static DWORD WINAPI SocketThread(LPVOID arg); static void TcpThreadActionProc(ClientData instanceData, int action); +static int TcpCloseProc(void *, Tcl_Interp *); static Tcl_EventCheckProc SocketCheckProc; static Tcl_EventProc SocketEventProc; static Tcl_EventSetupProc SocketSetupProc; static Tcl_DriverBlockModeProc TcpBlockModeProc; -static Tcl_DriverCloseProc TcpCloseProc; static Tcl_DriverClose2Proc TcpClose2Proc; static Tcl_DriverSetOptionProc TcpSetOptionProc; static Tcl_DriverGetOptionProc TcpGetOptionProc; |
