From 82e197072bfe5d1641a505874618a52408c2280b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 22 Aug 2020 10:56:53 +0200 Subject: [PATCH] config: don't pass -1 to mbstowcs(), silences linker(?) warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'n' _is_ ignored when 'dest' is NULL, but you can still get the following warning: In function ‘mbstowcs’, inlined from ‘parse_section_scrollback’ at ../config.c:429:26: /usr/include/bits/stdlib.h:129:10: warning: ‘__mbstowcs_alias’ specified size 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] 129 | return __mbstowcs_alias (__dst, __src, __len); To silence this warning, pass 0 instead, since it is ignored anyway. --- config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index 40a7e81b..1fa46e18 100644 --- a/config.c +++ b/config.c @@ -426,9 +426,11 @@ parse_section_scrollback(const char *key, const char *value, struct config *conf free(conf->scrollback.indicator.text); conf->scrollback.indicator.text = NULL; - size_t len = mbstowcs(NULL, value, -1); + size_t len = mbstowcs(NULL, value, 0); if (len < 0) { - LOG_AND_NOTIFY_ERRNO("%s:%d: [scrollback]: indicator-format: invalid value: %s", path, lineno, value); + LOG_AND_NOTIFY_ERRNO( + "%s:%d: [scrollback]: indicator-format: " + "invalid value: %s", path, lineno, value); return false; }