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 <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
PulkoMandy
2024-05-03 16:38:23 +00:00
committed by waddlesplash
parent 7eab6b486e
commit 7d5b913b51
+2 -1
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);