about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2006-01-09 00:17:24 +0000
committerWayne Davison <wayned@users.sourceforge.net>2006-01-09 00:17:24 +0000
commit9cf3f9ad719454ede4dba505fa17bbd5c0376478 (patch)
tree55d62e1e050bf24ddb16efb0a6b0e130728b81d9 /Src/Zle
parentc7c713939d305b6dc898acce61d0ce30b1a051cc (diff)
downloadzsh-9cf3f9ad719454ede4dba505fa17bbd5c0376478.tar.gz
zsh-9cf3f9ad719454ede4dba505fa17bbd5c0376478.tar.xz
zsh-9cf3f9ad719454ede4dba505fa17bbd5c0376478.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.
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_refresh.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index bd3875e19..dad4960cb 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1492,10 +1492,10 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
     /* Reset shift state, maybe. */
     memset(&ps, '\0', sizeof(ps));
     for (lpptr = lpromptbuf; lpptr < lpend; ) {
-	t0 = mbrtowc(lpwp, lpptr, lpend - lpptr, &ps);
-	if (t0 > 0) {
+	size_t cnt = mbrtowc(lpwp, lpptr, lpend - lpptr, &ps);
+	if (cnt != 0 && cnt != (size_t)-1 && cnt != (size_t)-2) {
 	    /* successfully converted */
-	    lpptr += t0;
+	    lpptr += cnt;
 	    lpwp++;
 	} else {
 	    /* dunno, try to recover */