about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-12-19 13:01:43 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-12-19 13:01:43 +0000
commit507c58262a4d2b09f8ce58539fd497c6ecc2c5fc (patch)
treedfed9f9ae2ae2db3e491ab42b800feaeba94feed
parent3778f5a3ba05b542109bbaef6b7de94f145e47cc (diff)
downloadzsh-507c58262a4d2b09f8ce58539fd497c6ecc2c5fc.tar.gz
zsh-507c58262a4d2b09f8ce58539fd497c6ecc2c5fc.tar.xz
zsh-507c58262a4d2b09f8ce58539fd497c6ecc2c5fc.zip
23071: signed characters with no multibyte support
-rw-r--r--ChangeLog3
-rw-r--r--Src/utils.c11
2 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b00e8644..51f92be7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-12-19  Peter Stephenson  <pws@csr.com>
 
+	* 23071: Src/utils.c: problem with signed characters with
+	no multibyte support.
+
 	* 23070: Test/C02cond.ztst: Skip [[ -N file ]] test on NFS
 	file systems.
 
diff --git a/Src/utils.c b/Src/utils.c
index a0f762896..d4bf6c2eb 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4146,15 +4146,20 @@ mb_metastrlen(char *ptr, int width)
 
 /**/
 mod_export int
-metacharlenconv(char *x, int *c)
+metacharlenconv(const char *x, int *c)
 {
+    /*
+     * Here we don't use STOUC() on the chars since they
+     * may be compared against other chars and this will fail
+     * if chars are signed and the high bit is set.
+     */
     if (*x == Meta) {
 	if (c)
-	    *c = STOUC(x[1]) ^ 32;
+	    *c = x[1] ^ 32;
 	return 2;
     }
     if (c)
-	*c = STOUC(*x);
+	*c = (char)*x;
     return 1;
 }