From 74b4973888d2fc3ccb8bfdfb6180c0145220609e Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 9 Jan 2006 00:29:57 +0000 Subject: 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(). --- Src/Zle/zle_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Src') 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 -- cgit 1.4.1