Mark up a few functions for format string checking
Commit Message
The attached patch allows gcc to do some extra checking on the arguments of
certain functions (variadic ones which call vprintf or similar). It hasn't
caught any problems in vdr, but it may help plugin authors...
@@ -51,7 +51,7 @@
time_t lastActivity;
void Close(bool Timeout = false);
bool Send(const char *s, int length = -1);
- void Reply(int Code, const char *fmt, ...);
+ void Reply(int Code, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
void PrintHelpTopics(const char **hp);
void CmdCHAN(const char *Option);
void CmdCLRE(const char *Option);
@@ -106,7 +106,7 @@
///< the thread starts and stops. The Start() function must be called
///< to actually start the thread.
virtual ~cThread();
- void SetDescription(const char *Description, ...);
+ void SetDescription(const char *Description, ...) __attribute__ ((format (printf, 2, 3)));
bool Start(void);
///< Actually starts the thread.
bool Active(void);
@@ -81,7 +81,7 @@
operator const char * () const { return s; } // for use in (const char *) context
const char * operator*() const { return s; } // for use in (const void *) context (printf() etc.)
cString &operator=(const cString &String);
- static cString sprintf(const char *fmt, ...);
+ static cString sprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
};
ssize_t safe_read(int filedes, void *buffer, size_t size);