Skip to content

Commit

Permalink
Fixes a warning treated as an error for GCC 13 (#138)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
elviscapiaq authored Oct 22, 2024
1 parent 002ffe5 commit 89b9044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/hover_help_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 89b9044

Please sign in to comment.