Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: signed chars without multibyte support



More confusion with signed chars, which I didn't notice because I
haven't tested for a while on a system with both signed characters and
no multibyte support.  This caused a failure in D04parameter.ztst.

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.147
diff -u -r1.147 utils.c
--- Src/utils.c	8 Dec 2006 18:52:04 -0000	1.147
+++ Src/utils.c	19 Dec 2006 12:51:06 -0000
@@ -4146,15 +4146,20 @@
 
 /**/
 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;
 }
 

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



Messages sorted by: Reverse Date, Date, Thread, Author