summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-10-11 15:37:39 -0400
committerAdam <Adam@anope.org>2010-10-11 15:37:39 -0400
commit717c123441bb47a4fab859e8fb3ec8c6ac5b7223 (patch)
tree3be1a3376caafdd8ca9bf75d7acf98020cf94a7c /modules/core
parent0ac77d0e42952765d2899565427ce92679142c17 (diff)
Fixed some warnings
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/ms_cancel.cpp12
-rw-r--r--modules/core/ms_info.cpp58
-rw-r--r--modules/core/ms_set.cpp6
-rw-r--r--modules/core/ns_set.cpp2
-rw-r--r--modules/core/os_session.cpp9
5 files changed, 44 insertions, 43 deletions
diff --git a/modules/core/ms_cancel.cpp b/modules/core/ms_cancel.cpp
index e9a58c9d5..a7d824d38 100644
--- a/modules/core/ms_cancel.cpp
+++ b/modules/core/ms_cancel.cpp
@@ -25,15 +25,15 @@ class CommandMSCancel : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
bool ischan, isforbid;
- Anope::string name = params[0];
+ Anope::string nname = params[0];
MemoInfo *mi;
- if (!(mi = getmemoinfo(name, ischan, isforbid)))
+ if (!(mi = getmemoinfo(nname, ischan, isforbid)))
{
if (isforbid)
- u->SendMessage(MemoServ, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, name.c_str());
+ u->SendMessage(MemoServ, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, nname.c_str());
else
- u->SendMessage(MemoServ, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name.c_str());
+ u->SendMessage(MemoServ, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nname.c_str());
}
else
{
@@ -42,9 +42,9 @@ class CommandMSCancel : public Command
for (i = mi->memos.size() - 1; i >= 0; --i)
if (mi->memos[i]->HasFlag(MF_UNREAD) && u->Account()->display.equals_ci(mi->memos[i]->sender) && !mi->memos[i]->HasFlag(MF_NOTIFYS))
{
- FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(name)->nc, mi, mi->memos[i]->number));
+ FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(nname)->nc, mi, mi->memos[i]->number));
delmemo(mi, mi->memos[i]->number);
- u->SendMessage(MemoServ, MEMO_CANCELLED, name.c_str());
+ u->SendMessage(MemoServ, MEMO_CANCELLED, nname.c_str());
return MOD_CONT;
}
diff --git a/modules/core/ms_info.cpp b/modules/core/ms_info.cpp
index 9c0d07a55..09bf8f97d 100644
--- a/modules/core/ms_info.cpp
+++ b/modules/core/ms_info.cpp
@@ -25,30 +25,30 @@ class CommandMSInfo : public Command
const MemoInfo *mi;
NickAlias *na = NULL;
ChannelInfo *ci = NULL;
- Anope::string name = !params.empty() ? params[0] : "";
+ Anope::string nname = !params.empty() ? params[0] : "";
int hardmax = 0;
- if (!name.empty() && name[0] != '#' && u->Account()->HasPriv("memoserv/info"))
+ if (!nname.empty() && nname[0] != '#' && u->Account()->HasPriv("memoserv/info"))
{
- na = findnick(name);
+ na = findnick(nname);
if (!na)
{
- u->SendMessage(MemoServ, NICK_X_NOT_REGISTERED, name.c_str());
+ u->SendMessage(MemoServ, NICK_X_NOT_REGISTERED, nname.c_str());
return MOD_CONT;
}
else if (na->HasFlag(NS_FORBIDDEN))
{
- u->SendMessage(MemoServ, NICK_X_FORBIDDEN, name.c_str());
+ u->SendMessage(MemoServ, NICK_X_FORBIDDEN, nname.c_str());
return MOD_CONT;
}
mi = &na->nc->memos;
hardmax = na->nc->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
}
- else if (!name.empty() && name[0] == '#')
+ else if (!nname.empty() && nname[0] == '#')
{
- if (!(ci = cs_findchan(name)))
+ if (!(ci = cs_findchan(nname)))
{
- u->SendMessage(MemoServ, CHAN_X_NOT_REGISTERED, name.c_str());
+ u->SendMessage(MemoServ, CHAN_X_NOT_REGISTERED, nname.c_str());
return MOD_CONT;
}
else if (!check_access(u, ci, CA_MEMO))
@@ -59,7 +59,7 @@ class CommandMSInfo : public Command
mi = &ci->memos;
hardmax = ci->HasFlag(CI_MEMO_HARDMAX) ? 1 : 0;
}
- else if (!name.empty()) /* It's not a chan and we aren't services admin */
+ else if (!nname.empty()) /* It's not a chan and we aren't services admin */
{
u->SendMessage(MemoServ, ACCESS_DENIED);
return MOD_CONT;
@@ -70,64 +70,64 @@ class CommandMSInfo : public Command
hardmax = u->Account()->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
}
- if (!name.empty() && (ci || na->nc != u->Account()))
+ if (!nname.empty() && (ci || na->nc != u->Account()))
{
if (mi->memos.empty())
- u->SendMessage(MemoServ, MEMO_INFO_X_NO_MEMOS, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NO_MEMOS, nname.c_str());
else if (mi->memos.size() == 1)
{
if (mi->memos[0]->HasFlag(MF_UNREAD))
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMO_UNREAD, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMO_UNREAD, nname.c_str());
else
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMO, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMO, nname.c_str());
}
else
{
- int count = 0, i, end;
+ unsigned count = 0, i, end;
for (i = 0, end = mi->memos.size(); i < end; ++i)
if (mi->memos[i]->HasFlag(MF_UNREAD))
++count;
if (count == mi->memos.size())
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ALL_UNREAD, name.c_str(), count);
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ALL_UNREAD, nname.c_str(), count);
else if (!count)
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS, name.c_str(), mi->memos.size());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS, nname.c_str(), mi->memos.size());
else if (count == 1)
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ONE_UNREAD, name.c_str(), mi->memos.size());
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_ONE_UNREAD, nname.c_str(), mi->memos.size());
else
- u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_SOME_UNREAD, name.c_str(), mi->memos.size(), count);
+ u->SendMessage(MemoServ, MEMO_INFO_X_MEMOS_SOME_UNREAD, nname.c_str(), mi->memos.size(), count);
}
if (!mi->memomax)
{
if (hardmax)
- u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, nname.c_str(), mi->memomax);
else
- u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, nname.c_str(), mi->memomax);
}
else if (mi->memomax > 0)
{
if (hardmax)
- u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_HARD_LIMIT, nname.c_str(), mi->memomax);
else
- u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, name.c_str(), mi->memomax);
+ u->SendMessage(MemoServ, MEMO_INFO_X_LIMIT, nname.c_str(), mi->memomax);
}
else
- u->SendMessage(MemoServ, MEMO_INFO_X_NO_LIMIT, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NO_LIMIT, nname.c_str());
/* I ripped this code out of ircservices 4.4.5, since I didn't want
to rewrite the whole thing (it pisses me off). */
if (na)
{
if (na->nc->HasFlag(NI_MEMO_RECEIVE) && na->nc->HasFlag(NI_MEMO_SIGNON))
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_ON, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_ON, nname.c_str());
else if (na->nc->HasFlag(NI_MEMO_RECEIVE))
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_RECEIVE, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_RECEIVE, nname.c_str());
else if (na->nc->HasFlag(NI_MEMO_SIGNON))
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_SIGNON, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_SIGNON, nname.c_str());
else
- u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_OFF, name.c_str());
+ u->SendMessage(MemoServ, MEMO_INFO_X_NOTIFY_OFF, nname.c_str());
}
}
- else /* !name || (!ci || na->nc == u->Account()) */
+ else /* !nname || (!ci || na->nc == u->Account()) */
{
if (mi->memos.empty())
u->SendMessage(MemoServ, MEMO_INFO_NO_MEMOS);
@@ -140,7 +140,7 @@ class CommandMSInfo : public Command
}
else
{
- int count = 0, i, end;
+ unsigned count = 0, i, end;
for (i = 0, end = mi->memos.size(); i < end; ++i)
if (mi->memos[i]->HasFlag(MF_UNREAD))
++count;
diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp
index a49e849f1..492111389 100644
--- a/modules/core/ms_set.cpp
+++ b/modules/core/ms_set.cpp
@@ -134,7 +134,7 @@ class CommandMSSet : public Command
else
nc->UnsetFlag(NI_MEMO_HARDMAX);
}
- limit = p1.is_number_only() ? convertTo<int32>(p1) : -1;
+ limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1;
if (limit < 0 || limit > 32767)
{
u->SendMessage(MemoServ, MEMO_SET_LIMIT_OVERFLOW, 32767);
@@ -160,10 +160,10 @@ class CommandMSSet : public Command
u->SendMessage(MemoServ, MEMO_SET_YOUR_LIMIT_FORBIDDEN);
return MOD_CONT;
}
- limit = p1.is_number_only() ? convertTo<int32>(p1) : -1;
+ limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1;
/* The first character is a digit, but we could still go negative
* from overflow... watch out! */
- if (limit < 0 || (Config->MSMaxMemos > 0 && limit > Config->MSMaxMemos))
+ if (limit < 0 || (Config->MSMaxMemos > 0 && convertTo<unsigned>(limit) > Config->MSMaxMemos))
{
if (!chan.empty())
u->SendMessage(MemoServ, MEMO_SET_LIMIT_TOO_HIGH, chan.c_str(), Config->MSMaxMemos);
diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp
index 51949ad8e..dd932d606 100644
--- a/modules/core/ns_set.cpp
+++ b/modules/core/ns_set.cpp
@@ -165,7 +165,7 @@ class CommandNSSetPassword : public Command
{
Anope::string param = params[1];
- int len = param.length();
+ unsigned len = param.length();
if (u->Account()->display.equals_ci(param) || (Config->StrictPasswords && len < 5))
{
diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp
index e88e9a856..51f98b951 100644
--- a/modules/core/os_session.cpp
+++ b/modules/core/os_session.cpp
@@ -123,10 +123,11 @@ class CommandOSSession : public Command
private:
CommandReturn DoList(User *u, const std::vector<Anope::string> &params)
{
- int mincount;
Anope::string param = params[1];
- if ((mincount = (param.is_number_only() ? convertTo<int>(param) : 0)) <= 1)
+ unsigned mincount = param.is_pos_number_only() ? convertTo<unsigned>(param) : 0;
+
+ if (mincount <= 1)
u->SendMessage(OperServ, OPER_SESSION_INVALID_THRESHOLD);
else
{
@@ -318,8 +319,8 @@ class CommandOSException : public Command
return MOD_CONT;
}
- n1 = n1str.is_number_only() ? convertTo<int>(n1str) - 1 : -1;
- n2 = n2str.is_number_only() ? convertTo<int>(n2str) - 1 : -1;
+ n1 = n1str.is_pos_number_only() ? convertTo<int>(n1str) - 1 : -1;
+ n2 = n2str.is_pos_number_only() ? convertTo<int>(n2str) - 1 : -1;
if (n1 >= 0 && n1 < exceptions.size() && n2 >= 0 && n2 < exceptions.size() && n1 != n2)
{