From 646fc65d90e21ea34b47fee9ef22f8fbaf4e40ca Mon Sep 17 00:00:00 2001
From: nijtmans <nijtmans>
Date: Sun, 7 Mar 2010 14:39:25 +0000
Subject: test that tclOO stubs are present in stub library Applied missing
 part of [Patch 2961556] Change all tclWinProcs signatures to use TCHAR* in
 stead of WCHAR*. This is meant as preparation to make [Enh 2965056] possible
 at all.

---
 ChangeLog             | 12 ++++++++++++
 generic/tclOOMethod.c | 10 +++++-----
 generic/tclTest.c     |  9 ++++++---
 win/tclWin32Dll.c     | 52 +++++++++++++++++++++++++--------------------------
 win/tclWinDde.c       |  8 ++++----
 win/tclWinFCmd.c      | 16 ++++++++--------
 win/tclWinFile.c      | 28 ++++++++++++---------------
 win/tclWinInt.h       | 24 ++++++++++++------------
 win/tclWinPipe.c      | 25 ++++++++++++-------------
 win/tclWinSock.c      | 10 +++++-----
 10 files changed, 102 insertions(+), 92 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 304c261..34bf6a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-03-07  Jan Nijtmans  <nijtmans@users.sf.net>
+
+	* generic/tclTest.c       test that tclOO stubs are present in stub library
+	* generic/tclOOMethod.c   Applied missing part of [Patch 2961556]
+	* win/tclWinInt.h         Change all tclWinProcs signatures to use
+	* win/tclWin32Dll.c       TCHAR* in stead of WCHAR*. This is meant
+	* win/tclWinDde.c         as preparation to make [Enh 2965056]
+	* win/tclWinFCmd.c        possible at all.
+	* win/tclWinFile.c
+	* win/tclWinPipe.c
+	* win/tclWinSock.c
+
 2010-03-06  Jan Nijtmans  <nijtmans@users.sf.net>
 
 	* generic/tclStubLib.c  remove presence of tclTomMathStubsPtr here
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index bc6bd86..6c13116 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -8,7 +8,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclOOMethod.c,v 1.24 2010/02/24 10:45:04 dkf Exp $
+ * RCS: @(#) $Id: tclOOMethod.c,v 1.25 2010/03/07 14:39:26 nijtmans Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -1655,8 +1655,8 @@ Tcl_Method
 TclOONewProcInstanceMethodEx(
     Tcl_Interp *interp,		/* The interpreter containing the object. */
     Tcl_Object oPtr,		/* The object to modify. */
-    TclOO_PreCallProc preCallPtr,
-    TclOO_PostCallProc postCallPtr,
+    TclOO_PreCallProc *preCallPtr,
+    TclOO_PostCallProc *postCallPtr,
     ProcErrorProc *errProc,
     ClientData clientData,
     Tcl_Obj *nameObj,		/* The name of the method, which must not be
@@ -1692,8 +1692,8 @@ Tcl_Method
 TclOONewProcMethodEx(
     Tcl_Interp *interp,		/* The interpreter containing the class. */
     Tcl_Class clsPtr,		/* The class to modify. */
-    TclOO_PreCallProc preCallPtr,
-    TclOO_PostCallProc postCallPtr,
+    TclOO_PreCallProc *preCallPtr,
+    TclOO_PostCallProc *postCallPtr,
     ProcErrorProc *errProc,
     ClientData clientData,
     Tcl_Obj *nameObj,		/* The name of the method, which may be NULL;
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 35bff84..4e717bd 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -14,7 +14,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclTest.c,v 1.148 2010/03/06 06:29:24 nijtmans Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.149 2010/03/07 14:39:26 nijtmans Exp $
  */
 
 #undef STATIC_BUILD
@@ -22,7 +22,7 @@
 #   define USE_TCL_STUBS
 #endif
 #include "tclInt.h"
-
+#include "tclOO.h"
 /*
  * Required for Testregexp*Cmd
  */
@@ -545,6 +545,9 @@ Tcltest_Init(
     if (Tcl_TomMath_InitStubs(interp, "8.5") == NULL) {
 	return TCL_ERROR;
     }
+    if (Tcl_OOInitStubs(interp) == NULL) {
+	return TCL_ERROR;
+    }
     /* TIP #268: Full patchlevel instead of just major.minor */
 
     if (Tcl_PkgProvide(interp, "Tcltest", TCL_PATCH_LEVEL) == TCL_ERROR) {
@@ -757,7 +760,7 @@ int
 Tcltest_SafeInit(
     Tcl_Interp *interp)		/* Interpreter for application. */
 {
-    if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
+    if (Tcl_InitStubs(interp, "8.5", 0) == NULL) {
 	return TCL_ERROR;
     }
     return Procbodytest_SafeInit(interp);
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 76fc642..50689bc 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -10,7 +10,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWin32Dll.c,v 1.61 2010/02/15 22:56:19 nijtmans Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.62 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 #include "tclWinInt.h"
@@ -130,24 +130,24 @@ static TclWinProcs asciiProcs = {
     (BOOL (WINAPI *)(const TCHAR *)) DeleteFileA,
     (HANDLE (WINAPI *)(const TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileA,
     (BOOL (WINAPI *)(HANDLE, WIN32_FIND_DATAT *)) FindNextFileA,
-    (BOOL (WINAPI *)(WCHAR *, LPDWORD)) GetComputerNameA,
-    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetCurrentDirectoryA,
+    (BOOL (WINAPI *)(TCHAR *, LPDWORD)) GetComputerNameA,
+    (DWORD (WINAPI *)(DWORD, TCHAR *)) GetCurrentDirectoryA,
     (DWORD (WINAPI *)(const TCHAR *)) GetFileAttributesA,
-    (DWORD (WINAPI *)(const TCHAR *, DWORD nBufferLength, WCHAR *,
+    (DWORD (WINAPI *)(const TCHAR *, DWORD nBufferLength, TCHAR *,
 	    TCHAR **)) GetFullPathNameA,
-    (DWORD (WINAPI *)(HMODULE, WCHAR *, int)) GetModuleFileNameA,
-    (DWORD (WINAPI *)(const TCHAR *, WCHAR *, DWORD)) GetShortPathNameA,
+    (DWORD (WINAPI *)(HMODULE, TCHAR *, int)) GetModuleFileNameA,
+    (DWORD (WINAPI *)(const TCHAR *, TCHAR *, DWORD)) GetShortPathNameA,
     (UINT (WINAPI *)(const TCHAR *, const TCHAR *, UINT uUnique,
-	    WCHAR *)) GetTempFileNameA,
-    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathA,
-    (BOOL (WINAPI *)(const TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
-	    WCHAR *, DWORD)) GetVolumeInformationA,
+	    TCHAR *)) GetTempFileNameA,
+    (DWORD (WINAPI *)(DWORD, TCHAR *)) GetTempPathA,
+    (BOOL (WINAPI *)(const TCHAR *, TCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
+	    TCHAR *, DWORD)) GetVolumeInformationA,
     (HINSTANCE (WINAPI *)(const TCHAR *)) LoadLibraryA,
-    (TCHAR (WINAPI *)(WCHAR *, const TCHAR *)) lstrcpyA,
+    (TCHAR (WINAPI *)(TCHAR *, const TCHAR *)) lstrcpyA,
     (BOOL (WINAPI *)(const TCHAR *, const TCHAR *)) MoveFileA,
     (BOOL (WINAPI *)(const TCHAR *)) RemoveDirectoryA,
     (DWORD (WINAPI *)(const TCHAR *, const TCHAR *, const TCHAR *, DWORD,
-	    WCHAR *, TCHAR **)) SearchPathA,
+	    TCHAR *, TCHAR **)) SearchPathA,
     (BOOL (WINAPI *)(const TCHAR *)) SetCurrentDirectoryA,
     (BOOL (WINAPI *)(const TCHAR *, DWORD)) SetFileAttributesA,
 
@@ -189,24 +189,24 @@ static TclWinProcs unicodeProcs = {
     (BOOL (WINAPI *)(const TCHAR *)) DeleteFileW,
     (HANDLE (WINAPI *)(const TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileW,
     (BOOL (WINAPI *)(HANDLE, WIN32_FIND_DATAT *)) FindNextFileW,
-    (BOOL (WINAPI *)(WCHAR *, LPDWORD)) GetComputerNameW,
-    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetCurrentDirectoryW,
+    (BOOL (WINAPI *)(TCHAR *, LPDWORD)) GetComputerNameW,
+    (DWORD (WINAPI *)(DWORD, TCHAR *)) GetCurrentDirectoryW,
     (DWORD (WINAPI *)(const TCHAR *)) GetFileAttributesW,
-    (DWORD (WINAPI *)(const TCHAR *, DWORD nBufferLength, WCHAR *,
+    (DWORD (WINAPI *)(const TCHAR *, DWORD nBufferLength, TCHAR *,
 	    TCHAR **)) GetFullPathNameW,
-    (DWORD (WINAPI *)(HMODULE, WCHAR *, int)) GetModuleFileNameW,
-    (DWORD (WINAPI *)(const TCHAR *, WCHAR *, DWORD)) GetShortPathNameW,
+    (DWORD (WINAPI *)(HMODULE, TCHAR *, int)) GetModuleFileNameW,
+    (DWORD (WINAPI *)(const TCHAR *, TCHAR *, DWORD)) GetShortPathNameW,
     (UINT (WINAPI *)(const TCHAR *, const TCHAR *, UINT uUnique,
-	    WCHAR *)) GetTempFileNameW,
-    (DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathW,
-    (BOOL (WINAPI *)(const TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
-	    WCHAR *, DWORD)) GetVolumeInformationW,
+	    TCHAR *)) GetTempFileNameW,
+    (DWORD (WINAPI *)(DWORD, TCHAR *)) GetTempPathW,
+    (BOOL (WINAPI *)(const TCHAR *, TCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD,
+	    TCHAR *, DWORD)) GetVolumeInformationW,
     (HINSTANCE (WINAPI *)(const TCHAR *)) LoadLibraryW,
-    (TCHAR (WINAPI *)(WCHAR *, const TCHAR *)) lstrcpyW,
+    (TCHAR (WINAPI *)(TCHAR *, const TCHAR *)) lstrcpyW,
     (BOOL (WINAPI *)(const TCHAR *, const TCHAR *)) MoveFileW,
     (BOOL (WINAPI *)(const TCHAR *)) RemoveDirectoryW,
     (DWORD (WINAPI *)(const TCHAR *, const TCHAR *, const TCHAR *, DWORD,
-	    WCHAR *, TCHAR **)) SearchPathW,
+	    TCHAR *, TCHAR **)) SearchPathW,
     (BOOL (WINAPI *)(const TCHAR *)) SetCurrentDirectoryW,
     (BOOL (WINAPI *)(const TCHAR *, DWORD)) SetFileAttributesW,
 
@@ -250,7 +250,7 @@ BOOL APIENTRY		DllMain(HINSTANCE hInst, DWORD reason,
  */
 
 typedef struct MountPointMap {
-    const WCHAR *volumeName;	/* Native wide string volume name. */
+    const TCHAR *volumeName;	/* Native wide string volume name. */
     char driveLetter;		/* Drive letter corresponding to the volume
 				 * name. */
     struct MountPointMap *nextPtr;
@@ -695,7 +695,7 @@ TclWinDriveLetterForVolMountPoint(
     Tcl_MutexLock(&mountPointMap);
     dlIter = driveLetterLookup;
     while (dlIter != NULL) {
-	if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
+	if (wcscmp((WCHAR *)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
@@ -794,7 +794,7 @@ TclWinDriveLetterForVolMountPoint(
 
     for (dlIter = driveLetterLookup; dlIter != NULL;
 	    dlIter = dlIter->nextPtr) {
-	if (wcscmp(dlIter->volumeName, mountPoint) == 0) {
+	if (wcscmp((WCHAR *)dlIter->volumeName, mountPoint) == 0) {
 	    Tcl_MutexUnlock(&mountPointMap);
 	    return dlIter->driveLetter;
 	}
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index 6fc902d..3421510 100644
--- a/win/tclWinDde.c
+++ b/win/tclWinDde.c
@@ -9,7 +9,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWinDde.c,v 1.41 2010/02/25 23:39:50 dkf Exp $
+ * RCS: @(#) $Id: tclWinDde.c,v 1.42 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 #undef STATIC_BUILD
@@ -991,7 +991,7 @@ DdeServicesOnAck(
     ATOM service = (ATOM)LOWORD(lParam);
     ATOM topic = (ATOM)HIWORD(lParam);
     struct DdeEnumServices *es;
-    TCHAR sz[255];
+    char sz[255];
 
 #ifdef _WIN64
     es = (struct DdeEnumServices *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -1004,9 +1004,9 @@ DdeServicesOnAck(
 	Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL);
 	Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp);
 
-	GlobalGetAtomName(service, sz, 255);
+	GlobalGetAtomNameA(service, sz, 255);
 	Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(sz, -1));
-	GlobalGetAtomName(topic, sz, 255);
+	GlobalGetAtomNameA(topic, sz, 255);
 	Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(sz, -1));
 
 	/*
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index a60ea61..6fa7441 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -9,7 +9,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWinFCmd.c,v 1.60 2010/02/15 23:10:47 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.61 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 #include "tclWinInt.h"
@@ -328,8 +328,8 @@ DoRenameFile(
 	    TCHAR *nativeSrcRest, *nativeDstRest;
 	    const char **srcArgv, **dstArgv;
 	    int size, srcArgc, dstArgc;
-	    WCHAR nativeSrcPath[MAX_PATH];
-	    WCHAR nativeDstPath[MAX_PATH];
+	    TCHAR nativeSrcPath[MAX_PATH*2];
+	    TCHAR nativeDstPath[MAX_PATH*2];
 	    Tcl_DString srcString, dstString;
 	    const char *src, *dst;
 
@@ -343,11 +343,11 @@ DoRenameFile(
 	    if ((size == 0) || (size > MAX_PATH)) {
 		return TCL_ERROR;
 	    }
-	    tclWinProcs->charLowerProc((TCHAR *) nativeSrcPath);
-	    tclWinProcs->charLowerProc((TCHAR *) nativeDstPath);
+	    tclWinProcs->charLowerProc(nativeSrcPath);
+	    tclWinProcs->charLowerProc(nativeDstPath);
 
-	    src = tclWinProcs->tchar2utf((TCHAR *) nativeSrcPath, -1, &srcString);
-	    dst = tclWinProcs->tchar2utf((TCHAR *) nativeDstPath, -1, &dstString);
+	    src = tclWinProcs->tchar2utf(nativeSrcPath, -1, &srcString);
+	    dst = tclWinProcs->tchar2utf(nativeDstPath, -1, &dstString);
 
 	    /*
 	     * Check whether the destination path is actually inside the
@@ -465,7 +465,7 @@ DoRenameFile(
 
 		TCHAR *nativeRest, *nativeTmp, *nativePrefix;
 		int result, size;
-		WCHAR tempBuf[MAX_PATH];
+		TCHAR tempBuf[MAX_PATH*2];
 
 		size = tclWinProcs->getFullPathNameProc(nativeDst, MAX_PATH,
 			tempBuf, &nativeRest);
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 9522c52..2785912 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -11,7 +11,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWinFile.c,v 1.104 2010/02/15 23:10:47 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.105 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 /* #define _WIN32_WINNT	0x0500 */
@@ -224,7 +224,7 @@ WinLink(
     const TCHAR *linkTargetPath,
     int linkAction)
 {
-    WCHAR tempFileName[MAX_PATH];
+    TCHAR tempFileName[MAX_PATH*2];
     TCHAR *tempFilePart;
     DWORD attr;
 
@@ -345,7 +345,7 @@ static Tcl_Obj *
 WinReadLink(
     const TCHAR *linkSourcePath)
 {
-    WCHAR tempFileName[MAX_PATH];
+    TCHAR tempFileName[MAX_PATH*2];
     TCHAR *tempFilePart;
     DWORD attr;
 
@@ -1946,7 +1946,7 @@ TclpGetCwd(
     Tcl_DString *bufferPtr)	/* Uninitialized or free DString filled with
 				 * name of current directory. */
 {
-    WCHAR buffer[MAX_PATH];
+    TCHAR buffer[MAX_PATH*2];
     char *p;
 
     if (tclWinProcs->getCurrentDirectoryProc(MAX_PATH, buffer) == 0) {
@@ -1963,18 +1963,14 @@ TclpGetCwd(
      */
 
     if (tclWinProcs->useWide) {
-	WCHAR *native;
-
-	native = (WCHAR *) buffer;
+	WCHAR *native = (WCHAR *) buffer;
 	if ((native[0] != '\0') && (native[1] == ':')
 		&& (native[2] == '\\') && (native[3] == '\\')) {
 	    native += 2;
 	}
 	tclWinProcs->tchar2utf((TCHAR *) native, -1, bufferPtr);
     } else {
-	char *native;
-
-	native = (char *) buffer;
+	char *native = (char *) buffer;
 	if ((native[0] != '\0') && (native[1] == ':')
 		&& (native[2] == '\\') && (native[3] == '\\')) {
 	    native += 2;
@@ -2197,14 +2193,14 @@ NativeDev(
 {
     int dev;
     Tcl_DString ds;
-    WCHAR nativeFullPath[MAX_PATH];
+    TCHAR nativeFullPath[MAX_PATH*2];
     TCHAR *nativePart;
     const char *fullPath;
 
     tclWinProcs->getFullPathNameProc(nativePath, MAX_PATH, nativeFullPath,
 	    &nativePart);
 
-    fullPath = tclWinProcs->tchar2utf((TCHAR *) nativeFullPath, -1, &ds);
+    fullPath = tclWinProcs->tchar2utf(nativeFullPath, -1, &ds);
 
     if ((fullPath[0] == '\\') && (fullPath[1] == '\\')) {
 	const char *p;
@@ -2371,7 +2367,7 @@ ClientData
 TclpGetNativeCwd(
     ClientData clientData)
 {
-    WCHAR buffer[MAX_PATH];
+    TCHAR buffer[MAX_PATH*2];
 
     if (tclWinProcs->getCurrentDirectoryProc(MAX_PATH, buffer) == 0) {
 	TclWinConvertError(GetLastError());
@@ -2489,7 +2485,7 @@ TclpFilesystemPathType(
 {
 #define VOL_BUF_SIZE 32
     int found;
-    WCHAR volType[VOL_BUF_SIZE];
+    TCHAR volType[VOL_BUF_SIZE*2];
     char *firstSeparator;
     const char *path;
     Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr);
@@ -2506,14 +2502,14 @@ TclpFilesystemPathType(
     if (firstSeparator == NULL) {
 	found = tclWinProcs->getVolumeInformationProc(
 		Tcl_FSGetNativePath(pathPtr), NULL, 0, NULL, NULL, NULL,
-		(WCHAR *) volType, VOL_BUF_SIZE);
+		volType, VOL_BUF_SIZE);
     } else {
 	Tcl_Obj *driveName = Tcl_NewStringObj(path, firstSeparator - path+1);
 
 	Tcl_IncrRefCount(driveName);
 	found = tclWinProcs->getVolumeInformationProc(
 		Tcl_FSGetNativePath(driveName), NULL, 0, NULL, NULL, NULL,
-		(WCHAR *) volType, VOL_BUF_SIZE);
+		volType, VOL_BUF_SIZE);
 	Tcl_DecrRefCount(driveName);
     }
 
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 13d25ef..8d02d0e 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -8,7 +8,7 @@
  * See the file "license.terms" for information on usage and redistribution
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWinInt.h,v 1.34 2010/02/15 22:56:19 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinInt.h,v 1.35 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 #ifndef _TCLWININT
@@ -54,24 +54,24 @@ typedef struct TclWinProcs {
     BOOL (WINAPI *deleteFileProc)(const TCHAR *);
     HANDLE (WINAPI *findFirstFileProc)(const TCHAR *, WIN32_FIND_DATAT *);
     BOOL (WINAPI *findNextFileProc)(HANDLE, WIN32_FIND_DATAT *);
-    BOOL (WINAPI *getComputerNameProc)(WCHAR *, LPDWORD);
-    DWORD (WINAPI *getCurrentDirectoryProc)(DWORD, WCHAR *);
+    BOOL (WINAPI *getComputerNameProc)(TCHAR *, LPDWORD);
+    DWORD (WINAPI *getCurrentDirectoryProc)(DWORD, TCHAR *);
     DWORD (WINAPI *getFileAttributesProc)(const TCHAR *);
-    DWORD (WINAPI *getFullPathNameProc)(const TCHAR *, DWORD, WCHAR *,
+    DWORD (WINAPI *getFullPathNameProc)(const TCHAR *, DWORD, TCHAR *,
 	    TCHAR **);
-    DWORD (WINAPI *getModuleFileNameProc)(HMODULE, WCHAR *, int);
-    DWORD (WINAPI *getShortPathNameProc)(const TCHAR *, WCHAR *, DWORD);
+    DWORD (WINAPI *getModuleFileNameProc)(HMODULE, TCHAR *, int);
+    DWORD (WINAPI *getShortPathNameProc)(const TCHAR *, TCHAR *, DWORD);
     UINT (WINAPI *getTempFileNameProc)(const TCHAR *, const TCHAR *, UINT,
-	    WCHAR *);
-    DWORD (WINAPI *getTempPathProc)(DWORD, WCHAR *);
-    BOOL (WINAPI *getVolumeInformationProc)(const TCHAR *, WCHAR *, DWORD,
-	    LPDWORD, LPDWORD, LPDWORD, WCHAR *, DWORD);
+	    TCHAR *);
+    DWORD (WINAPI *getTempPathProc)(DWORD, TCHAR *);
+    BOOL (WINAPI *getVolumeInformationProc)(const TCHAR *, TCHAR *, DWORD,
+	    LPDWORD, LPDWORD, LPDWORD, TCHAR *, DWORD);
     HINSTANCE (WINAPI *loadLibraryProc)(const TCHAR *);
-    TCHAR (WINAPI *lstrcpyProc)(WCHAR *, const TCHAR *);
+    TCHAR (WINAPI *lstrcpyProc)(TCHAR *, const TCHAR *);
     BOOL (WINAPI *moveFileProc)(const TCHAR *, const TCHAR *);
     BOOL (WINAPI *removeDirectoryProc)(const TCHAR *);
     DWORD (WINAPI *searchPathProc)(const TCHAR *, const TCHAR *,
-	    const TCHAR *, DWORD, WCHAR *, TCHAR **);
+	    const TCHAR *, DWORD, TCHAR *, TCHAR **);
     BOOL (WINAPI *setCurrentDirectoryProc)(const TCHAR *);
     BOOL (WINAPI *setFileAttributesProc)(const TCHAR *, DWORD);
     /*
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 5d97915..a625ae8 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -9,7 +9,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWinPipe.c,v 1.76 2010/02/15 23:10:47 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.77 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 #include "tclWinInt.h"
@@ -196,7 +196,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(WCHAR name[MAX_PATH]);
+static int		TempFileName(TCHAR name[MAX_PATH*2]);
 static int		WaitForRead(PipeInfo *infoPtr, int blocking);
 static void		PipeThreadActionProc(ClientData instanceData,
 			    int action);
@@ -474,15 +474,14 @@ TclWinMakeFile(
 
 static int
 TempFileName(
-    WCHAR name[MAX_PATH])	/* Buffer in which name for temporary file
+    TCHAR name[MAX_PATH*2])	/* Buffer in which name for temporary file
 				 * gets stored. */
 {
     TCHAR *prefix;
 
     prefix = (tclWinProcs->useWide) ? (TCHAR *) L"TCL" : (TCHAR *) "TCL";
     if (tclWinProcs->getTempPathProc(MAX_PATH, name) != 0) {
-	if (tclWinProcs->getTempFileNameProc((TCHAR *) name, prefix, 0,
-		name) != 0) {
+	if (tclWinProcs->getTempFileNameProc(name, prefix, 0, name) != 0) {
 	    return 1;
 	}
     }
@@ -493,7 +492,7 @@ TempFileName(
 	((char *) name)[0] = '.';
 	((char *) name)[1] = '\0';
     }
-    return tclWinProcs->getTempFileNameProc((TCHAR *) name, prefix, 0, name);
+    return tclWinProcs->getTempFileNameProc(name, prefix, 0, name);
 }
 
 /*
@@ -669,7 +668,7 @@ TclFile
 TclpCreateTempFile(
     const char *contents)	/* String to write into temp file, or NULL. */
 {
-    WCHAR name[MAX_PATH];
+    TCHAR name[MAX_PATH*2];
     const char *native;
     Tcl_DString dstring;
     HANDLE handle;
@@ -761,7 +760,7 @@ TclpCreateTempFile(
 Tcl_Obj *
 TclpTempFileName(void)
 {
-    WCHAR fileName[MAX_PATH];
+    TCHAR fileName[MAX_PATH*2];
 
     if (TempFileName(fileName) == 0) {
 	return NULL;
@@ -1375,7 +1374,7 @@ ApplicationType(
     IMAGE_DOS_HEADER header;
     Tcl_DString nameBuf, ds;
     const TCHAR *nativeName;
-    WCHAR nativeFullPath[MAX_PATH];
+    TCHAR nativeFullPath[MAX_PATH*2];
     static char extensions[][5] = {"", ".com", ".exe", ".bat"};
 
     /*
@@ -1413,11 +1412,11 @@ ApplicationType(
 	 * known type.
 	 */
 
-	attr = tclWinProcs->getFileAttributesProc((TCHAR *) nativeFullPath);
+	attr = tclWinProcs->getFileAttributesProc(nativeFullPath);
 	if ((attr == 0xffffffff) || (attr & FILE_ATTRIBUTE_DIRECTORY)) {
 	    continue;
 	}
-	strcpy(fullName, tclWinProcs->tchar2utf((TCHAR *) nativeFullPath, -1, &ds));
+	strcpy(fullName, tclWinProcs->tchar2utf(nativeFullPath, -1, &ds));
 	Tcl_DStringFree(&ds);
 
 	ext = strrchr(fullName, '.');
@@ -1426,7 +1425,7 @@ ApplicationType(
 	    break;
 	}
 
-	hFile = tclWinProcs->createFileProc((TCHAR *) nativeFullPath,
+	hFile = tclWinProcs->createFileProc(nativeFullPath,
 		GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
 		FILE_ATTRIBUTE_NORMAL, NULL);
 	if (hFile == INVALID_HANDLE_VALUE) {
@@ -3172,7 +3171,7 @@ TclpOpenTemporaryFile(
     Tcl_Obj *extensionObj,
     Tcl_Obj *resultingNameObj)
 {
-    WCHAR name[MAX_PATH];
+    TCHAR name[MAX_PATH*2];
     char *namePtr;
     HANDLE handle;
     DWORD flags = FILE_ATTRIBUTE_TEMPORARY;
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 933523a..27f7245 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -8,7 +8,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclWinSock.c,v 1.69 2010/02/15 23:10:47 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.70 2010/03/07 14:39:25 nijtmans Exp $
  */
 
 #include "tclWinInt.h"
@@ -2423,16 +2423,16 @@ InitializeHostName(
     int *lengthPtr,
     Tcl_Encoding *encodingPtr)
 {
-    WCHAR wbuf[MAX_COMPUTERNAME_LENGTH + 1];
-    DWORD length = sizeof(wbuf) / sizeof(WCHAR);
+    TCHAR tbuf[(MAX_COMPUTERNAME_LENGTH + 1)*2];
+    DWORD length = MAX_COMPUTERNAME_LENGTH + 1;
     Tcl_DString ds;
 
-    if (tclWinProcs->getComputerNameProc(wbuf, &length) != 0) {
+    if (tclWinProcs->getComputerNameProc(tbuf, &length) != 0) {
 	/*
 	 * Convert string from native to UTF then change to lowercase.
 	 */
 
-	Tcl_UtfToLower((char *) tclWinProcs->tchar2utf((TCHAR *) wbuf, -1, &ds));
+	Tcl_UtfToLower((char *) tclWinProcs->tchar2utf(tbuf, -1, &ds));
 
     } else {
 	Tcl_DStringInit(&ds);
-- 
cgit v0.12