about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2006-01-09 00:29:57 +0000
committerWayne Davison <wayned@users.sourceforge.net>2006-01-09 00:29:57 +0000
commit74b4973888d2fc3ccb8bfdfb6180c0145220609e (patch)
treead9101f5eb176794fed9b7d482c68fb05a1cb7c6 /Src
parent9cf3f9ad719454ede4dba505fa17bbd5c0376478 (diff)
downloadzsh-74b4973888d2fc3ccb8bfdfb6180c0145220609e.tar.gz
zsh-74b4973888d2fc3ccb8bfdfb6180c0145220609e.tar.xz
zsh-74b4973888d2fc3ccb8bfdfb6180c0145220609e.zip
The return value of mbrtowc() is a size_t (unsigned), so don't
assign it to an int and then check if it's > 0, as that won't
work on a system where an int is larger than a size_t.  Also,
we needed to use STOUC() on a char value passed to nicechar().
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 5c1de23dd..f4f3869b8 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -778,7 +778,7 @@ showmsg(char const *msg)
     ZLE_CHAR_T c;
 #ifdef MULTIBYTE_SUPPORT
     char *umsg;
-    int ulen, ret;
+    int ulen;
     size_t width;
     mbstate_t ps;
 #endif
@@ -804,15 +804,15 @@ showmsg(char const *msg)
 	    /*
 	     * Extract the next wide character from the multibyte string.
 	     */
-	    ret = mbrtowc(&c, p, ulen, &ps);
+	    size_t ret = mbrtowc(&c, p, ulen, &ps);
 
-	    if (ret <= 0) {
+	    if (ret == 0 || ret == (size_t)-1 || ret == (size_t)-2) {
 		/*
 		 * This really shouldn't be happening here, but...
 		 * Treat it as a single byte character; it may get
 		 * prettified.
 		 */
-		n = nicechar(*p);
+		n = nicechar(STOUC(*p));
 		ret = 1;
 		width = strlen(n);
 	    } else