From b81207a04ecb5057b2b6efa0f3a6288b6e969aef Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 18 Mar 2011 14:42:51 +0100 Subject: COMMON: Replace some vsnprintf/STRINGBUFLEN uses by vformat --- common/debug.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'common/debug.cpp') diff --git a/common/debug.cpp b/common/debug.cpp index dbbb204deb..0dae344bb2 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -107,18 +107,13 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel) { #ifndef DISABLE_TEXT_CONSOLE static void debugHelper(const char *s, va_list va, bool caret = true) { - char buf[STRINGBUFLEN]; + Common::String buf = Common::String::vformat(s, va); - vsnprintf(buf, STRINGBUFLEN, s, va); - buf[STRINGBUFLEN-1] = '\0'; - - if (caret) { - buf[STRINGBUFLEN-2] = '\0'; - strcat(buf, "\n"); - } + if (caret) + buf += '\n'; if (g_system) - g_system->logMessage(LogMessageType::kDebug, buf); + g_system->logMessage(LogMessageType::kDebug, buf.c_str()); // TODO: Think of a good fallback in case we do not have // any OSystem yet. } -- cgit v1.2.3 From aa0f307e06e5aae3b12f9f15b350dc81b30d61de Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Tue, 28 Jun 2011 02:06:23 +0300 Subject: ALL: Require DECLARE_SINGLETON to be used in the Common namepsace Silences the clang warning: static data member specialization of '_singleton' must originally be declared in namespace 'Common'; accepted as a C++0x extension [-Wc++0x-extensions] Wrapping "namespace Common {}" around the macro assignment causes clang to complain about a spurious semicolon, and removing the semicolon at the end of the macro causes some editors to misbehave. Changing the requirement of using the macro in one namespace (the global) to another (Common) seems a small price to pay to silence a warning. --- common/debug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/debug.cpp') diff --git a/common/debug.cpp b/common/debug.cpp index 0dae344bb2..50f99753db 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -29,10 +29,10 @@ // TODO: Move gDebugLevel into namespace Common. int gDebugLevel = -1; -DECLARE_SINGLETON(Common::DebugManager); - namespace Common { +DECLARE_SINGLETON(DebugManager); + namespace { struct DebugLevelComperator { -- cgit v1.2.3 From 7e4224e52a2202ba98dd93ffe209d231e5c1d35c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jul 2011 00:15:30 +0200 Subject: COMMON: Fix compilation when USE_HASHMAP_MEMORY_POOL is not defined. --- common/debug.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'common/debug.cpp') diff --git a/common/debug.cpp b/common/debug.cpp index 50f99753db..9c3a93e5a6 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -23,6 +23,7 @@ #include "common/debug-channels.h" #include "common/system.h" #include "common/textconsole.h" +#include "common/algorithm.h" #include // For va_list etc. -- cgit v1.2.3