Skip to content

Commit

Permalink
Merge 8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Dec 29, 2023
2 parents a6b6453 + 74f2d36 commit 7348f9a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 54 deletions.
70 changes: 35 additions & 35 deletions unix/tclUnixChan.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ typedef struct {
if (interp) { \
Tcl_SetObjResult(interp, Tcl_ObjPrintf( \
"%s not supported for this platform", (detail))); \
Tcl_SetErrorCode(interp, "TCL", "UNSUPPORTED", (void *)NULL); \
Tcl_SetErrorCode(interp, "TCL", "UNSUPPORTED", (char *)NULL); \
}

/*
Expand Down Expand Up @@ -888,20 +888,20 @@ TtySetOptionProc(
#ifdef CRTSCTS
CLEAR_BITS(iostate.c_cflag, CRTSCTS);
#endif /* CRTSCTS */
if (Tcl_UtfNcasecmp(value, "NONE", vlen) == 0) {
if (strncasecmp(value, "NONE", vlen) == 0) {
/*
* Leave all handshake options disabled.
*/
} else if (Tcl_UtfNcasecmp(value, "XONXOFF", vlen) == 0) {
} else if (strncasecmp(value, "XONXOFF", vlen) == 0) {
SET_BITS(iostate.c_iflag, IXON | IXOFF | IXANY);
} else if (Tcl_UtfNcasecmp(value, "RTSCTS", vlen) == 0) {
} else if (strncasecmp(value, "RTSCTS", vlen) == 0) {
#ifdef CRTSCTS
SET_BITS(iostate.c_cflag, CRTSCTS);
#else /* !CRTSTS */
UNSUPPORTED_OPTION("-handshake RTSCTS");
return TCL_ERROR;
#endif /* CRTSCTS */
} else if (Tcl_UtfNcasecmp(value, "DTRDSR", vlen) == 0) {
} else if (strncasecmp(value, "DTRDSR", vlen) == 0) {
UNSUPPORTED_OPTION("-handshake DTRDSR");
return TCL_ERROR;
} else {
Expand All @@ -910,7 +910,7 @@ TtySetOptionProc(
"bad value for -handshake: must be one of"
" xonxoff, rtscts, dtrdsr or none", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", (void *)NULL);
"VALUE", (char *)NULL);
}
return TCL_ERROR;
}
Expand All @@ -931,7 +931,7 @@ TtySetOptionProc(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -xchar: should be a list of"
" two elements with each a single 8-bit character", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", (void *)NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", (char *)NULL);
}
ckfree(argv);
return TCL_ERROR;
Expand Down Expand Up @@ -997,7 +997,7 @@ TtySetOptionProc(
"bad value for -ttycontrol: should be a list of"
" signal,value pairs", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", (void *)NULL);
"VALUE", (char *)NULL);
}
ckfree(argv);
return TCL_ERROR;
Expand All @@ -1009,19 +1009,19 @@ TtySetOptionProc(
ckfree(argv);
return TCL_ERROR;
}
if (Tcl_UtfNcasecmp(argv[i], "DTR", strlen(argv[i])) == 0) {
if (strncasecmp(argv[i], "DTR", strlen(argv[i])) == 0) {
if (flag) {
SET_BITS(control, TIOCM_DTR);
} else {
CLEAR_BITS(control, TIOCM_DTR);
}
} else if (Tcl_UtfNcasecmp(argv[i], "RTS", strlen(argv[i])) == 0) {
} else if (strncasecmp(argv[i], "RTS", strlen(argv[i])) == 0) {
if (flag) {
SET_BITS(control, TIOCM_RTS);
} else {
CLEAR_BITS(control, TIOCM_RTS);
}
} else if (Tcl_UtfNcasecmp(argv[i], "BREAK", strlen(argv[i])) == 0) {
} else if (strncasecmp(argv[i], "BREAK", strlen(argv[i])) == 0) {
#if defined(TIOCSBRK) && defined(TIOCCBRK)
if (flag) {
ioctl(fsPtr->fileState.fd, TIOCSBRK, NULL);
Expand All @@ -1039,7 +1039,7 @@ TtySetOptionProc(
"bad signal \"%s\" for -ttycontrol: must be"
" DTR, RTS or BREAK", argv[i]));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", (void *)NULL);
"VALUE", (char *)NULL);
}
ckfree(argv);
return TCL_ERROR;
Expand All @@ -1059,19 +1059,19 @@ TtySetOptionProc(
*/

if ((len > 2) && (strncmp(optionName, "-closemode", len) == 0)) {
if (Tcl_UtfNcasecmp(value, "DEFAULT", vlen) == 0) {
if (strncasecmp(value, "DEFAULT", vlen) == 0) {
fsPtr->closeMode = CLOSE_DEFAULT;
} else if (Tcl_UtfNcasecmp(value, "DRAIN", vlen) == 0) {
} else if (strncasecmp(value, "DRAIN", vlen) == 0) {
fsPtr->closeMode = CLOSE_DRAIN;
} else if (Tcl_UtfNcasecmp(value, "DISCARD", vlen) == 0) {
} else if (strncasecmp(value, "DISCARD", vlen) == 0) {
fsPtr->closeMode = CLOSE_DISCARD;
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad mode \"%s\" for -closemode: must be"
" default, discard, or drain", value));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", (void *)NULL);
"VALUE", (char *)NULL);
}
return TCL_ERROR;
}
Expand All @@ -1091,11 +1091,11 @@ TtySetOptionProc(
}
return TCL_ERROR;
}
if (Tcl_UtfNcasecmp(value, "NORMAL", vlen) == 0) {
if (strncasecmp(value, "NORMAL", vlen) == 0) {
SET_BITS(iostate.c_iflag, BRKINT | IGNPAR | ISTRIP | ICRNL | IXON);
SET_BITS(iostate.c_oflag, OPOST);
SET_BITS(iostate.c_lflag, ECHO | ECHONL | ICANON | ISIG);
} else if (Tcl_UtfNcasecmp(value, "PASSWORD", vlen) == 0) {
} else if (strncasecmp(value, "PASSWORD", vlen) == 0) {
SET_BITS(iostate.c_iflag, BRKINT | IGNPAR | ISTRIP | ICRNL | IXON);
SET_BITS(iostate.c_oflag, OPOST);
CLEAR_BITS(iostate.c_lflag, ECHO);
Expand All @@ -1106,7 +1106,7 @@ TtySetOptionProc(
* feels highly unnatural to do so in practice.
*/
SET_BITS(iostate.c_lflag, ECHONL | ICANON | ISIG);
} else if (Tcl_UtfNcasecmp(value, "RAW", vlen) == 0) {
} else if (strncasecmp(value, "RAW", vlen) == 0) {
#ifdef HAVE_CFMAKERAW
cfmakeraw(&iostate);
#else /* !HAVE_CFMAKERAW */
Expand All @@ -1117,7 +1117,7 @@ TtySetOptionProc(
CLEAR_BITS(iostate.c_cflag, CSIZE | PARENB);
SET_BITS(iostate.c_cflag, CS8);
#endif /* HAVE_CFMAKERAW */
} else if (Tcl_UtfNcasecmp(value, "RESET", vlen) == 0) {
} else if (strncasecmp(value, "RESET", vlen) == 0) {
/*
* Reset to the initial state, whatever that is.
*/
Expand All @@ -1129,7 +1129,7 @@ TtySetOptionProc(
"bad mode \"%s\" for -inputmode: must be"
" normal, password, raw, or reset", value));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", (void *)NULL);
"VALUE", (char *)NULL);
}
return TCL_ERROR;
}
Expand Down Expand Up @@ -1361,7 +1361,7 @@ TtyGetOptionProc(
return TCL_OK;
}
return Tcl_BadChannelOption(interp, optionName,
"closemode inputmode mode queue ttystatus winsize xchar");
"closemode inputmode mode queue ttystatus winsize xchar");
}

static const struct {int baud; speed_t speed;} speeds[] = {
Expand Down Expand Up @@ -1707,7 +1707,7 @@ TtyParseMode(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s: should be baud,parity,data,stop", bad));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (void *)NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL);
}
return TCL_ERROR;
}
Expand Down Expand Up @@ -1737,7 +1737,7 @@ TtyParseMode(
"n, o, or e"
#endif /* PAREXT */
));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (void *)NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL);
}
return TCL_ERROR;
}
Expand All @@ -1746,15 +1746,15 @@ TtyParseMode(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s data: should be 5, 6, 7, or 8", bad));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (void *)NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL);
}
return TCL_ERROR;
}
if ((ttyPtr->stop < 0) || (ttyPtr->stop > 2)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s stop: should be 1 or 2", bad));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (void *)NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL);
}
return TCL_ERROR;
}
Expand Down Expand Up @@ -1861,7 +1861,7 @@ TclpOpenFileChannel(
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't open \"",
TclGetString(pathPtr), "\": filename is invalid on this platform",
(void *)NULL);
(char *)NULL);
}
return NULL;
}
Expand Down Expand Up @@ -1990,10 +1990,10 @@ Tcl_MakeFileChannel(
snprintf(channelName, sizeof(channelName), "serial%d", fd);
} else
#endif /* SUPPORTS_TTY */
if ((getsockname(fd, (struct sockaddr *) &sockaddr, &sockaddrLen) == 0)
&& (sockaddrLen > 0)
&& (sockaddr.sa_family == AF_INET
|| sockaddr.sa_family == AF_INET6)) {
if ((getsockname(fd, (struct sockaddr *)&sockaddr, &sockaddrLen) == 0)
&& (sockaddrLen > 0)
&& (sockaddr.sa_family == AF_INET
|| sockaddr.sa_family == AF_INET6)) {
return (Tcl_Channel)TclpMakeTcpClientChannelMode(INT2PTR(fd), mode);
} else {
channelTypePtr = &fileChannelType;
Expand Down Expand Up @@ -2149,13 +2149,13 @@ Tcl_GetOpenFile(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%s\" wasn't opened for writing", chanID));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "CHANNEL", "NOT_WRITABLE",
(void *)NULL);
(char *)NULL);
return TCL_ERROR;
} else if (!forWriting && !(chanMode & TCL_READABLE)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%s\" wasn't opened for reading", chanID));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "CHANNEL", "NOT_READABLE",
(void *)NULL);
(char *)NULL);
return TCL_ERROR;
}

Expand Down Expand Up @@ -2187,7 +2187,7 @@ Tcl_GetOpenFile(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"cannot get a FILE * for \"%s\"", chanID));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "CHANNEL",
"FILE_FAILURE", (void *)NULL);
"FILE_FAILURE", (char *)NULL);
return TCL_ERROR;
}
*filePtr = f;
Expand All @@ -2198,7 +2198,7 @@ Tcl_GetOpenFile(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%s\" cannot be used to get a FILE *", chanID));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "CHANNEL", "NO_DESCRIPTOR",
(void *)NULL);
(char *)NULL);
return TCL_ERROR;
}

Expand Down
2 changes: 1 addition & 1 deletion win/tclWinChan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ TclpOpenFileChannel(
"couldn't open \"%s\": bad file type",
TclGetString(pathPtr)));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "CHANNEL", "BAD_TYPE",
(void *)NULL);
(char *)NULL);
break;
}

Expand Down
10 changes: 5 additions & 5 deletions win/tclWinConsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -2273,15 +2273,15 @@ ConsoleSetOptionProc(
}
return TCL_ERROR;
}
if (Tcl_UtfNcasecmp(value, "NORMAL", vlen) == 0) {
if (strncasecmp(value, "NORMAL", vlen) == 0) {
mode |=
ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
} else if (Tcl_UtfNcasecmp(value, "PASSWORD", vlen) == 0) {
} else if (strncasecmp(value, "PASSWORD", vlen) == 0) {
mode |= ENABLE_LINE_INPUT|ENABLE_PROCESSED_INPUT;
mode &= ~ENABLE_ECHO_INPUT;
} else if (Tcl_UtfNcasecmp(value, "RAW", vlen) == 0) {
} else if (strncasecmp(value, "RAW", vlen) == 0) {
mode &= ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
} else if (Tcl_UtfNcasecmp(value, "RESET", vlen) == 0) {
} else if (strncasecmp(value, "RESET", vlen) == 0) {
/*
* Reset to the initial mode, whatever that is.
*/
Expand All @@ -2292,7 +2292,7 @@ ConsoleSetOptionProc(
"bad mode \"%s\" for -inputmode: must be"
" normal, password, raw, or reset", value));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
"VALUE", (void *)NULL);
"VALUE", (char *)NULL);
}
return TCL_ERROR;
}
Expand Down
Loading

0 comments on commit 7348f9a

Please sign in to comment.