Skip to content

Commit

Permalink
Limit verbosity number when populating the warning level string
Browse files Browse the repository at this point in the history
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):
  • Loading branch information
kcgen committed Oct 21, 2021
1 parent a9f232d commit 57fcc3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion loguru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(verbosity) % 9999);
}

size_t pos = 0;
Expand Down

0 comments on commit 57fcc3f

Please sign in to comment.