summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-01 19:22:00 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-01 19:22:00 (GMT)
commit778f45c5349cd0bc32e3f3bc07d1811f56c7ba3f (patch)
treef2cb769c351e31db7c70b822351458d54dcc5f67 /unix
parent570e6997db0a989a0c23ed8a5f162c22211c0ee4 (diff)
downloadtcl-778f45c5349cd0bc32e3f3bc07d1811f56c7ba3f.zip
tcl-778f45c5349cd0bc32e3f3bc07d1811f56c7ba3f.tar.gz
tcl-778f45c5349cd0bc32e3f3bc07d1811f56c7ba3f.tar.bz2
Fix [5fca83d78c]: [encoding system] is wrong in an ISO-8859-1 locale
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixInit.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 5a27359..c7b2efe 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -55,31 +55,31 @@ static const char *const processors[NUMPROCESSORS] = {
};
typedef struct {
- union {
- unsigned int dwOemId;
- struct {
- int wProcessorArchitecture;
- int wReserved;
+ union {
+ unsigned int dwOemId;
+ struct {
+ int wProcessorArchitecture;
+ int wReserved;
+ };
};
- };
- unsigned int dwPageSize;
- void *lpMinimumApplicationAddress;
- void *lpMaximumApplicationAddress;
- void *dwActiveProcessorMask;
- unsigned int dwNumberOfProcessors;
- unsigned int dwProcessorType;
- unsigned int dwAllocationGranularity;
- int wProcessorLevel;
- int wProcessorRevision;
+ unsigned int dwPageSize;
+ void *lpMinimumApplicationAddress;
+ void *lpMaximumApplicationAddress;
+ void *dwActiveProcessorMask;
+ unsigned int dwNumberOfProcessors;
+ unsigned int dwProcessorType;
+ unsigned int dwAllocationGranularity;
+ int wProcessorLevel;
+ int wProcessorRevision;
} SYSTEM_INFO;
typedef struct {
- unsigned int dwOSVersionInfoSize;
- unsigned int dwMajorVersion;
- unsigned int dwMinorVersion;
- unsigned int dwBuildNumber;
- unsigned int dwPlatformId;
- wchar_t szCSDVersion[128];
+ unsigned int dwOSVersionInfoSize;
+ unsigned int dwMajorVersion;
+ unsigned int dwMinorVersion;
+ unsigned int dwBuildNumber;
+ unsigned int dwPlatformId;
+ wchar_t szCSDVersion[128];
} OSVERSIONINFOW;
#endif
@@ -337,7 +337,6 @@ static int MacOSXGetLibraryPath(Tcl_Interp *interp,
MODULE_SCOPE long tclMacOSXDarwinRelease;
long tclMacOSXDarwinRelease = 0;
#endif
-
/*
*---------------------------------------------------------------------------
@@ -600,17 +599,21 @@ SearchKnownEncodings(
int left = 0;
int right = sizeof(localeTable)/sizeof(LocaleTable);
+ /* Here, search for i in the interval left <= i < right. */
while (left < right) {
int test = (left + right)/2;
int code = strcmp(localeTable[test].lang, encoding);
if (code == 0) {
+ /* Found it at i == test. */
return localeTable[test].encoding;
}
if (code < 0) {
+ /* Restrict the search to the interval test < i < right. */
left = test+1;
} else {
- right = test-1;
+ /* Restrict the search to the interval left <= i < test. */
+ right = test;
}
}
return NULL;
@@ -853,15 +856,15 @@ TclpSetVariables(
}
}
#endif /* HAVE_COREFOUNDATION */
- p = pkgPath;
- while ((q = strchr(p, ':')) != NULL) {
- Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p));
- p = q+1;
- }
- if (*p) {
- Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1));
- }
- Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_pkgPath", -1), NULL, pkgListObj, TCL_GLOBAL_ONLY);
+ p = pkgPath;
+ while ((q = strchr(p, ':')) != NULL) {
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p));
+ p = q+1;
+ }
+ if (*p) {
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1));
+ }
+ Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_pkgPath", -1), NULL, pkgListObj, TCL_GLOBAL_ONLY);
#ifdef DJGPP
Tcl_SetVar2(interp, "tcl_platform", "platform", "dos", TCL_GLOBAL_ONLY);