summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-09-27 15:54:21 -0400
committerAdam <Adam@anope.org>2013-09-27 19:11:02 -0400
commitb319fb089c144312ab9141d6f6469d50d9d7a1ea (patch)
treeb6da2ec3a23ff7f2da9ae6ce35d591faa6f57d72
parent17196887ad1e6f9886c6cd3109bd8ede16ae7343 (diff)
Fix compile warnings and errors found by clang
-rw-r--r--include/anope.h9
-rw-r--r--include/hashcomp.h8
-rw-r--r--include/modules/os_session.h2
-rw-r--r--modules/commands/bs_badwords.cpp5
-rw-r--r--modules/commands/cs_seen.cpp2
-rw-r--r--modules/commands/ns_cert.cpp18
-rw-r--r--modules/commands/ns_getpass.cpp2
-rw-r--r--modules/commands/os_dns.cpp2
-rw-r--r--modules/m_dns.cpp5
-rw-r--r--modules/protocol/inspircd12.cpp2
10 files changed, 27 insertions, 28 deletions
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<std::string>()(s.lower().str());
+ return TR1NS::hash<std::string>()(s.lower().str());
}
};
@@ -320,7 +320,7 @@ namespace Anope
{
inline size_t operator()(const string &s) const
{
- return std::tr1::hash<std::string>()(s.str());
+ return TR1NS::hash<std::string>()(s.str());
}
};
@@ -334,7 +334,7 @@ namespace Anope
template<typename T> class map : public std::map<string, T, ci::less> { };
template<typename T> class multimap : public std::multimap<string, T, ci::less> { };
- template<typename T> class hash_map : public std::tr1::unordered_map<string, T, hash_ci, compare> { };
+ template<typename T> class hash_map : public TR1NS::unordered_map<string, T, hash_ci, compare> { };
static const char *const compiled = __TIME__ " " __DATE__;
@@ -716,8 +716,7 @@ template<typename T> 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 <string>
#include <locale>
-#ifndef _WIN32
-#include <tr1/unordered_map>
-#else
+#if defined _LIBCPP_VERSION || defined _WIN32
#include <unordered_map>
+#define TR1NS std
+#else
+#include <tr1/unordered_map>
+#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<cidr, Session *, cidr::hash> SessionMap;
+ typedef TR1NS::unordered_map<cidr, Session *, cidr::hash> SessionMap;
typedef std::vector<Exception *> ExceptionVector;
SessionService(Module *m) : Service(m, "SessionService", "session") { }
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index 41cfb7f4c..406ec0f03 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -202,10 +202,9 @@ class CommandBSBadwords : public Command
class BadwordsListCallback : public NumberList
{
ListFormatter &list;
- ChannelInfo *ci;
BadWords *bw;
public:
- BadwordsListCallback(ListFormatter &_list, ChannelInfo *_ci, BadWords *_bw, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci), bw(_bw)
+ BadwordsListCallback(ListFormatter &_list, BadWords *_bw, const Anope::string &numlist) : NumberList(numlist, false), list(_list), bw(_bw)
{
}
@@ -222,7 +221,7 @@ class CommandBSBadwords : public Command
this->list.AddEntry(entry);
}
}
- nl_list(list, ci, bw, word);
+ nl_list(list, bw, word);
nl_list.Process();
}
else
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp
index 8a48fafc6..b483e9e74 100644
--- a/modules/commands/cs_seen.cpp
+++ b/modules/commands/cs_seen.cpp
@@ -183,7 +183,7 @@ class CommandOSSeen : public Command
class CommandSeen : public Command
{
- void SimpleSeen(CommandSource &source, const std::vector<Anope::string> &params) anope_override
+ void SimpleSeen(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!source.c || !source.c->ci)
{
diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp
index c8274f4d6..a4a335fa0 100644
--- a/modules/commands/ns_cert.cpp
+++ b/modules/commands/ns_cert.cpp
@@ -104,13 +104,13 @@ struct NSCertListImpl : NSCertList
if (s->GetSerializableType()->GetName() != "NickCore")
return;
- const NickCore *nc = anope_dynamic_static_cast<const NickCore *>(e);
- NSCertList *certs = this->Get(nc);
- if (certs == NULL || !certs->GetCertCount())
+ const NickCore *n = anope_dynamic_static_cast<const NickCore *>(e);
+ NSCertList *c = this->Get(n);
+ if (c == NULL || !c->GetCertCount())
return;
- for (unsigned i = 0; i < certs->GetCertCount(); ++i)
- data["cert"] << certs->GetCert(i) << " ";
+ for (unsigned i = 0; i < c->GetCertCount(); ++i)
+ data["cert"] << c->GetCert(i) << " ";
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
@@ -118,15 +118,15 @@ struct NSCertListImpl : NSCertList
if (s->GetSerializableType()->GetName() != "NickCore")
return;
- NickCore *nc = anope_dynamic_static_cast<NickCore *>(e);
- NSCertListImpl *certs = this->Require(nc);
+ NickCore *n = anope_dynamic_static_cast<NickCore *>(e);
+ NSCertListImpl *c = this->Require(n);
Anope::string buf;
data["cert"] >> buf;
spacesepstream sep(buf);
- certs->certs.clear();
+ c->certs.clear();
while (sep.GetToken(buf))
- certs->certs.push_back(buf);
+ c->certs.push_back(buf);
}
};
};
diff --git a/modules/commands/ns_getpass.cpp b/modules/commands/ns_getpass.cpp
index cb320ad76..1d2bef754 100644
--- a/modules/commands/ns_getpass.cpp
+++ b/modules/commands/ns_getpass.cpp
@@ -65,7 +65,7 @@ class NSGetPass : public Module
{
Anope::string tmp_pass = "plain:tmp";
- if (Anope::Decrypt(tmp_pass, tmp_pass) == -1)
+ if (!Anope::Decrypt(tmp_pass, tmp_pass))
throw ModuleException("Incompatible with the encryption module being used");
}
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp
index 7c13a1dbb..9cb51bca2 100644
--- a/modules/commands/os_dns.cpp
+++ b/modules/commands/os_dns.cpp
@@ -10,7 +10,7 @@
static ServiceReference<DNS::Manager> dnsmanager("DNS::Manager", "dns/manager");
-class DNSZone;
+struct DNSZone;
class DNSServer;
static Serialize::Checker<std::vector<DNSZone *> > zones("DNSZone");
diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp
index 01524d1ca..1637ccd98 100644
--- a/modules/m_dns.cpp
+++ b/modules/m_dns.cpp
@@ -464,14 +464,13 @@ class TCPSocket : public ListenSocket
class Client : public ClientSocket, public Timer, public ReplySocket
{
Manager *manager;
- TCPSocket *tcpsock;
Packet *packet;
unsigned char packet_buffer[524];
int length;
public:
Client(Manager *m, TCPSocket *l, int fd, const sockaddrs &addr) : Socket(fd, l->IsIPv6()), ClientSocket(l, addr), Timer(5),
- manager(m), tcpsock(l), packet(NULL), length(0)
+ manager(m), packet(NULL), length(0)
{
Log(LOG_DEBUG_2) << "Resolver: New client from " << addr.addr();
}
@@ -649,7 +648,7 @@ class MyManager : public Manager, public Timer
{
uint32_t serial;
- typedef std::tr1::unordered_map<Question, Query, Question::hash> cache_map;
+ typedef TR1NS::unordered_map<Question, Query, Question::hash> cache_map;
cache_map cache;
TCPSocket *tcpsock;
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index ab32f76a7..ab513992b 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -367,7 +367,7 @@ class InspIRCd12Proto : public IRCDProto
UplinkSocket::Message(Me) << "ENDBURST";
}
- void SendGlobopsInternal(BotInfo *source, const Anope::string &buf)
+ void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override
{
if (Servers::Capab.count("GLOBOPS"))
UplinkSocket::Message(source) << "SNONOTICE g :" << buf;