summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-01-10 14:02:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-01-10 14:02:03 (GMT)
commit48d6a20861f95be856bef0e780c054757c9c3803 (patch)
tree39db34fe5a67b052bf5af3a728c43b10b954bfd5 /win
parent498f069f0e0b2f665d04a2a3b1b691f53297fe2c (diff)
downloadtcl-48d6a20861f95be856bef0e780c054757c9c3803.zip
tcl-48d6a20861f95be856bef0e780c054757c9c3803.tar.gz
tcl-48d6a20861f95be856bef0e780c054757c9c3803.tar.bz2
Re-implement Tcl_WinTCharToUtf/Tcl_WinUtfToTChar in pure win32 api, even for TCL_UTF_MAX=3. We can do that now safely, because of the changed handling of valid 4-byte UTF-8 characters in the previous commit.
Diffstat (limited to 'win')
-rw-r--r--win/tclWin32Dll.c76
-rw-r--r--win/tclWinInit.c7
2 files changed, 2 insertions, 81 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index da1cdfe..599c126 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -32,10 +32,6 @@ static HINSTANCE hInstance; /* HINSTANCE of this DLL. */
#define cpuid __asm __emit 0fh __asm __emit 0a2h
#endif
-#if TCL_UTF_MAX < 4
-static Tcl_Encoding winTCharEncoding = NULL;
-#endif
-
/*
* The following declaration is for the VC++ DLL entry point.
*/
@@ -196,8 +192,6 @@ TclWinInit(
if (os.dwPlatformId != VER_PLATFORM_WIN32_NT) {
Tcl_Panic("Windows NT is the only supported platform");
}
-
- TclWinResetInterfaces();
}
/*
@@ -234,38 +228,10 @@ TclWinNoBackslash(
/*
*---------------------------------------------------------------------------
*
- * TclpSetInterfaces --
- *
- * A helper proc.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-void
-TclpSetInterfaces(void)
-{
-#if TCL_UTF_MAX < 4
- TclWinResetInterfaces();
- winTCharEncoding = Tcl_GetEncoding(NULL, "unicode");
-#endif
-}
-
-/*
- *---------------------------------------------------------------------------
- *
* TclWinEncodingsCleanup --
*
- * Called during finalization to free up any encodings we use.
- *
- * We also clean up any memory allocated in our mount point map which is
- * used to follow certain kinds of symlinks. That code should never be
- * used once encodings are taken down.
+ * Called during finalization to clean up any memory allocated in our
+ * mount point map which is used to follow certain kinds of symlinks.
*
* Results:
* None.
@@ -281,8 +247,6 @@ TclWinEncodingsCleanup(void)
{
MountPointMap *dlIter, *dlIter2;
- TclWinResetInterfaces();
-
/*
* Clean up the mount point map.
*/
@@ -299,32 +263,6 @@ TclWinEncodingsCleanup(void)
}
/*
- *---------------------------------------------------------------------------
- *
- * TclWinResetInterfaces --
- *
- * Called during finalization to reset us to a safe state for reuse.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-void
-TclWinResetInterfaces(void)
-{
-#if TCL_UTF_MAX < 4
- if (winTCharEncoding != NULL) {
- Tcl_FreeEncoding(winTCharEncoding);
- winTCharEncoding = NULL;
- }
-#endif
-}
-
-/*
*--------------------------------------------------------------------
*
* TclWinDriveLetterForVolMountPoint
@@ -533,7 +471,6 @@ Tcl_WinUtfToTChar(
Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
-#if TCL_UTF_MAX > 3
TCHAR *wp;
int size = MultiByteToWideChar(CP_UTF8, 0, string, len, 0, 0);
@@ -545,10 +482,6 @@ Tcl_WinUtfToTChar(
Tcl_DStringSetLength(dsPtr, 2*size);
wp[size] = 0;
return wp;
-#else
- return (TCHAR *) Tcl_UtfToExternalDString(winTCharEncoding,
- string, len, dsPtr);
-#endif
}
char *
@@ -559,7 +492,6 @@ Tcl_WinTCharToUtf(
Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
-#if TCL_UTF_MAX > 3
char *p;
int size;
@@ -575,10 +507,6 @@ Tcl_WinTCharToUtf(
Tcl_DStringSetLength(dsPtr, size);
p[size] = 0;
return p;
-#else
- return Tcl_ExternalToUtfDString(winTCharEncoding,
- (const char *) string, len, dsPtr);
-#endif
}
/*
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index dc8bba7..91f149b 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -487,18 +487,11 @@ TclpSetInitialEncodings(void)
{
Tcl_DString encodingName;
- TclpSetInterfaces();
Tcl_SetSystemEncoding(NULL,
Tcl_GetEncodingNameFromEnvironment(&encodingName));
Tcl_DStringFree(&encodingName);
}
-void TclWinSetInterfaces(
- int dummy) /* Not used. */
-{
- TclpSetInterfaces();
-}
-
const char *
Tcl_GetEncodingNameFromEnvironment(
Tcl_DString *bufPtr)