summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-06-26 19:46:07 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-06-26 19:46:07 (GMT)
commit7cb7a44074f18108b2cedbf4496758442149d9d5 (patch)
tree86908a46ea8c83cb7cf1d97b9c8bf6c63f5596db
parent41a740e30c7442449bb73624575c1195493d76d0 (diff)
parent7a9d97826e2df30fcf48191281dede724a99ff43 (diff)
downloadtcl-7cb7a44074f18108b2cedbf4496758442149d9d5.zip
tcl-7cb7a44074f18108b2cedbf4496758442149d9d5.tar.gz
tcl-7cb7a44074f18108b2cedbf4496758442149d9d5.tar.bz2
merge 8.7
-rw-r--r--generic/tclIOSock.c2
-rw-r--r--win/tclWinConsole.c4
-rw-r--r--win/tclWinDde.c31
-rw-r--r--win/tclWinError.c2
-rw-r--r--win/tclWinFile.c18
-rw-r--r--win/tclWinInit.c64
-rw-r--r--win/tclWinPanic.c2
-rw-r--r--win/tclWinPipe.c2
-rw-r--r--win/tclWinReg.c7
9 files changed, 15 insertions, 117 deletions
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c
index 24c26f6..db124fb 100644
--- a/generic/tclIOSock.c
+++ b/generic/tclIOSock.c
@@ -11,7 +11,7 @@
#include "tclInt.h"
-#if defined(_WIN32) && defined(UNICODE)
+#if defined(_WIN32)
/*
* On Windows, we need to do proper Unicode->UTF-8 conversion.
*/
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c
index 92643cf..f8b67a3 100644
--- a/win/tclWinConsole.c
+++ b/win/tclWinConsole.c
@@ -1360,11 +1360,7 @@ TclWinOpenConsoleChannel(
Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto");
Tcl_SetChannelOption(NULL, infoPtr->channel, "-eofchar", "\032 {}");
-#ifdef UNICODE
Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", "unicode");
-#else
- Tcl_SetChannelOption(NULL, infoPtr->channel, "-encoding", encoding);
-#endif
return infoPtr->channel;
}
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index 8b0be8d..59e553b 100644
--- a/win/tclWinDde.c
+++ b/win/tclWinDde.c
@@ -18,15 +18,6 @@
#include <dde.h>
#include <ddeml.h>
-#ifndef UNICODE
-# undef CP_WINUNICODE
-# define CP_WINUNICODE CP_WINANSI
-# undef Tcl_WinTCharToUtf
-# define Tcl_WinTCharToUtf(a,b,c) Tcl_ExternalToUtfDString(NULL,a,b,c)
-# undef Tcl_WinUtfToTChar
-# define Tcl_WinUtfToTChar(a,b,c) Tcl_UtfToExternalDString(NULL,a,b,c)
-#endif
-
#if !defined(NDEBUG)
/* test POKE server Implemented for debug mode only */
# undef CBF_FAIL_POKES
@@ -1432,11 +1423,7 @@ DdeObjCmd(
Initialize();
if (firstArg != 1) {
-#ifdef UNICODE
serviceName = Tcl_GetUnicodeFromObj(objv[firstArg], &length);
-#else
- serviceName = Tcl_GetStringFromObj(objv[firstArg], &length);
-#endif
} else {
length = 0;
}
@@ -1449,11 +1436,7 @@ DdeObjCmd(
}
if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) {
-#ifdef UNICODE
topicName = (TCHAR *) Tcl_GetUnicodeFromObj(objv[firstArg + 1], &length);
-#else
- topicName = Tcl_GetStringFromObj(objv[firstArg + 1], &length);
-#endif
if (length == 0) {
topicName = NULL;
} else {
@@ -1467,11 +1450,7 @@ DdeObjCmd(
serviceName = DdeSetServerName(interp, serviceName, flags,
handlerPtr);
if (serviceName != NULL) {
-#ifdef UNICODE
Tcl_SetObjResult(interp, Tcl_NewUnicodeObj((Tcl_UniChar *) serviceName, -1));
-#else
- Tcl_SetObjResult(interp, Tcl_NewStringObj(serviceName, -1));
-#endif
} else {
Tcl_ResetResult(interp);
}
@@ -1530,13 +1509,8 @@ DdeObjCmd(
break;
}
case DDE_REQUEST: {
-#ifdef UNICODE
const TCHAR *itemString = (TCHAR *) Tcl_GetUnicodeFromObj(objv[firstArg + 2],
&length);
-#else
- const TCHAR *itemString = Tcl_GetStringFromObj(objv[firstArg + 2],
- &length);
-#endif
if (length == 0) {
Tcl_SetObjResult(interp,
@@ -1590,13 +1564,8 @@ DdeObjCmd(
break;
}
case DDE_POKE: {
-#ifdef UNICODE
const TCHAR *itemString = (TCHAR *) Tcl_GetUnicodeFromObj(objv[firstArg + 2],
&length);
-#else
- const TCHAR *itemString = Tcl_GetStringFromObj(objv[firstArg + 2],
- &length);
-#endif
BYTE *dataString;
if (length == 0) {
diff --git a/win/tclWinError.c b/win/tclWinError.c
index ac98cd4..7897ff7 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -391,7 +391,7 @@ tclWinDebugPanic(
if (IsDebuggerPresent()) {
WCHAR msgString[TCL_MAX_WARN_LEN];
- char buf[TCL_MAX_WARN_LEN * TCL_UTF_MAX];
+ char buf[TCL_MAX_WARN_LEN * 3];
vsnprintf(buf, sizeof(buf), format, argList);
msgString[TCL_MAX_WARN_LEN-1] = L'\0';
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 404f81a..9fb8db2 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -567,7 +567,6 @@ WinReadLinkDirectory(
*/
offset = 0;
-#ifdef UNICODE
if (reparseBuffer->MountPointReparseBuffer.PathBuffer[0] == L'\\') {
/*
* Check whether this is a mounted volume.
@@ -629,7 +628,6 @@ WinReadLinkDirectory(
offset = 4;
}
}
-#endif /* UNICODE */
Tcl_WinTCharToUtf((const TCHAR *)
reparseBuffer->MountPointReparseBuffer.PathBuffer,
@@ -800,7 +798,7 @@ tclWinDebugPanic(
{
#define TCL_MAX_WARN_LEN 1024
va_list argList;
- char buf[TCL_MAX_WARN_LEN * TCL_UTF_MAX];
+ char buf[TCL_MAX_WARN_LEN * 3];
WCHAR msgString[TCL_MAX_WARN_LEN];
va_start(argList, format);
@@ -849,19 +847,9 @@ TclpFindExecutable(
* ignore. */
{
WCHAR wName[MAX_PATH];
- char name[MAX_PATH * TCL_UTF_MAX];
+ char name[MAX_PATH * 3];
-#ifdef UNICODE
GetModuleFileNameW(NULL, wName, MAX_PATH);
-#else
- GetModuleFileNameA(NULL, name, sizeof(name));
-
- /*
- * Convert to WCHAR to get out of ANSI codepage
- */
-
- MultiByteToWideChar(CP_ACP, 0, name, -1, wName, MAX_PATH);
-#endif
WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL);
TclWinNoBackslash(name);
TclSetObjNameOfExecutable(Tcl_NewStringObj(name, -1), NULL);
@@ -1626,7 +1614,6 @@ NativeAccess(
* what permissions the OS has set for a file.
*/
-#ifdef UNICODE
{
SECURITY_DESCRIPTOR *sdPtr = NULL;
unsigned long size;
@@ -1789,7 +1776,6 @@ NativeAccess(
}
}
-#endif /* !UNICODE */
return 0;
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 1d17465..a617f60 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -107,12 +107,6 @@ static ProcessGlobalValue sourceLibraryDir =
{0, 0, NULL, NULL, InitializeSourceLibraryDir, NULL, NULL};
static void AppendEnvironment(Tcl_Obj *listPtr, const char *lib);
-
-#if TCL_UTF_MAX < 4
-static void ToUtf(const WCHAR *wSrc, char *dst);
-#else
-#define ToUtf(wSrc, dst) WideCharToMultiByte(CP_UTF8, 0, wSrc, -1, dst, MAX_PATH * TCL_UTF_MAX, NULL, NULL)
-#endif
/*
*---------------------------------------------------------------------------
@@ -262,7 +256,7 @@ AppendEnvironment(
{
int pathc;
WCHAR wBuf[MAX_PATH];
- char buf[MAX_PATH * TCL_UTF_MAX];
+ char buf[MAX_PATH * 3];
Tcl_Obj *objPtr;
Tcl_DString ds;
const char **pathv;
@@ -291,12 +285,8 @@ AppendEnvironment(
* this is a unicode string.
*/
- if (GetEnvironmentVariableW(L"TCL_LIBRARY", wBuf, MAX_PATH) == 0) {
- buf[0] = '\0';
- GetEnvironmentVariableA("TCL_LIBRARY", buf, MAX_PATH);
- } else {
- ToUtf(wBuf, buf);
- }
+ GetEnvironmentVariableW(L"TCL_LIBRARY", wBuf, MAX_PATH);
+ WideCharToMultiByte(CP_UTF8, 0, wBuf, -1, buf, MAX_PATH * 3, NULL, NULL);
if (buf[0] != '\0') {
objPtr = Tcl_NewStringObj(buf, -1);
@@ -355,14 +345,11 @@ InitializeDefaultLibraryDir(
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
- char name[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
+ char name[(MAX_PATH + LIBRARY_SIZE) * 3];
char *end, *p;
- if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) {
- GetModuleFileNameA(hModule, name, MAX_PATH);
- } else {
- ToUtf(wName, name);
- }
+ GetModuleFileNameW(hModule, wName, MAX_PATH);
+ WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, MAX_PATH * 3, NULL, NULL);
end = strrchr(name, '\\');
*end = '\0';
@@ -406,14 +393,11 @@ InitializeSourceLibraryDir(
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
- char name[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
+ char name[(MAX_PATH + LIBRARY_SIZE) * 3];
char *end, *p;
- if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) {
- GetModuleFileNameA(hModule, name, MAX_PATH);
- } else {
- ToUtf(wName, name);
- }
+ GetModuleFileNameW(hModule, wName, MAX_PATH);
+ WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, MAX_PATH * 3, NULL, NULL);
end = strrchr(name, '\\');
*end = '\0';
@@ -434,36 +418,6 @@ InitializeSourceLibraryDir(
/*
*---------------------------------------------------------------------------
*
- * ToUtf --
- *
- * Convert a wchar string to a UTF string.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-#if TCL_UTF_MAX < 4
-static void
-ToUtf(
- const WCHAR *wSrc,
- char *dst)
-{
- while (*wSrc != '\0') {
- dst += Tcl_UniCharToUtf(*wSrc, dst);
- wSrc++;
- }
- *dst = '\0';
-}
-#endif
-
-/*
- *---------------------------------------------------------------------------
- *
* TclpSetInitialEncodings --
*
* Based on the locale, determine the encoding of the operating system
diff --git a/win/tclWinPanic.c b/win/tclWinPanic.c
index 3b9933c..52fa97e 100644
--- a/win/tclWinPanic.c
+++ b/win/tclWinPanic.c
@@ -35,7 +35,7 @@ Tcl_ConsolePanic(
#define TCL_MAX_WARN_LEN 26000
va_list argList;
WCHAR msgString[TCL_MAX_WARN_LEN];
- char buf[TCL_MAX_WARN_LEN * TCL_UTF_MAX];
+ char buf[TCL_MAX_WARN_LEN * 3];
HANDLE handle = GetStdHandle(STD_ERROR_HANDLE);
DWORD dummy;
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index a357412..2155a8d 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -941,7 +941,7 @@ TclpCreateProcess(
PROCESS_INFORMATION procInfo;
SECURITY_ATTRIBUTES secAtts;
HANDLE hProcess, h, inputHandle, outputHandle, errorHandle;
- char execPath[MAX_PATH * TCL_UTF_MAX];
+ char execPath[MAX_PATH * 3];
WinFile *filePtr;
PipeInit();
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index de48b9b..95ab499 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -22,13 +22,6 @@
#endif
#include <stdlib.h>
-#ifndef UNICODE
-# undef Tcl_WinTCharToUtf
-# define Tcl_WinTCharToUtf(a,b,c) Tcl_ExternalToUtfDString(NULL,a,b,c)
-# undef Tcl_WinUtfToTChar
-# define Tcl_WinUtfToTChar(a,b,c) Tcl_UtfToExternalDString(NULL,a,b,c)
-#endif /* !UNICODE */
-
/*
* Ensure that we can say which registry is being accessed.
*/