From 57fcc3fe16eb5d3574bdf24d9795fe8919e63ba9 Mon Sep 17 00:00:00 2001 From: kcgen Date: Thu, 21 Oct 2021 07:30:53 -0700 Subject: [PATCH] Limit verbosity number when populating the warning level string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes CI failure: /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: ‘__builtin___snprintf_chk’ output between 5 and 11 bytes into a destination of size 5 64 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 65 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors CMakeFiles/loguru_test.dir/build.make:75: recipe for target 'CMakeFiles/loguru_test.dir/loguru_test.cpp.o' failed make[2]: *** [CMakeFiles/loguru_test.dir/loguru_test.cpp.o] Error 1 CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/loguru_test.dir/all' failed make[1]: *** [CMakeFiles/loguru_test.dir/all] Error 2 Makefile:100: recipe for target 'all' failed make: *** [all] Error 2 CMake Error at test/appveyor.cmake:22 (_message): --- loguru.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loguru.cpp b/loguru.cpp index 9032245..e79b3de 100644 --- a/loguru.cpp +++ b/loguru.cpp @@ -1317,7 +1317,7 @@ namespace loguru if (custom_level_name) { snprintf(level_buff, sizeof(level_buff) - 1, "%s", custom_level_name); } else { - snprintf(level_buff, sizeof(level_buff) - 1, "% 4d", verbosity); + snprintf(level_buff, sizeof(level_buff) - 1, "%4d", static_cast(verbosity) % 9999); } size_t pos = 0;