From 8882a6ca78e90d2980a3cd8d53acea9d2137f8b8 Mon Sep 17 00:00:00 2001 From: Naios Date: Wed, 11 Mar 2015 08:17:37 +0100 Subject: Core/Log: Fix some issues detected by static analysis. * Either inefficient or wrong usage of string::find(). string::compare() will be faster if string::find's result is compared with 0, because it will not scan the whole string. If your intention is to check that there are no findings in the string, you should compare with std::string::npos. * C-style pointer casting detected. C++ offers four different kinds of casts as replacements: static_cast, const_cast, dynamic_cast and reinterpret_cast. --- src/server/shared/Logging/Log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/shared/Logging/Log.cpp') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 4bf4dacb302..aa432128171 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -376,7 +376,7 @@ void Log::SetRealmId(uint32 id) { for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) if (it->second && it->second->getType() == APPENDER_DB) - ((AppenderDB *)it->second)->setRealmId(id); + static_cast(it->second)->setRealmId(id); } void Log::Close() -- cgit v1.2.3