From 00465c76fba612037e4ad1fd1b84e6045b674e08 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Mon, 9 Jan 2006 17:58:57 +0000 Subject: Changed the name of the "ret" variable in mb_niceformat() to "cnt" because "ret" is usually used for a variable name to hold the return value of the function. Also, changed the test when checking for a \0 to only check if "cnt" is 0, since we must always change a value of 0 to 1. --- Src/Zle/zle_utils.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index f4f3869b8..c4abad69d 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -275,36 +275,35 @@ stringaszleline(char *instr, int incs, int *outll, int *outsz, int *outcs) memset(&ps, '\0', sizeof(ps)); while (ll > 0) { - size_t ret = mbrtowc(outptr, inptr, ll, &ps); + size_t cnt = mbrtowc(outptr, inptr, ll, &ps); /* * At this point we don't handle either incomplete (-2) or * invalid (-1) multibyte sequences. Use the current length * and return. */ - if (ret == (size_t)-1 || ret == (size_t)-2) + if (cnt == (size_t)-1 || cnt == (size_t)-2) break; /* * Careful: converting a wide NUL returns zero, but we * want to treat NULs as regular characters. - * The NUL does get converted, however, so test that. * Assume it was represented by a single ASCII NUL; * certainly true for Unicode and unlikely to be false * in any non-pathological multibyte representation. */ - if (*outptr == L'\0' && ret == 0) - ret = 1; + if (cnt == 0) + cnt = 1; if (outcs) { int offs = inptr - instr; - if (offs <= incs && incs < offs + (int)ret) + if (offs <= incs && incs < offs + (int)cnt) *outcs = outptr - outstr; } - inptr += ret; + inptr += cnt; outptr++; - ll -= ret; + ll -= cnt; } if (outcs && inptr <= instr + incs) *outcs = outptr - outstr; -- cgit 1.4.1