summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclInt.h6
-rw-r--r--generic/tclUtf.c35
-rw-r--r--unix/tclUnixInit.c3
-rw-r--r--win/tclWinInit.c6
4 files changed, 14 insertions, 36 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 80bec46..5c1436b 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3182,7 +3182,11 @@ MODULE_SCOPE void TclRegisterCommandTypeName(
MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct);
MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct);
MODULE_SCOPE size_t TclUtfCount(int ch);
-MODULE_SCOPE int TclUtfToUCS4(const char *src, int *ucs4Ptr);
+#if TCL_UTF_MAX > 3
+# define TclUtfToUCS4 Tcl_UtfToUniChar
+#else
+ MODULE_SCOPE int TclUtfToUCS4(const char *src, int *ucs4Ptr);
+#endif
MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(void *clientData);
MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType(Tcl_Obj *pathPtr);
MODULE_SCOPE int TclpDlopen(Tcl_Interp *interp, Tcl_Obj *pathPtr,
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index b6c5736..b53d918 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -2450,44 +2450,17 @@ TclUniCharMatch(
*---------------------------------------------------------------------------
*/
+#if TCL_UTF_MAX <= 3
int
TclUtfToUCS4(
const char *src, /* The UTF-8 string. */
int *ucs4Ptr) /* Filled with the UCS4 codepoint represented
* by the UTF-8 string. */
{
- int len, fullchar;
- Tcl_UniChar ch = 0;
-
- len = TclUtfToUniChar(src, &ch);
- fullchar = ch;
-
-#if TCL_UTF_MAX <= 3
- /* Limited interfaces -- must use and decode surrogates */
-
- if ((ch >= 0xD800) && len < 3) {
-/******
- ****** Note the #undef TCL_UtfToUniChar gets in our way here.
- ******
- len += Tcl_UtfToUniChar(src + len, &ch);
- ******
- ****** We have to do the subtitution ourselves.
- ******/
-
- len += Tcl_UtfToChar16(src + len, &ch);
-
-/******
- ****** We might also solve this by moving this routine higher in the file.
- ****** Or there might be a more sensible foundation in this branch.
- ******/
-
- fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
- }
-#endif
-
- *ucs4Ptr = fullchar;
- return len;
+ /* Make use of the #undef Tcl_UtfToUniChar above, which already handles UCS4. */
+ return Tcl_UtfToUniChar(src, &ch);
}
+#endif
/*
* Local Variables:
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 7044a2f..a0a2c30 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -885,7 +885,8 @@ TclpSetVariables(
GetSystemInfo(&sysInfo);
- Tcl_SetVar2(interp, "tcl_platform", "os", "Windows NT", TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tcl_platform", "os",
+ "Windows NT", TCL_GLOBAL_ONLY);
sprintf(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion);
Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY);
if (sysInfo.wProcessorArchitecture < NUMPROCESSORS) {
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 7bd46cc..5e3030f 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -83,11 +83,10 @@ typedef struct {
TclWinProcs tclWinProcs;
/*
- * The following arrays contain the human readable strings for the Windows
+ * The following arrays contain the human readable strings for the
* processor values.
*/
-
#define NUMPROCESSORS 11
static const char *const processors[NUMPROCESSORS] = {
"intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil",
@@ -540,7 +539,8 @@ TclpSetVariables(
Tcl_SetVar2(interp, "tcl_platform", "platform", "windows",
TCL_GLOBAL_ONLY);
- Tcl_SetVar2(interp, "tcl_platform", "os", "Windows NT", TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tcl_platform", "os",
+ "Windows NT", TCL_GLOBAL_ONLY);
wsprintfA(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion);
Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY);
if (sys.oemId.wProcessorArchitecture < NUMPROCESSORS) {