diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-02-16 14:43:11 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-02-16 14:43:11 (GMT) |
commit | 4ecd9f7eaa31f72507645c0f692afce5f90cf2cd (patch) | |
tree | 676f9b045b92357a7d311d5065631dfeba568510 /win/tclWinChan.c | |
parent | 1059f36a9822abd45a0246f875a959e16684dd48 (diff) | |
download | tcl-4ecd9f7eaa31f72507645c0f692afce5f90cf2cd.zip tcl-4ecd9f7eaa31f72507645c0f692afce5f90cf2cd.tar.gz tcl-4ecd9f7eaa31f72507645c0f692afce5f90cf2cd.tar.bz2 |
(cherry-pick) Reduce the number of warnings on Windows: channel names generated in one place
Diffstat (limited to 'win/tclWinChan.c')
-rw-r--r-- | win/tclWinChan.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 3be06c3..a8a757d 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -153,6 +153,33 @@ static const Tcl_ChannelType fileChannelType = { /* *---------------------------------------------------------------------- * + * TclWinGenerateChannelName -- + * + * This function generates names for channels. + * + * Results: + * None. + * + * Side effects: + * Creates a new window and creates an exit handler. + * + *---------------------------------------------------------------------- + */ +void +TclWinGenerateChannelName( + char channelName[], /* Buffer to accept the name. */ + const char *channelTypeName,/* Name of type of channel. */ + void *channelImpl) /* Pointer to channel implementation + * structure, used to generate a unique + * ID. */ +{ + snprintf(channelName, 16 + TCL_INTEGER_SPACE, "%s%" TCL_Z_MODIFIER "x", + channelTypeName, (size_t) channelImpl); +} + +/* + *---------------------------------------------------------------------- + * * FileInit -- * * This function creates the window used to simulate file events. @@ -1576,7 +1603,8 @@ OpenFileChannel( for (infoPtr = tsdPtr->firstFilePtr; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { if (infoPtr->handle == (HANDLE) handle) { - return ((permissions & (TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION))==infoPtr->validMask) ? infoPtr->channel : NULL; + return ((permissions & (TCL_READABLE|TCL_WRITABLE|TCL_EXCEPTION))==infoPtr->validMask) + ? infoPtr->channel : NULL; } } @@ -1594,8 +1622,7 @@ OpenFileChannel( infoPtr->flags = appendMode; infoPtr->handle = handle; infoPtr->dirty = 0; - snprintf(channelName, 16 + TCL_INTEGER_SPACE, "file%" TCL_Z_MODIFIER "x", (size_t) infoPtr); - + TclWinGenerateChannelName(channelName, "file", infoPtr); infoPtr->channel = Tcl_CreateChannel(&fileChannelType, channelName, infoPtr, permissions); |