summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-11 20:56:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-11 20:56:32 (GMT)
commitfd3fca18dbf1180ee000a49bcdc3abc98fb97920 (patch)
tree944f23c4fa8252fea85c5eda4a8f9781d86580ad
parent0bd8e4a634e88f8415e8904c7e5ed4c87a0243af (diff)
parent8e7a963f7fb10cc556337a18a652fd0c78c51029 (diff)
downloadtcl-fd3fca18dbf1180ee000a49bcdc3abc98fb97920.zip
tcl-fd3fca18dbf1180ee000a49bcdc3abc98fb97920.tar.gz
tcl-fd3fca18dbf1180ee000a49bcdc3abc98fb97920.tar.bz2
Merge 8.7
-rw-r--r--generic/tclEncoding.c16
-rw-r--r--generic/tclIOUtil.c2
-rw-r--r--generic/tclStringObj.c2
-rw-r--r--generic/tclStubInit.c4
-rw-r--r--generic/tclZipfs.c2
-rw-r--r--unix/tclUnixChan.c30
-rw-r--r--win/tclWin32Dll.c24
-rw-r--r--win/tclWinChan.c6
-rw-r--r--win/tclWinFCmd.c94
-rw-r--r--win/tclWinFile.c128
-rw-r--r--win/tclWinInit.c8
-rw-r--r--win/tclWinInt.h4
-rw-r--r--win/tclWinPipe.c36
-rw-r--r--win/tclWinPort.h9
-rw-r--r--win/tclWinSerial.c16
-rw-r--r--win/tclWinSock.c4
16 files changed, 192 insertions, 193 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 14efadb..222f11d 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -234,12 +234,12 @@ static int TableToUtfProc(ClientData clientData, const char *src,
char *dst, int dstLen, int *srcReadPtr,
int *dstWrotePtr, int *dstCharsPtr);
static size_t unilen(const char *src);
-static int UnicodeToUtfProc(ClientData clientData,
+static int UniCharToUtfProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
-static int UtfToUnicodeProc(ClientData clientData,
+static int UtfToUniCharProc(ClientData clientData,
const char *src, int srcLen, int flags,
Tcl_EncodingState *statePtr, char *dst, int dstLen,
int *srcReadPtr, int *dstWrotePtr,
@@ -596,8 +596,8 @@ TclInitEncodingSubsystem(void)
Tcl_CreateEncoding(&type);
type.encodingName = "unicode";
- type.toUtfProc = UnicodeToUtfProc;
- type.fromUtfProc = UtfToUnicodeProc;
+ type.toUtfProc = UniCharToUtfProc;
+ type.fromUtfProc = UtfToUniCharProc;
type.freeProc = NULL;
type.nullSize = 2;
type.clientData = NULL;
@@ -2339,7 +2339,7 @@ UtfToUtfProc(
/*
*-------------------------------------------------------------------------
*
- * UnicodeToUtfProc --
+ * UniCharToUtfProc --
*
* Convert from Unicode to UTF-8.
*
@@ -2353,7 +2353,7 @@ UtfToUtfProc(
*/
static int
-UnicodeToUtfProc(
+UniCharToUtfProc(
ClientData clientData, /* Not used. */
const char *src, /* Source string in Unicode. */
int srcLen, /* Source string length in bytes. */
@@ -2429,7 +2429,7 @@ UnicodeToUtfProc(
/*
*-------------------------------------------------------------------------
*
- * UtfToUnicodeProc --
+ * UtfToUniCharProc --
*
* Convert from UTF-8 to Unicode.
*
@@ -2443,7 +2443,7 @@ UnicodeToUtfProc(
*/
static int
-UtfToUnicodeProc(
+UtfToUniCharProc(
ClientData clientData, /* TableEncodingData that specifies
* encoding. */
const char *src, /* Source string in UTF-8. */
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index c366af9..33507ac 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -4700,7 +4700,7 @@ Tcl_FSGetFileSystemForPath(
* Tcl_FSGetNativePath --
*
* This function is for use by the Win/Unix native filesystems, so that
- * they can easily retrieve the native (char* or TCHAR*) representation
+ * they can easily retrieve the native (char* or WCHAR*) representation
* of a path. Other filesystems will probably want to implement similar
* functions. They basically act as a safety net around
* Tcl_FSGetInternalRep. Normally your file-system functions will always
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 2635583..6a0d796 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1944,7 +1944,7 @@ Tcl_AppendFormatToObj(
}
break;
case 'c': {
- char buf[4];
+ char buf[TCL_UTF_MAX] = "";
int code, length;
if (TclGetIntFromObj(interp, segment, &code) != TCL_OK) {
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index b00b233..b9efe22 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -122,7 +122,7 @@ Tcl_WinUtfToTChar(
if (!string) {
return NULL;
}
- return (char *)Tcl_UtfToWCharDString(string, len, dsPtr);
+ return (char *)TclUtfToWCharDString(string, len, dsPtr);
}
char *
@@ -140,7 +140,7 @@ Tcl_WinTCharToUtf(
} else {
len /= 2;
}
- return TclWCharToUtfDString((Tcl_UniChar *)string, len, dsPtr);
+ return TclWCharToUtfDString((const WCHAR *)string, len, dsPtr);
}
#if defined(TCL_WIDE_INT_IS_LONG)
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 2322ba6..c831143 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -4833,7 +4833,7 @@ int
TclZipfs_AppHook(
int *argcPtr, /* Pointer to argc */
#ifdef _WIN32
- TCHAR
+ WCHAR
#else /* !_WIN32 */
char
#endif /* _WIN32 */
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 29fc03e..d76be4e 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -654,17 +654,15 @@ TtySetOptionProc(
*/
if ((len > 1) && (strncmp(optionName, "-xchar", len) == 0)) {
- Tcl_DString ds;
-
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
} else if (argc != 2) {
+ badXchar:
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -xchar: should be a list of"
- " two elements", -1));
- Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FCONFIGURE",
- "VALUE", NULL);
+ " two elements with each a single 8-bit character", -1));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", NULL);
}
Tcl_Free(argv);
return TCL_ERROR;
@@ -672,13 +670,23 @@ TtySetOptionProc(
tcgetattr(fsPtr->fd, &iostate);
- Tcl_UtfToExternalDString(NULL, argv[0], -1, &ds);
- iostate.c_cc[VSTART] = *(const cc_t *) Tcl_DStringValue(&ds);
- TclDStringClear(&ds);
+ iostate.c_cc[VSTART] = argv[0][0];
+ iostate.c_cc[VSTOP] = argv[1][0];
+ if (argv[0][0] & 0x80 || argv[1][0] & 0x80) {
+ Tcl_UniChar character = 0;
+ int charLen;
- Tcl_UtfToExternalDString(NULL, argv[1], -1, &ds);
- iostate.c_cc[VSTOP] = *(const cc_t *) Tcl_DStringValue(&ds);
- Tcl_DStringFree(&ds);
+ charLen = Tcl_UtfToUniChar(argv[0], &character);
+ if ((character > 0xFF) || argv[0][charLen]) {
+ goto badXchar;
+ }
+ iostate.c_cc[VSTART] = character;
+ charLen = Tcl_UtfToUniChar(argv[1], &character);
+ if ((character > 0xFF) || argv[1][charLen]) {
+ goto badXchar;
+ }
+ iostate.c_cc[VSTOP] = character;
+ }
Tcl_Free(argv);
tcsetattr(fsPtr->fd, TCSADRAIN, &iostate);
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index aee41c6..915f9a3 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -46,8 +46,8 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
*/
typedef struct MountPointMap {
- TCHAR *volumeName; /* Native wide string volume name. */
- TCHAR driveLetter; /* Drive letter corresponding to the volume
+ WCHAR *volumeName; /* Native wide string volume name. */
+ WCHAR driveLetter; /* Drive letter corresponding to the volume
* name. */
struct MountPointMap *nextPtr;
/* Pointer to next structure in list, or
@@ -286,11 +286,11 @@ TclWinEncodingsCleanup(void)
char
TclWinDriveLetterForVolMountPoint(
- const TCHAR *mountPoint)
+ const WCHAR *mountPoint)
{
MountPointMap *dlIter, *dlPtr2;
- TCHAR Target[55]; /* Target of mount at mount point */
- TCHAR drive[4] = TEXT("A:\\");
+ WCHAR Target[55]; /* Target of mount at mount point */
+ WCHAR drive[4] = TEXT("A:\\");
/*
* Detect the volume mounted there. Unfortunately, there is no simple way
@@ -301,14 +301,14 @@ TclWinDriveLetterForVolMountPoint(
Tcl_MutexLock(&mountPointMap);
dlIter = driveLetterLookup;
while (dlIter != NULL) {
- if (_tcscmp(dlIter->volumeName, mountPoint) == 0) {
+ if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
/*
* We need to check whether this information is still valid, since
* either the user or various programs could have adjusted the
* mount points on the fly.
*/
- drive[0] = (TCHAR) dlIter->driveLetter;
+ drive[0] = (WCHAR) dlIter->driveLetter;
/*
* Try to read the volume mount point and see where it points.
@@ -316,7 +316,7 @@ TclWinDriveLetterForVolMountPoint(
if (GetVolumeNameForVolumeMountPoint(drive,
Target, 55) != 0) {
- if (_tcscmp(dlIter->volumeName, Target) == 0) {
+ if (wcscmp(dlIter->volumeName, Target) == 0) {
/*
* Nothing has changed.
*/
@@ -379,7 +379,7 @@ TclWinDriveLetterForVolMountPoint(
for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
- if (_tcscmp(dlIter->volumeName, Target) == 0) {
+ if (wcscmp(dlIter->volumeName, Target) == 0) {
alreadyStored = 1;
break;
}
@@ -400,7 +400,7 @@ TclWinDriveLetterForVolMountPoint(
for (dlIter = driveLetterLookup; dlIter != NULL;
dlIter = dlIter->nextPtr) {
- if (_tcscmp(dlIter->volumeName, mountPoint) == 0) {
+ if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
Tcl_MutexUnlock(&mountPointMap);
return (char) dlIter->driveLetter;
}
@@ -447,7 +447,7 @@ TclWinDriveLetterForVolMountPoint(
* nativeBuffer <- UtfToExternal(encoding, utfBuffer);
* Tcl_FreeEncoding(encoding);
*
- * By convention, in Windows a TCHAR is a Unicode character. If you plan
+ * By convention, in Windows a WCHAR is a Unicode character. If you plan
* on targeting a Unicode interface when running on Windows, these
* functions should be used. If you plan on targetting a "char" oriented
* function on Windows, use Tcl_UtfToExternal() with an encoding of NULL.
@@ -463,7 +463,7 @@ TclWinDriveLetterForVolMountPoint(
*---------------------------------------------------------------------------
*/
-TCHAR *
+WCHAR *
Tcl_WinUtfToTChar(
const char *string, /* Source string in UTF-8. */
size_t len, /* Source string length in bytes, or -1
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 421ae50..739d595 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -96,7 +96,7 @@ static void FileThreadActionProc(ClientData instanceData,
static int FileTruncateProc(ClientData instanceData,
Tcl_WideInt length);
static DWORD FileGetType(HANDLE handle);
-static int NativeIsComPort(const TCHAR *nativeName);
+static int NativeIsComPort(const WCHAR *nativeName);
/*
* This structure describes the channel type structure for file based IO.
@@ -849,7 +849,7 @@ TclpOpenFileChannel(
Tcl_Channel channel = 0;
int channelPermissions = 0;
DWORD accessMode = 0, createMode, shareMode, flags;
- const TCHAR *nativeName;
+ const WCHAR *nativeName;
HANDLE handle;
char channelName[16 + TCL_INTEGER_SPACE];
TclFile readFile = NULL, writeFile = NULL;
@@ -1557,7 +1557,7 @@ FileGetType(
static int
NativeIsComPort(
- const TCHAR *nativePath) /* Path of file to access, native encoding. */
+ const WCHAR *nativePath) /* Path of file to access, native encoding. */
{
const WCHAR *p = (const WCHAR *) nativePath;
int i, len = wcslen(p);
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 1465549..e3aca91 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -71,7 +71,7 @@ const TclFileAttrProcs tclpFileAttrProcs[] = {
* Prototype for the TraverseWinTree callback function.
*/
-typedef int (TraversalProc)(const TCHAR *srcPtr, const TCHAR *dstPtr,
+typedef int (TraversalProc)(const WCHAR *srcPtr, const WCHAR *dstPtr,
int type, Tcl_DString *errorPtr);
/*
@@ -82,18 +82,18 @@ static void StatError(Tcl_Interp *interp, Tcl_Obj *fileName);
static int ConvertFileNameFormat(Tcl_Interp *interp,
int objIndex, Tcl_Obj *fileName, int longShort,
Tcl_Obj **attributePtrPtr);
-static int DoCopyFile(const TCHAR *srcPtr, const TCHAR *dstPtr);
-static int DoCreateDirectory(const TCHAR *pathPtr);
-static int DoRemoveJustDirectory(const TCHAR *nativeSrc,
+static int DoCopyFile(const WCHAR *srcPtr, const WCHAR *dstPtr);
+static int DoCreateDirectory(const WCHAR *pathPtr);
+static int DoRemoveJustDirectory(const WCHAR *nativeSrc,
int ignoreError, Tcl_DString *errorPtr);
static int DoRemoveDirectory(Tcl_DString *pathPtr, int recursive,
Tcl_DString *errorPtr);
-static int DoRenameFile(const TCHAR *nativeSrc,
- const TCHAR *dstPtr);
-static int TraversalCopy(const TCHAR *srcPtr, const TCHAR *dstPtr,
+static int DoRenameFile(const WCHAR *nativeSrc,
+ const WCHAR *dstPtr);
+static int TraversalCopy(const WCHAR *srcPtr, const WCHAR *dstPtr,
int type, Tcl_DString *errorPtr);
-static int TraversalDelete(const TCHAR *srcPtr,
- const TCHAR *dstPtr, int type,
+static int TraversalDelete(const WCHAR *srcPtr,
+ const WCHAR *dstPtr, int type,
Tcl_DString *errorPtr);
static int TraverseWinTree(TraversalProc *traverseProc,
Tcl_DString *sourcePtr, Tcl_DString *dstPtr,
@@ -151,9 +151,9 @@ TclpObjRenameFile(
static int
DoRenameFile(
- const TCHAR *nativeSrc, /* Pathname of file or dir to be renamed
+ const WCHAR *nativeSrc, /* Pathname of file or dir to be renamed
* (native). */
- const TCHAR *nativeDst) /* New pathname for file or directory
+ const WCHAR *nativeDst) /* New pathname for file or directory
* (native). */
{
#if defined(HAVE_NO_SEH) && !defined(_WIN64)
@@ -307,11 +307,11 @@ DoRenameFile(
if (errno == EACCES) {
decode:
if (srcAttr & FILE_ATTRIBUTE_DIRECTORY) {
- TCHAR *nativeSrcRest, *nativeDstRest;
+ WCHAR *nativeSrcRest, *nativeDstRest;
const char **srcArgv, **dstArgv;
int size, srcArgc, dstArgc;
- TCHAR nativeSrcPath[MAX_PATH];
- TCHAR nativeDstPath[MAX_PATH];
+ WCHAR nativeSrcPath[MAX_PATH];
+ WCHAR nativeDstPath[MAX_PATH];
Tcl_DString srcString, dstString;
const char *src, *dst;
@@ -445,20 +445,20 @@ DoRenameFile(
* back to old name.
*/
- TCHAR *nativeRest, *nativeTmp, *nativePrefix;
+ WCHAR *nativeRest, *nativeTmp, *nativePrefix;
int result, size;
- TCHAR tempBuf[MAX_PATH];
+ WCHAR tempBuf[MAX_PATH];
size = GetFullPathName(nativeDst, MAX_PATH,
tempBuf, &nativeRest);
if ((size == 0) || (size > MAX_PATH) || (nativeRest == NULL)) {
return TCL_ERROR;
}
- nativeTmp = (TCHAR *) tempBuf;
+ nativeTmp = (WCHAR *) tempBuf;
nativeRest[0] = L'\0';
result = TCL_ERROR;
- nativePrefix = (TCHAR *) L"tclr";
+ nativePrefix = (WCHAR *) L"tclr";
if (GetTempFileName(nativeTmp, nativePrefix,
0, tempBuf) != 0) {
/*
@@ -540,8 +540,8 @@ TclpObjCopyFile(
static int
DoCopyFile(
- const TCHAR *nativeSrc, /* Pathname of file to be copied (native). */
- const TCHAR *nativeDst) /* Pathname of file to copy to (native). */
+ const WCHAR *nativeSrc, /* Pathname of file to be copied (native). */
+ const WCHAR *nativeDst) /* Pathname of file to copy to (native). */
{
#if defined(HAVE_NO_SEH) && !defined(_WIN64)
TCLEXCEPTION_REGISTRATION registration;
@@ -749,7 +749,7 @@ TclpDeleteFile(
const void *nativePath) /* Pathname of file to be removed (native). */
{
DWORD attr;
- const TCHAR *path = nativePath;
+ const WCHAR *path = nativePath;
/*
* The DeleteFile API acts differently under Win95/98 and NT WRT NULL and
@@ -859,7 +859,7 @@ TclpObjCreateDirectory(
static int
DoCreateDirectory(
- const TCHAR *nativePath) /* Pathname of directory to create (native). */
+ const WCHAR *nativePath) /* Pathname of directory to create (native). */
{
if (CreateDirectory(nativePath, NULL) == 0) {
DWORD error = GetLastError();
@@ -1009,7 +1009,7 @@ TclpObjRemoveDirectory(
static int
DoRemoveJustDirectory(
- const TCHAR *nativePath, /* Pathname of directory to be removed
+ const WCHAR *nativePath, /* Pathname of directory to be removed
* (native). */
int ignoreError, /* If non-zero, don't initialize the errorPtr
* under some circumstances on return. */
@@ -1129,7 +1129,7 @@ DoRemoveDirectory(
* filled with UTF-8 name of file causing
* error. */
{
- int res = DoRemoveJustDirectory((const TCHAR *)Tcl_DStringValue(pathPtr), recursive,
+ int res = DoRemoveJustDirectory((const WCHAR *)Tcl_DStringValue(pathPtr), recursive,
errorPtr);
if ((res == TCL_ERROR) && (recursive != 0) && (Tcl_GetErrno() == EEXIST)) {
@@ -1180,7 +1180,7 @@ TraverseWinTree(
* error. */
{
DWORD sourceAttr;
- TCHAR *nativeSource, *nativeTarget, *nativeErrfile;
+ WCHAR *nativeSource, *nativeTarget, *nativeErrfile;
int result, found, sourceLen, targetLen = 0, oldSourceLen, oldTargetLen;
HANDLE handle;
WIN32_FIND_DATA data;
@@ -1189,8 +1189,8 @@ TraverseWinTree(
result = TCL_OK;
oldTargetLen = 0; /* lint. */
- nativeSource = (TCHAR *) Tcl_DStringValue(sourcePtr);
- nativeTarget = (TCHAR *)
+ nativeSource = (WCHAR *) Tcl_DStringValue(sourcePtr);
+ nativeTarget = (WCHAR *)
(targetPtr == NULL ? NULL : Tcl_DStringValue(targetPtr));
oldSourceLen = Tcl_DStringLength(sourcePtr);
@@ -1217,10 +1217,10 @@ TraverseWinTree(
return traverseProc(nativeSource, nativeTarget, DOTREE_F, errorPtr);
}
- Tcl_DStringAppend(sourcePtr, (char *) TEXT("\\*.*"), 4 * sizeof(TCHAR) + 1);
+ Tcl_DStringAppend(sourcePtr, (char *) L"\\*.*", 4 * sizeof(WCHAR) + 1);
Tcl_DStringSetLength(sourcePtr, Tcl_DStringLength(sourcePtr) - 1);
- nativeSource = (TCHAR *) Tcl_DStringValue(sourcePtr);
+ nativeSource = (WCHAR *) Tcl_DStringValue(sourcePtr);
handle = FindFirstFile(nativeSource, &data);
if (handle == INVALID_HANDLE_VALUE) {
/*
@@ -1241,24 +1241,24 @@ TraverseWinTree(
return result;
}
- sourceLen = oldSourceLen + sizeof(TCHAR);
- Tcl_DStringAppend(sourcePtr, (char *) TEXT("\\"), sizeof(TCHAR) + 1);
+ sourceLen = oldSourceLen + sizeof(WCHAR);
+ Tcl_DStringAppend(sourcePtr, (char *) L"\\", sizeof(WCHAR) + 1);
Tcl_DStringSetLength(sourcePtr, sourceLen);
if (targetPtr != NULL) {
oldTargetLen = Tcl_DStringLength(targetPtr);
targetLen = oldTargetLen;
- targetLen += sizeof(TCHAR);
- Tcl_DStringAppend(targetPtr, (char *) TEXT("\\"), sizeof(TCHAR) + 1);
+ targetLen += sizeof(WCHAR);
+ Tcl_DStringAppend(targetPtr, (char *) L"\\", sizeof(WCHAR) + 1);
Tcl_DStringSetLength(targetPtr, targetLen);
}
found = 1;
for (; found; found = FindNextFile(handle, &data)) {
- TCHAR *nativeName;
+ WCHAR *nativeName;
int len;
- TCHAR *wp = data.cFileName;
+ WCHAR *wp = data.cFileName;
if (*wp == '.') {
wp++;
if (*wp == '.') {
@@ -1268,8 +1268,8 @@ TraverseWinTree(
continue;
}
}
- nativeName = (TCHAR *) data.cFileName;
- len = _tcslen(data.cFileName) * sizeof(TCHAR);
+ nativeName = (WCHAR *) data.cFileName;
+ len = wcslen(data.cFileName) * sizeof(WCHAR);
/*
* Append name after slash, and recurse on the file.
@@ -1314,8 +1314,8 @@ TraverseWinTree(
* files in that directory.
*/
- result = traverseProc((const TCHAR *)Tcl_DStringValue(sourcePtr),
- (const TCHAR *)(targetPtr == NULL ? NULL : Tcl_DStringValue(targetPtr)),
+ result = traverseProc((const WCHAR *)Tcl_DStringValue(sourcePtr),
+ (const WCHAR *)(targetPtr == NULL ? NULL : Tcl_DStringValue(targetPtr)),
DOTREE_POSTD, errorPtr);
}
@@ -1350,8 +1350,8 @@ TraverseWinTree(
static int
TraversalCopy(
- const TCHAR *nativeSrc, /* Source pathname to copy. */
- const TCHAR *nativeDst, /* Destination pathname of copy. */
+ const WCHAR *nativeSrc, /* Source pathname to copy. */
+ const WCHAR *nativeDst, /* Destination pathname of copy. */
int type, /* Reason for call - see TraverseWinTree() */
Tcl_DString *errorPtr) /* If non-NULL, initialized DString filled
* with UTF-8 name of file causing error. */
@@ -1416,8 +1416,8 @@ TraversalCopy(
static int
TraversalDelete(
- const TCHAR *nativeSrc, /* Source pathname to delete. */
- const TCHAR *dstPtr, /* Not used. */
+ const WCHAR *nativeSrc, /* Source pathname to delete. */
+ const WCHAR *dstPtr, /* Not used. */
int type, /* Reason for call - see TraverseWinTree() */
Tcl_DString *errorPtr) /* If non-NULL, initialized DString filled
* with UTF-8 name of file causing error. */
@@ -1503,7 +1503,7 @@ GetWinFileAttributes(
Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */
{
DWORD result;
- const TCHAR *nativeName;
+ const WCHAR *nativeName;
int attr;
nativeName = Tcl_FSGetNativePath(fileName);
@@ -1636,7 +1636,7 @@ ConvertFileNameFormat(
Tcl_Obj *tempPath;
Tcl_DString ds;
Tcl_DString dsTemp;
- const TCHAR *nativeName;
+ const WCHAR *nativeName;
const char *tempString;
WIN32_FIND_DATA data;
HANDLE handle;
@@ -1683,7 +1683,7 @@ ConvertFileNameFormat(
}
} else {
if (data.cAlternateFileName[0] == '\0') {
- nativeName = (TCHAR *) data.cFileName;
+ nativeName = (WCHAR *) data.cFileName;
}
}
@@ -1829,7 +1829,7 @@ SetWinFileAttributes(
{
DWORD fileAttributes, old;
int yesNo, result;
- const TCHAR *nativeName;
+ const WCHAR *nativeName;
nativeName = Tcl_FSGetNativePath(fileName);
fileAttributes = old = GetFileAttributes(nativeName);
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 6a48c13..bc5df72 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -156,27 +156,27 @@ static void FromCTime(time_t posixTime, FILETIME *fileTime);
* Declarations for local functions defined in this file:
*/
-static int NativeAccess(const TCHAR *path, int mode);
-static int NativeDev(const TCHAR *path);
-static int NativeStat(const TCHAR *path, Tcl_StatBuf *statPtr,
+static int NativeAccess(const WCHAR *path, int mode);
+static int NativeDev(const WCHAR *path);
+static int NativeStat(const WCHAR *path, Tcl_StatBuf *statPtr,
int checkLinks);
static unsigned short NativeStatMode(DWORD attr, int checkLinks,
int isExec);
-static int NativeIsExec(const TCHAR *path);
-static int NativeReadReparse(const TCHAR *LinkDirectory,
+static int NativeIsExec(const WCHAR *path);
+static int NativeReadReparse(const WCHAR *LinkDirectory,
REPARSE_DATA_BUFFER *buffer, DWORD desiredAccess);
-static int NativeWriteReparse(const TCHAR *LinkDirectory,
+static int NativeWriteReparse(const WCHAR *LinkDirectory,
REPARSE_DATA_BUFFER *buffer);
static int NativeMatchType(int isDrive, DWORD attr,
- const TCHAR *nativeName, Tcl_GlobTypeData *types);
+ const WCHAR *nativeName, Tcl_GlobTypeData *types);
static int WinIsDrive(const char *name, size_t nameLen);
static int WinIsReserved(const char *path);
-static Tcl_Obj * WinReadLink(const TCHAR *LinkSource);
-static Tcl_Obj * WinReadLinkDirectory(const TCHAR *LinkDirectory);
-static int WinLink(const TCHAR *LinkSource,
- const TCHAR *LinkTarget, int linkAction);
-static int WinSymLinkDirectory(const TCHAR *LinkDirectory,
- const TCHAR *LinkTarget);
+static Tcl_Obj * WinReadLink(const WCHAR *LinkSource);
+static Tcl_Obj * WinReadLinkDirectory(const WCHAR *LinkDirectory);
+static int WinLink(const WCHAR *LinkSource,
+ const WCHAR *LinkTarget, int linkAction);
+static int WinSymLinkDirectory(const WCHAR *LinkDirectory,
+ const WCHAR *LinkTarget);
MODULE_SCOPE void tclWinDebugPanic(const char *format, ...);
/*
@@ -191,12 +191,12 @@ MODULE_SCOPE void tclWinDebugPanic(const char *format, ...);
static int
WinLink(
- const TCHAR *linkSourcePath,
- const TCHAR *linkTargetPath,
+ const WCHAR *linkSourcePath,
+ const WCHAR *linkTargetPath,
int linkAction)
{
- TCHAR tempFileName[MAX_PATH];
- TCHAR *tempFilePart;
+ WCHAR tempFileName[MAX_PATH];
+ WCHAR *tempFilePart;
DWORD attr;
/*
@@ -306,10 +306,10 @@ WinLink(
static Tcl_Obj *
WinReadLink(
- const TCHAR *linkSourcePath)
+ const WCHAR *linkSourcePath)
{
- TCHAR tempFileName[MAX_PATH];
- TCHAR *tempFilePart;
+ WCHAR tempFileName[MAX_PATH];
+ WCHAR *tempFilePart;
DWORD attr;
/*
@@ -370,8 +370,8 @@ WinReadLink(
static int
WinSymLinkDirectory(
- const TCHAR *linkDirPath,
- const TCHAR *linkTargetPath)
+ const WCHAR *linkDirPath,
+ const WCHAR *linkTargetPath)
{
DUMMY_REPARSE_BUFFER dummy;
REPARSE_DATA_BUFFER *reparseBuffer = (REPARSE_DATA_BUFFER *) &dummy;
@@ -442,8 +442,8 @@ WinSymLinkDirectory(
int
TclWinSymLinkCopyDirectory(
- const TCHAR *linkOrigPath, /* Existing junction - reparse point */
- const TCHAR *linkCopyPath) /* Will become a duplicate junction */
+ const WCHAR *linkOrigPath, /* Existing junction - reparse point */
+ const WCHAR *linkCopyPath) /* Will become a duplicate junction */
{
DUMMY_REPARSE_BUFFER dummy;
REPARSE_DATA_BUFFER *reparseBuffer = (REPARSE_DATA_BUFFER *) &dummy;
@@ -473,7 +473,7 @@ TclWinSymLinkCopyDirectory(
int
TclWinSymLinkDelete(
- const TCHAR *linkOrigPath,
+ const WCHAR *linkOrigPath,
int linkOnly)
{
/*
@@ -538,7 +538,7 @@ TclWinSymLinkDelete(
static Tcl_Obj *
WinReadLinkDirectory(
- const TCHAR *linkDirPath)
+ const WCHAR *linkDirPath)
{
int attr, len, offset;
DUMMY_REPARSE_BUFFER dummy;
@@ -634,9 +634,9 @@ WinReadLinkDirectory(
}
}
- Tcl_WinTCharToUtf((const TCHAR *)
+ Tcl_WinTCharToUtf(
reparseBuffer->MountPointReparseBuffer.PathBuffer,
- (int) reparseBuffer->MountPointReparseBuffer
+ reparseBuffer->MountPointReparseBuffer
.SubstituteNameLength, &ds);
copy = Tcl_DStringValue(&ds)+offset;
@@ -673,7 +673,7 @@ WinReadLinkDirectory(
static int
NativeReadReparse(
- const TCHAR *linkDirPath, /* The junction to read */
+ const WCHAR *linkDirPath, /* The junction to read */
REPARSE_DATA_BUFFER *buffer,/* Pointer to buffer. Cannot be NULL */
DWORD desiredAccess)
{
@@ -729,7 +729,7 @@ NativeReadReparse(
static int
NativeWriteReparse(
- const TCHAR *linkDirPath,
+ const WCHAR *linkDirPath,
REPARSE_DATA_BUFFER *buffer)
{
HANDLE hFile;
@@ -893,7 +893,7 @@ TclpMatchInDirectory(
* May be NULL. In particular the directory
* flag is very important. */
{
- const TCHAR *native;
+ const WCHAR *native;
if (types != NULL && types->type == TCL_GLOB_TYPE_MOUNT) {
/*
@@ -1293,7 +1293,7 @@ NativeMatchType(
int isDrive, /* Is this a drive. */
DWORD attr, /* We already know the attributes for the
* file. */
- const TCHAR *nativeName, /* Native path to check. */
+ const WCHAR *nativeName, /* Native path to check. */
Tcl_GlobTypeData *types) /* Type description to match against. */
{
/*
@@ -1542,7 +1542,7 @@ TclpGetUserHome(
static int
NativeAccess(
- const TCHAR *nativePath, /* Path of file to access, native encoding. */
+ const WCHAR *nativePath, /* Path of file to access, native encoding. */
int mode) /* Permission setting. */
{
DWORD attr;
@@ -1804,9 +1804,9 @@ NativeAccess(
static int
NativeIsExec(
- const TCHAR *path)
+ const WCHAR *path)
{
- int len = _tcslen(path);
+ int len = wcslen(path);
if (len < 5) {
return 0;
@@ -1817,11 +1817,11 @@ NativeIsExec(
}
path += len-3;
- if ((_tcsicmp(path, TEXT("exe")) == 0)
- || (_tcsicmp(path, TEXT("com")) == 0)
- || (_tcsicmp(path, TEXT("cmd")) == 0)
- || (_tcsicmp(path, TEXT("cmd")) == 0)
- || (_tcsicmp(path, TEXT("bat")) == 0)) {
+ if ((wcsicmp(path, L"exe") == 0)
+ || (wcsicmp(path, L"com") == 0)
+ || (wcsicmp(path, L"cmd") == 0)
+ || (wcsicmp(path, L"cmd") == 0)
+ || (wcsicmp(path, L"bat") == 0)) {
return 1;
}
return 0;
@@ -1848,7 +1848,7 @@ TclpObjChdir(
Tcl_Obj *pathPtr) /* Path to new working directory. */
{
int result;
- const TCHAR *nativePath;
+ const WCHAR *nativePath;
nativePath = Tcl_FSGetNativePath(pathPtr);
@@ -1892,7 +1892,7 @@ TclpGetCwd(
Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
* name of current directory. */
{
- TCHAR buffer[MAX_PATH];
+ WCHAR buffer[MAX_PATH];
char *p;
WCHAR *native;
@@ -1915,7 +1915,7 @@ TclpGetCwd(
&& (native[2] == '\\') && (native[3] == '\\')) {
native += 2;
}
- Tcl_WinTCharToUtf((TCHAR *) native, -1, bufferPtr);
+ Tcl_WinTCharToUtf(native, -1, bufferPtr);
/*
* Convert to forward slashes for easier use in scripts.
@@ -1970,7 +1970,7 @@ TclpObjStat(
static int
NativeStat(
- const TCHAR *nativePath, /* Path of file to stat */
+ const WCHAR *nativePath, /* Path of file to stat */
Tcl_StatBuf *statPtr, /* Filled with results of stat call. */
int checkLinks) /* If non-zero, behave like 'lstat' */
{
@@ -2111,12 +2111,12 @@ NativeStat(
static int
NativeDev(
- const TCHAR *nativePath) /* Full path of file to stat */
+ const WCHAR *nativePath) /* Full path of file to stat */
{
int dev;
Tcl_DString ds;
- TCHAR nativeFullPath[MAX_PATH];
- TCHAR *nativePart;
+ WCHAR nativeFullPath[MAX_PATH];
+ WCHAR *nativePart;
const char *fullPath;
GetFullPathName(nativePath, MAX_PATH, nativeFullPath, &nativePart);
@@ -2125,7 +2125,7 @@ NativeDev(
if ((fullPath[0] == '\\') && (fullPath[1] == '\\')) {
const char *p;
DWORD dw;
- const TCHAR *nativeVol;
+ const WCHAR *nativeVol;
Tcl_DString volString;
p = strchr(fullPath + 2, '\\');
@@ -2287,7 +2287,7 @@ ClientData
TclpGetNativeCwd(
ClientData clientData)
{
- TCHAR buffer[MAX_PATH];
+ WCHAR buffer[MAX_PATH];
if (GetCurrentDirectory(MAX_PATH, buffer) == 0) {
TclWinConvertError(GetLastError());
@@ -2295,7 +2295,7 @@ TclpGetNativeCwd(
}
if (clientData != NULL) {
- if (_tcscmp((const TCHAR*)clientData, buffer) == 0) {
+ if (wcscmp((const WCHAR*)clientData, buffer) == 0) {
return clientData;
}
}
@@ -2336,8 +2336,8 @@ TclpObjLink(
{
if (toPtr != NULL) {
int res;
- const TCHAR *LinkTarget;
- const TCHAR *LinkSource = Tcl_FSGetNativePath(pathPtr);
+ const WCHAR *LinkTarget;
+ const WCHAR *LinkSource = Tcl_FSGetNativePath(pathPtr);
Tcl_Obj *normalizedToPtr = Tcl_FSGetNormalizedPath(NULL, toPtr);
if (normalizedToPtr == NULL) {
@@ -2356,7 +2356,7 @@ TclpObjLink(
return NULL;
}
} else {
- const TCHAR *LinkSource = Tcl_FSGetNativePath(pathPtr);
+ const WCHAR *LinkSource = Tcl_FSGetNativePath(pathPtr);
if (LinkSource == NULL) {
return NULL;
@@ -2390,7 +2390,7 @@ TclpFilesystemPathType(
{
#define VOL_BUF_SIZE 32
int found;
- TCHAR volType[VOL_BUF_SIZE];
+ WCHAR volType[VOL_BUF_SIZE];
char *firstSeparator;
const char *path;
Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr);
@@ -2491,7 +2491,7 @@ TclpObjNormalizePath(
*/
WIN32_FILE_ATTRIBUTE_DATA data;
- const TCHAR *nativePath = Tcl_WinUtfToTChar(path,
+ const WCHAR *nativePath = Tcl_WinUtfToTChar(path,
currentPathEndPosition - path, &ds);
if (GetFileAttributesEx(nativePath,
@@ -2634,8 +2634,8 @@ TclpObjNormalizePath(
Tcl_DStringAppend(&dsNorm, ((const char *)nativePath)
+ Tcl_DStringLength(&ds)
- - (dotLen * sizeof(TCHAR)),
- (int)(dotLen * sizeof(TCHAR)));
+ - (dotLen * sizeof(WCHAR)),
+ dotLen * sizeof(WCHAR));
} else {
/*
* Normal path.
@@ -2693,10 +2693,10 @@ TclpObjNormalizePath(
if (1) {
WCHAR wpath[MAX_PATH];
- const TCHAR *nativePath =
+ const WCHAR *nativePath =
Tcl_WinUtfToTChar(path, lastValidPathEnd - path, &ds);
DWORD wpathlen = GetLongPathNameProc(nativePath,
- (TCHAR *) wpath, MAX_PATH);
+ (WCHAR *) wpath, MAX_PATH);
/*
* We have to make the drive letter uppercase.
@@ -2724,7 +2724,7 @@ TclpObjNormalizePath(
* native encoding, so we have to convert it to Utf.
*/
- Tcl_WinTCharToUtf((const TCHAR *) Tcl_DStringValue(&dsNorm),
+ Tcl_WinTCharToUtf((const WCHAR *) Tcl_DStringValue(&dsNorm),
Tcl_DStringLength(&dsNorm), &ds);
nextCheckpoint = Tcl_DStringLength(&ds);
if (*lastValidPathEnd != 0) {
@@ -2900,7 +2900,7 @@ TclpNativeToNormalized(
size_t len;
char *copy, *p;
- Tcl_WinTCharToUtf((const TCHAR *) clientData, -1, &ds);
+ Tcl_WinTCharToUtf((const WCHAR *) clientData, -1, &ds);
copy = Tcl_DStringValue(&ds);
len = Tcl_DStringLength(&ds);
@@ -3092,7 +3092,7 @@ TclNativeDupInternalRep(
return NULL;
}
- len = sizeof(TCHAR) * (_tcslen((const TCHAR *) clientData) + 1);
+ len = sizeof(WCHAR) * (wcslen((const WCHAR *) clientData) + 1);
copy = Tcl_Alloc(len);
memcpy(copy, clientData, len);
@@ -3123,7 +3123,7 @@ TclpUtime(
{
int res = 0;
HANDLE fileHandle;
- const TCHAR *native;
+ const WCHAR *native;
DWORD attr = 0;
DWORD flags = FILE_ATTRIBUTE_NORMAL;
FILETIME lastAccessTime, lastModTime;
@@ -3174,7 +3174,7 @@ int
TclWinFileOwned(
Tcl_Obj *pathPtr) /* File whose ownership is to be checked */
{
- const TCHAR *native;
+ const WCHAR *native;
PSID ownerSid = NULL;
PSECURITY_DESCRIPTOR secd = NULL;
HANDLE token;
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index a9d6abc..b2c8aaa 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -155,7 +155,7 @@ TclpInitPlatform(void)
/*
* Fill available functions depending on windows version
*/
- handle = GetModuleHandle(TEXT("KERNEL32"));
+ handle = GetModuleHandle(L"KERNEL32");
tclWinProcs.cancelSynchronousIo =
(BOOL (WINAPI *)(HANDLE)) GetProcAddress(handle,
"CancelSynchronousIo");
@@ -469,14 +469,14 @@ TclpGetUserName(
Tcl_DStringInit(bufferPtr);
if (TclGetEnv("USERNAME", bufferPtr) == NULL) {
- TCHAR szUserName[UNLEN+1];
+ WCHAR szUserName[UNLEN+1];
DWORD cchUserNameLen = UNLEN;
if (!GetUserName(szUserName, &cchUserNameLen)) {
return NULL;
}
cchUserNameLen--;
- cchUserNameLen *= sizeof(TCHAR);
+ cchUserNameLen *= sizeof(WCHAR);
Tcl_WinTCharToUtf(szUserName, cchUserNameLen, bufferPtr);
}
return Tcl_DStringValue(bufferPtr);
@@ -517,7 +517,7 @@ TclpSetVariables(
TclGetProcessGlobalValue(&defaultLibraryDir), TCL_GLOBAL_ONLY);
if (!osInfoInitialized) {
- HMODULE handle = GetModuleHandle(TEXT("NTDLL"));
+ HMODULE handle = GetModuleHandle(L"NTDLL");
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *)) GetProcAddress(handle, "RtlGetVersion");
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 0e7a44f..a12ed16 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -46,7 +46,7 @@ MODULE_SCOPE TclWinProcs tclWinProcs;
*/
MODULE_SCOPE char TclWinDriveLetterForVolMountPoint(
- const TCHAR *mountPoint);
+ const WCHAR *mountPoint);
MODULE_SCOPE void TclWinEncodingsCleanup();
MODULE_SCOPE void TclWinInit(HINSTANCE hInst);
MODULE_SCOPE TclFile TclWinMakeFile(HANDLE handle);
@@ -56,7 +56,7 @@ MODULE_SCOPE Tcl_Channel TclWinOpenFileChannel(HANDLE handle, char *channelName,
int permissions, int appendMode);
MODULE_SCOPE Tcl_Channel TclWinOpenSerialChannel(HANDLE handle,
char *channelName, int permissions);
-MODULE_SCOPE HANDLE TclWinSerialOpen(HANDLE handle, const TCHAR *name,
+MODULE_SCOPE HANDLE TclWinSerialOpen(HANDLE handle, const WCHAR *name,
DWORD access);
MODULE_SCOPE int TclWinSymLinkCopyDirectory(const TCHAR *LinkOriginal,
const TCHAR *LinkCopy);
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 6f86b95..ffa3fbf 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -191,7 +191,7 @@ static DWORD WINAPI PipeReaderThread(LPVOID arg);
static void PipeSetupProc(ClientData clientData, int flags);
static void PipeWatchProc(ClientData instanceData, int mask);
static DWORD WINAPI PipeWriterThread(LPVOID arg);
-static int TempFileName(TCHAR name[MAX_PATH]);
+static int TempFileName(WCHAR name[MAX_PATH]);
static int WaitForRead(PipeInfo *infoPtr, int blocking);
static void PipeThreadActionProc(ClientData instanceData,
int action);
@@ -463,10 +463,10 @@ TclWinMakeFile(
static int
TempFileName(
- TCHAR name[MAX_PATH]) /* Buffer in which name for temporary file
+ WCHAR name[MAX_PATH]) /* Buffer in which name for temporary file
* gets stored. */
{
- const TCHAR *prefix = TEXT("TCL");
+ const WCHAR *prefix = L"TCL";
if (GetTempPath(MAX_PATH, name) != 0) {
if (GetTempFileName(name, prefix, 0, name) != 0) {
return 1;
@@ -533,7 +533,7 @@ TclpOpenFile(
HANDLE handle;
DWORD accessMode, createMode, shareMode, flags;
Tcl_DString ds;
- const TCHAR *nativePath;
+ const WCHAR *nativePath;
/*
* Map the access bits to the NT access mode.
@@ -650,7 +650,7 @@ TclFile
TclpCreateTempFile(
const char *contents) /* String to write into temp file, or NULL. */
{
- TCHAR name[MAX_PATH];
+ WCHAR name[MAX_PATH];
const char *native;
Tcl_DString dstring;
HANDLE handle;
@@ -744,7 +744,7 @@ TclpCreateTempFile(
Tcl_Obj *
TclpTempFileName(void)
{
- TCHAR fileName[MAX_PATH];
+ WCHAR fileName[MAX_PATH];
if (TempFileName(fileName) == 0) {
return NULL;
@@ -936,7 +936,7 @@ TclpCreateProcess(
* process. */
{
int result, applType, createFlags;
- Tcl_DString cmdLine; /* Complete command line (TCHAR). */
+ Tcl_DString cmdLine; /* Complete command line (WCHAR). */
STARTUPINFO startInfo;
PROCESS_INFORMATION procInfo;
SECURITY_ATTRIBUTES secAtts;
@@ -1048,7 +1048,7 @@ TclpCreateProcess(
* sink.
*/
- startInfo.hStdOutput = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0,
+ startInfo.hStdOutput = CreateFile(L"NUL:", GENERIC_WRITE, 0,
&secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
} else {
DuplicateHandle(hProcess, outputHandle, hProcess,
@@ -1068,7 +1068,7 @@ TclpCreateProcess(
* sink.
*/
- startInfo.hStdError = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0,
+ startInfo.hStdError = CreateFile(L"NUL:", GENERIC_WRITE, 0,
&secAtts, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
} else {
DuplicateHandle(hProcess, errorHandle, hProcess, &startInfo.hStdError,
@@ -1134,7 +1134,7 @@ TclpCreateProcess(
BuildCommandLine(execPath, argc, argv, &cmdLine);
- if (CreateProcess(NULL, (TCHAR *) Tcl_DStringValue(&cmdLine),
+ if (CreateProcess(NULL, (WCHAR *) Tcl_DStringValue(&cmdLine),
NULL, NULL, TRUE, (DWORD) createFlags, NULL, NULL, &startInfo,
&procInfo) == 0) {
TclWinConvertError(GetLastError());
@@ -1260,14 +1260,14 @@ ApplicationType(
{
int applType, i, nameLen, found;
HANDLE hFile;
- TCHAR *rest;
+ WCHAR *rest;
char *ext;
char buf[2];
DWORD attr, read;
IMAGE_DOS_HEADER header;
Tcl_DString nameBuf, ds;
- const TCHAR *nativeName;
- TCHAR nativeFullPath[MAX_PATH];
+ const WCHAR *nativeName;
+ WCHAR nativeFullPath[MAX_PATH];
static const char extensions[][5] = {"", ".com", ".exe", ".bat", ".cmd"};
/*
@@ -1512,7 +1512,7 @@ BuildCommandLine(
int argc, /* Number of arguments. */
const char **argv, /* Argument strings in UTF. */
Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the
- * command line (TCHAR). */
+ * command line (WCHAR). */
{
const char *arg, *start, *special, *bspos;
int quote = 0, i;
@@ -3101,7 +3101,7 @@ TclpOpenTemporaryFile(
Tcl_Obj *extensionObj,
Tcl_Obj *resultingNameObj)
{
- TCHAR name[MAX_PATH];
+ WCHAR name[MAX_PATH];
char *namePtr;
HANDLE handle;
DWORD flags = FILE_ATTRIBUTE_TEMPORARY;
@@ -3118,7 +3118,7 @@ TclpOpenTemporaryFile(
if (length == 0) {
goto gotError;
}
- namePtr += length * sizeof(TCHAR);
+ namePtr += length * sizeof(WCHAR);
if (basenameObj) {
const char *string = TclGetStringFromObj(basenameObj, &length);
@@ -3127,8 +3127,8 @@ TclpOpenTemporaryFile(
namePtr += Tcl_DStringLength(&buf);
Tcl_DStringFree(&buf);
} else {
- const TCHAR *baseStr = TEXT("TCL");
- length = 3 * sizeof(TCHAR);
+ const WCHAR *baseStr = L"TCL";
+ length = 3 * sizeof(WCHAR);
memcpy(namePtr, baseStr, length);
namePtr += length;
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 42f58de..3094f0d 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -52,15 +52,6 @@ typedef DWORD_PTR * PDWORD_PTR;
# include <wspiapi.h>
#endif
-#ifdef CHECK_UNICODE_CALLS
-# define _UNICODE
-# define UNICODE
-# define __TCHAR_DEFINED
- typedef float *_TCHAR;
-# define _TCHAR_DEFINED
- typedef float *TCHAR;
-#endif /* CHECK_UNICODE_CALLS */
-
/*
* Pull in the typedef of TCHAR for windows.
*/
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index ac569e4..f2169be 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -1368,7 +1368,7 @@ SerialWriterThread(
HANDLE
TclWinSerialOpen(
HANDLE handle,
- const TCHAR *name,
+ const WCHAR *name,
DWORD access)
{
SerialInit();
@@ -1595,7 +1595,7 @@ SerialSetOptionProc(
BOOL result, flag;
size_t len, vlen;
Tcl_DString ds;
- const TCHAR *native;
+ const WCHAR *native;
int argc;
const char **argv;
@@ -1718,7 +1718,7 @@ SerialSetOptionProc(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -xchar: should be a list of"
- " two elements with each a single character", -1));
+ " two elements with each a single 8-bit character", -1));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "XCHAR", NULL);
}
Tcl_Free(argv);
@@ -1742,12 +1742,12 @@ SerialSetOptionProc(
int charLen;
charLen = Tcl_UtfToUniChar(argv[0], &character);
- if (argv[0][charLen]) {
+ if ((character > 0xFF) || argv[0][charLen]) {
goto badXchar;
}
dcb.XonChar = (char) character;
charLen = Tcl_UtfToUniChar(argv[1], &character);
- if (argv[1][charLen]) {
+ if ((character > 0xFF) || argv[1][charLen]) {
goto badXchar;
}
dcb.XoffChar = (char) character;
@@ -2077,7 +2077,7 @@ SerialGetOptionProc(
Tcl_DStringStartSublist(dsPtr);
}
if (len==0 || (len>1 && strncmp(optionName, "-xchar", len) == 0)) {
- char buf[4];
+ char buf[TCL_UTF_MAX];
valid = 1;
if (!GetCommState(infoPtr->handle, &dcb)) {
@@ -2088,9 +2088,9 @@ SerialGetOptionProc(
}
return TCL_ERROR;
}
- sprintf(buf, "%c", dcb.XonChar);
+ buf[Tcl_UniCharToUtf(UCHAR(dcb.XonChar), buf)] = '\0';
Tcl_DStringAppendElement(dsPtr, buf);
- sprintf(buf, "%c", dcb.XoffChar);
+ buf[Tcl_UniCharToUtf(UCHAR(dcb.XoffChar), buf)] = '\0';
Tcl_DStringAppendElement(dsPtr, buf);
}
if (len == 0) {
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index ecf5e86..5cb19e9 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -82,7 +82,7 @@
*/
static int initialized = 0;
-static const TCHAR className[] = TEXT("TclSocket");
+static const WCHAR className[] = L"TclSocket";
TCL_DECLARE_MUTEX(socketMutex)
/*
@@ -363,7 +363,7 @@ InitializeHostName(
size_t *lengthPtr,
Tcl_Encoding *encodingPtr)
{
- TCHAR tbuf[MAX_COMPUTERNAME_LENGTH + 1];
+ WCHAR tbuf[MAX_COMPUTERNAME_LENGTH + 1];
DWORD length = MAX_COMPUTERNAME_LENGTH + 1;
Tcl_DString ds;