summaryrefslogtreecommitdiffstats
path: root/win/tclWinChan.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-02-16 14:17:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-02-16 14:17:09 (GMT)
commit348a15e956c5e8efa00e0b87aae997ff631bd869 (patch)
tree60c8d66486ae300e587b4d827e0245979e1a63f8 /win/tclWinChan.c
parent4c72523145189602c33c3e0d08e1b716fef1a34f (diff)
downloadtcl-348a15e956c5e8efa00e0b87aae997ff631bd869.zip
tcl-348a15e956c5e8efa00e0b87aae997ff631bd869.tar.gz
tcl-348a15e956c5e8efa00e0b87aae997ff631bd869.tar.bz2
Reduce the number of warnings on Windows: channel names generated in one place
Diffstat (limited to 'win/tclWinChan.c')
-rw-r--r--win/tclWinChan.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 8743afe..5f03138 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -145,6 +145,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.
@@ -1488,7 +1515,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;
}
}
@@ -1506,8 +1534,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);