From 9cf3f9ad719454ede4dba505fa17bbd5c0376478 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 9 Jan 2006 00:17:24 +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. --- Src/Zle/zle_refresh.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Src') 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 */ -- cgit 1.4.1