From b319fb089c144312ab9141d6f6469d50d9d7a1ea Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 27 Sep 2013 15:54:21 -0400 Subject: Fix compile warnings and errors found by clang --- include/anope.h | 9 ++++----- include/hashcomp.h | 8 +++++--- include/modules/os_session.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/anope.h b/include/anope.h index 972e49b7f..e4a654b78 100644 --- a/include/anope.h +++ b/include/anope.h @@ -312,7 +312,7 @@ namespace Anope { inline size_t operator()(const string &s) const { - return std::tr1::hash()(s.lower().str()); + return TR1NS::hash()(s.lower().str()); } }; @@ -320,7 +320,7 @@ namespace Anope { inline size_t operator()(const string &s) const { - return std::tr1::hash()(s.str()); + return TR1NS::hash()(s.str()); } }; @@ -334,7 +334,7 @@ namespace Anope template class map : public std::map { }; template class multimap : public std::multimap { }; - template class hash_map : public std::tr1::unordered_map { }; + template class hash_map : public TR1NS::unordered_map { }; static const char *const compiled = __TIME__ " " __DATE__; @@ -716,8 +716,7 @@ template inline void convert(const Anope::string &s, T &x, Anope::st leftover.clear(); std::istringstream i(s.str()); char c; - bool res = i >> x; - if (!res) + if (!(i >> x)) throw ConvertException("Convert fail"); if (failIfLeftoverChars) { diff --git a/include/hashcomp.h b/include/hashcomp.h index 38c0e3833..540f1dbe4 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -13,10 +13,12 @@ #include #include -#ifndef _WIN32 -#include -#else +#if defined _LIBCPP_VERSION || defined _WIN32 #include +#define TR1NS std +#else +#include +#define TR1NS std::tr1 #endif #include "services.h" diff --git a/include/modules/os_session.h b/include/modules/os_session.h index f3077d0ac..31f02cf9d 100644 --- a/include/modules/os_session.h +++ b/include/modules/os_session.h @@ -27,7 +27,7 @@ struct Exception : Serializable class SessionService : public Service { public: - typedef std::tr1::unordered_map SessionMap; + typedef TR1NS::unordered_map SessionMap; typedef std::vector ExceptionVector; SessionService(Module *m) : Service(m, "SessionService", "session") { } -- cgit