summaryrefslogtreecommitdiff
path: root/src/common/strlib.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-08-07 03:39:13 +0200
committerHaru <haru@dotalux.com>2014-08-07 05:37:38 +0200
commitc45e3fa9793a273a0eab40d1626bcda7d710552c (patch)
tree4f6c9d47770a15c8cbfe065f7ee9203f77e57022 /src/common/strlib.h
parentcaf89724767465ecf339c391bb6d7a937d563fb2 (diff)
downloadhercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.gz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.bz2
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.xz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.zip
Corrected several format-string errors through the code
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/strlib.h')
-rw-r--r--src/common/strlib.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/strlib.h b/src/common/strlib.h
index 7f84d2893..00a588772 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -82,7 +82,7 @@ struct strlib_interface {
/// Works like snprintf, but always null-terminates the buffer.
/// Returns the size of the string (without null-terminator)
/// or -1 if the buffer is too small.
- int (*safesnprintf) (char* buf, size_t sz, const char* fmt, ...);
+ int (*safesnprintf) (char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
/// Returns the line of the target position in the string.
/// Lines start at 1.
@@ -99,7 +99,7 @@ struct strlib_interface *strlib;
struct stringbuf_interface {
StringBuf* (*Malloc) (void);
void (*Init) (StringBuf* self);
- int (*Printf) (StringBuf* self, const char* fmt, ...);
+ int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
int (*Vprintf) (StringBuf* self, const char* fmt, va_list args);
int (*Append) (StringBuf* self, const StringBuf *sbuf);
int (*AppendStr) (StringBuf* self, const char* str);