aboutsummaryrefslogtreecommitdiff
path: root/text-util.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-10-05 22:06:06 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-10-05 22:06:06 +0200
commitfc575f6986d19205a3b97f1813246529c6d2fc79 (patch)
tree73f14c6bae1306f9510f95579438d18fcaf01754 /text-util.c
parente3c1f30e6d8dc15b35842d847f87954b4aa046e0 (diff)
downloadvis-fc575f6986d19205a3b97f1813246529c6d2fc79.tar.gz
vis-fc575f6986d19205a3b97f1813246529c6d2fc79.tar.xz
Fix various issues reported by coverity scan
Diffstat (limited to 'text-util.c')
-rw-r--r--text-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/text-util.c b/text-util.c
index c7a1349..f3ba0a0 100644
--- a/text-util.c
+++ b/text-util.c
@@ -84,7 +84,6 @@ int text_string_width(const char *data, size_t len) {
const char *s = data;
while (len > 0) {
- char buf[MB_CUR_MAX];
wchar_t wc;
size_t wclen = mbrtowc(&wc, s, len, &ps);
if (wclen == (size_t)-1 && errno == EILSEQ) {
@@ -98,7 +97,7 @@ int text_string_width(const char *data, size_t len) {
/* assume NUL byte will be displayed as ^@ */
width += 2;
wclen = 1;
- } else if (buf[0] == '\t') {
+ } else if (wc == L'\t') {
width++;
wclen = 1;
} else {