summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-01-28 11:12:08 -0500
committerTavian Barnes <tavianator@tavianator.com>2021-01-28 11:12:46 -0500
commitbcfbb81b8b3fe6a1d59c2097b4741bd4aae344e4 (patch)
tree934e14e610e35bc1feecaf2be86d7e3ef23b71a8 /eval.c
parentcbb898e0c4103b9707c8abb9ebf4866a0353c0f9 (diff)
downloadbfs-bcfbb81b8b3fe6a1d59c2097b4741bd4aae344e4.tar.xz
Enable -Wshadow by default
And fix the one case it warns on.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/eval.c b/eval.c
index 6abdaf2..2bcfa8a 100644
--- a/eval.c
+++ b/eval.c
@@ -1098,24 +1098,24 @@ static void eval_status(struct eval_state *state, struct bfs_bar *bar, struct ti
while (pathlen > 0) {
wchar_t wc;
size_t len = mbrtowc(&wc, path, pathlen, &mb);
- int width;
+ int cwidth;
if (len == (size_t)-1) {
- // Invalid byte sequence, assume a single-width ?
+ // Invalid byte sequence, assume a single-width '?'
len = 1;
- width = 1;
+ cwidth = 1;
memset(&mb, 0, sizeof(mb));
} else if (len == (size_t)-2) {
- // Incomplete byte sequence, assume a single-width ?
+ // Incomplete byte sequence, assume a single-width '?'
len = pathlen;
- width = 1;
+ cwidth = 1;
} else {
- width = wcwidth(wc);
- if (width < 0) {
- width = 0;
+ cwidth = wcwidth(wc);
+ if (cwidth < 0) {
+ cwidth = 0;
}
}
- if (pathwidth + width > pathmax) {
+ if (pathwidth + cwidth > pathmax) {
break;
}
@@ -1125,7 +1125,7 @@ static void eval_status(struct eval_state *state, struct bfs_bar *bar, struct ti
path += len;
pathlen -= len;
- pathwidth += width;
+ pathwidth += cwidth;
}
if (dstrcat(&status, "...") != 0) {