From 7d5b913b517253529ca1562faa4bc5c7275e0898 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Fri, 3 May 2024 10:01:53 +0200 Subject: [PATCH] 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 Haiku-Format: Haiku-format Bot Reviewed-by: waddlesplash --- headers/os/locale/Catalog.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/headers/os/locale/Catalog.h b/headers/os/locale/Catalog.h index 5cc4500c4b..fb5ca9a101 100644 --- a/headers/os/locale/Catalog.h +++ b/headers/os/locale/Catalog.h @@ -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);