summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-01 19:29:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-07-01 19:29:35 (GMT)
commit6e5a44be9a62019141dc57ef80e56145fd22b43c (patch)
tree3bb2fb2fe7c444100b0e1016c0ba6c1471ebcde0
parent076bec1db9709b48ef13b47d84e814a3a390c848 (diff)
parent778f45c5349cd0bc32e3f3bc07d1811f56c7ba3f (diff)
downloadtcl-6e5a44be9a62019141dc57ef80e56145fd22b43c.zip
tcl-6e5a44be9a62019141dc57ef80e56145fd22b43c.tar.gz
tcl-6e5a44be9a62019141dc57ef80e56145fd22b43c.tar.bz2
Fix [5fca83d78c]: [encoding system] is wrong in an ISO-8859-1 locale
-rw-r--r--unix/tclUnixInit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index b72be04..199c71f 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -335,7 +335,6 @@ static int MacOSXGetLibraryPath(Tcl_Interp *interp,
MODULE_SCOPE long tclMacOSXDarwinRelease;
long tclMacOSXDarwinRelease = 0;
#endif
-
/*
*---------------------------------------------------------------------------
@@ -591,17 +590,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;