From ef5db47cf7f41810dc43e8420b21b658ef39058f Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 14 Feb 2021 11:42:26 -0600 Subject: [PATCH] Make `const_strlen` return an unsigned value --- src/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.h b/src/common.h index 13b05792e..3bf06bef1 100644 --- a/src/common.h +++ b/src/common.h @@ -732,7 +732,7 @@ static_assert(const_strcmp("b", "aa") > 0, "const_strcmp failure"); /// Compile-time agnostic-size strlen/wcslen implementation. Unicode-unaware. template -constexpr ssize_t const_strlen(const T *str) { +constexpr size_t const_strlen(const T *str) { return *str == static_cast(0) ? 0 : 1 + const_strlen(str + 1); } static_assert(const_strlen("") == 0, "const_strlen failure");