BCatalog: declare GetString as format_printf function

This tells the compiler that this function takes a format string as a
parameter, and returns a "similar" string with the same formatting
operations. This allows the format string to "propagate" to prinf-file
functions (including BString::SetToFormat) and the format string to be
actually checked with the arguments passed to that function.

Without this, all translated strings were not checked to match with
their arguments.

Change-Id: I5c3c5cbfe7dfede9a6f45cad47a7524f9138fac0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7663
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
PulkoMandy 2024-05-03 10:01:53 +02:00 committed by waddlesplash
parent 7eab6b486e
commit 7d5b913b51
1 changed files with 2 additions and 1 deletions

View File

@ -31,7 +31,8 @@ public:
const char* GetString(const char* string,
const char* context = NULL,
const char* comment = NULL);
const char* comment = NULL)
__attribute__((format_arg(2)));
const char* GetString(uint32 id);
status_t GetData(const char* name, BMessage* msg);