From 89b90442e689406bfd3e2da390ec8dd352077c0b Mon Sep 17 00:00:00 2001 From: Elvis Capia <116971915+elviscapiaq@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:06:25 +0000 Subject: [PATCH] Fixes a warning treated as an error for GCC 13 (#138) - For building Dive with GCC 13 in Release mode, a warning in `snprintf` treated as an error is produced. - Adding an extra byte for null terminator in `snprintf` fixes the warning. --- ui/hover_help_model.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/hover_help_model.cpp b/ui/hover_help_model.cpp index 1cf5746c3..81d9a1ff8 100644 --- a/ui/hover_help_model.cpp +++ b/ui/hover_help_model.cpp @@ -73,7 +73,7 @@ void HoverHelp::SetCurItem(Item item, ; #define CASE(index, ...) \ case Item::index: \ - cur_string_size = snprintf(NULL, 0, __VA_ARGS__); \ + cur_string_size = snprintf(NULL, 0, __VA_ARGS__) + 1; \ cur_string.resize(cur_string_size); \ snprintf(&cur_string[0], cur_string_size, __VA_ARGS__); \ break;