diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-04-29 12:58:21 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-04-29 12:58:21 +0000 |
commit | 396c966cd2b3af2dbdb5b157e9ebb2e576b677b0 (patch) | |
tree | ee5c819fb7fae346ec982a8c34d642975de31aee | |
parent | 94d849ad87bd53c6c51530ea7c0b084ca6899533 (diff) | |
download | mana-396c966cd2b3af2dbdb5b157e9ebb2e576b677b0.tar.gz mana-396c966cd2b3af2dbdb5b157e9ebb2e576b677b0.tar.bz2 mana-396c966cd2b3af2dbdb5b157e9ebb2e576b677b0.tar.xz mana-396c966cd2b3af2dbdb5b157e9ebb2e576b677b0.zip |
When compiling with GCC, use the printf format attribute for the log method so
that the compiler checks the type of its parameters.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/log.h | 6 | ||||
-rw-r--r-- | src/resources/imageset.cpp | 2 |
3 files changed, 9 insertions, 2 deletions
@@ -10,6 +10,9 @@ * src/gui/gccontainer.h, src/gui/gccontainer.cpp: Removed unused option from GCContainer to not delete a child, fixing warnings about hiding virtual method gcn::Container::add. + * src/log.h, src/resources/imageset.cpp: When compiling with GCC, use + the printf format attribute for the log method so that the compiler + checks the type of its parameters. 2008-04-28 Bjørn Lindeijer <bjorn@lindeijer.nl> @@ -61,7 +61,11 @@ class Logger /** * Enters a message in the log. The message will be timestamped. */ - void log(const char *log_text, ...); + void log(const char *log_text, ...) +#ifdef __GNUC__ + __attribute__((__format__(__printf__, 2, 3))) +#endif + ; /** * Log an error and quit. The error will pop-up in Windows and will be diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 08a6a110..4b6dd592 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -54,7 +54,7 @@ ImageSet::get(size_type i) { if (i >= mImages.size()) { - logger->log("Warning: Sprite #%i does not exist in this image set", i); + logger->log("Warning: No sprite %d in this image set", (int) i); return NULL; } else |