summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-08-02 10:41:09 (GMT)
committernijtmans <nijtmans>2009-08-02 10:41:09 (GMT)
commitad16cb700076b09c515d59baee67ff5e235326eb (patch)
treedb13aa69d3445775988e5d32e7501e656f8e6403 /win/tclWin32Dll.c
parent71048d27d0a64c0fa11da33a09037c820babf6e5 (diff)
downloadtcl-ad16cb700076b09c515d59baee67ff5e235326eb.zip
tcl-ad16cb700076b09c515d59baee67ff5e235326eb.tar.gz
tcl-ad16cb700076b09c515d59baee67ff5e235326eb.tar.bz2
eliminate TclWinResetInterfaceEncodings, because
it does exactly the same as TclWinEncodingsCleanup, make sure that tclWinProcs and tclWinTCharEncoding are always set and reset concurrently.
Diffstat (limited to 'win/tclWin32Dll.c')
-rw-r--r--win/tclWin32Dll.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index eb50cb1..1295c26 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.59 2009/07/01 14:38:07 patthoyts Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.60 2009/08/02 10:41:09 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -184,10 +184,10 @@ static TclWinProcs unicodeProcs = {
/* ReadConsole and WriteConsole */
(BOOL (WINAPI *)(HANDLE, LPVOID, DWORD, LPDWORD, LPVOID)) ReadConsoleW,
(BOOL (WINAPI *)(HANDLE, const void*, DWORD, LPDWORD, LPVOID)) WriteConsoleW,
- (BOOL (WINAPI *)(LPTSTR, LPDWORD))GetUserNameW
+ (BOOL (WINAPI *)(LPTSTR, LPDWORD)) GetUserNameW
};
-TclWinProcs *tclWinProcs;
+TclWinProcs *tclWinProcs = &asciiProcs;
static Tcl_Encoding tclWinTCharEncoding;
/*
@@ -354,7 +354,7 @@ TclWinInit(
Tcl_Panic("Win32s is not a supported platform");
}
- tclWinProcs = &asciiProcs;
+ TclWinResetInterfaces();
}
/*
@@ -370,6 +370,7 @@ TclWinInit(
* VER_PLATFORM_WIN32s Win32s on Windows 3.1. (not supported)
* VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95, 98, ME.
* VER_PLATFORM_WIN32_NT Win32 on Windows NT, 2000, XP
+ * VER_PLATFORM_WIN32_CE Win32 on Windows CE
*
* Side effects:
* None.
@@ -442,7 +443,7 @@ TclWinSetInterfaces(
int wide) /* Non-zero to use wide interfaces, 0
* otherwise. */
{
- Tcl_FreeEncoding(tclWinTCharEncoding);
+ TclWinResetInterfaces();
if (wide) {
tclWinProcs = &unicodeProcs;
@@ -504,8 +505,6 @@ TclWinSetInterfaces(
}
}
} else {
- tclWinProcs = &asciiProcs;
- tclWinTCharEncoding = NULL;
if (tclWinProcs->getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
@@ -543,7 +542,7 @@ TclWinSetInterfaces(
/*
*---------------------------------------------------------------------------
*
- * TclWinResetInterfaceEncodings --
+ * TclWinEncodingsCleanup --
*
* Called during finalization to free up any encodings we use. The
* tclWinProcs-> look up table is still ok to use after this call,
@@ -563,14 +562,11 @@ TclWinSetInterfaces(
*/
void
-TclWinResetInterfaceEncodings(void)
+TclWinEncodingsCleanup(void)
{
MountPointMap *dlIter, *dlIter2;
- if (tclWinTCharEncoding != NULL) {
- Tcl_FreeEncoding(tclWinTCharEncoding);
- tclWinTCharEncoding = NULL;
- }
+ TclWinResetInterfaces();
/*
* Clean up the mount point map.
@@ -607,7 +603,11 @@ TclWinResetInterfaceEncodings(void)
void
TclWinResetInterfaces(void)
{
- tclWinProcs = &asciiProcs;
+ if (tclWinTCharEncoding != NULL) {
+ Tcl_FreeEncoding(tclWinTCharEncoding);
+ tclWinTCharEncoding = NULL;
+ }
+ tclWinProcs = &asciiProcs;
}
/*