From 52671661f8fdca0b61aec8009b4bc7de9bc00166 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 2 Apr 2008 18:45:54 +0000 Subject: [PATCH] DOH! Fix my muppetry of a segfault, and fix some warnings git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9273 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_securelist.cpp | 2 +- src/modules/m_spanningtree/fjoin.cpp | 2 +- src/modules/m_spanningtree/fmode.cpp | 2 +- src/modules/m_svshold.cpp | 6 +++--- src/modules/m_watch.cpp | 10 +++++----- src/socketengines/socketengine_kqueue.cpp | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 95227e770..829a6514a 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -68,7 +68,7 @@ class ModuleSecureList : public Module return 0; /* Not exempt, BOOK EM DANNO! */ - user->WriteServ("NOTICE %s :*** You cannot list within the first %ld seconds of connecting. Please try again later.",user->nick, WaitTime); + user->WriteServ("NOTICE %s :*** You cannot list within the first %lu seconds of connecting. Please try again later.",user->nick, (unsigned long) WaitTime); /* Some crap clients (read: mIRC, various java chat applets) muck up if they don't * receive these numerics whenever they send LIST, so give them an empty LIST to mull over. */ diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 0f33d65bd..0bddb4da7 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -96,7 +96,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p { std::deque param_list; if (Utils->AnnounceTSChange && chan) - chan->WriteChannelWithServ(Instance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name, chan->name, ourTS, TS); + chan->WriteChannelWithServ(Instance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name, chan->name, (unsigned long) ourTS, (unsigned long) TS); ourTS = TS; if (!created) { diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp index 260b4523c..94a5c1dce 100644 --- a/src/modules/m_spanningtree/fmode.cpp +++ b/src/modules/m_spanningtree/fmode.cpp @@ -100,7 +100,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque &p if (TS <= ourTS) { if ((TS < ourTS) && (!dst)) - Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG *** Channel TS sent in FMODE to %s is %lu which is not equal to %lu!", params[0].c_str(), TS, ourTS); + Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG *** Channel TS sent in FMODE to %s is %lu which is not equal to %lu!", params[0].c_str(), (unsigned long) TS, (unsigned long) ourTS); if (smode) { diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index c5538dabd..4a650fb1f 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -82,7 +82,7 @@ class CommandSvshold : public Command if ((*iter)->length) { remaining = ((*iter)->set_on + (*iter)->length) - ServerInstance->Time(); - user->WriteServ( "386 %s %s :Removed SVSHOLD with %lu seconds left before expiry (%s)", user->nick, (*iter)->nickname.c_str(), remaining, (*iter)->reason.c_str()); + user->WriteServ( "386 %s %s :Removed SVSHOLD with %lu seconds left before expiry (%s)", user->nick, (*iter)->nickname.c_str(), (unsigned long)remaining, (*iter)->reason.c_str()); } else { @@ -113,7 +113,7 @@ class CommandSvshold : public Command return CMD_FAILURE; } - long length = ServerInstance->Duration(parameters[1]); + unsigned long length = ServerInstance->Duration(parameters[1]); std::string reason = (pcnt > 2) ? parameters[2] : "No reason supplied"; SVSHold* S = new SVSHold(parameters[0], user->nick, ServerInstance->Time(), length, reason); @@ -261,7 +261,7 @@ class ModuleSVSHold : public Module if ((*iter)->set_on + (*iter)->length <= ServerInstance->Time()) { ServerInstance->Logs->Log("m_svshold",DEBUG, "m_svshold.so: hold on %s expired, removing...", (*iter)->nickname.c_str()); - ServerInstance->SNO->WriteToSnoMask('A',"%li second SVSHOLD on %s (%s) set %ld seconds ago expired", (*iter)->length, (*iter)->nickname.c_str(), (*iter)->reason.c_str(), ServerInstance->Time() - (*iter)->set_on); + ServerInstance->SNO->WriteToSnoMask('A',"%lu second SVSHOLD on %s (%s) set %lu seconds ago expired", (unsigned long) (*iter)->length, (*iter)->nickname.c_str(), (*iter)->reason.c_str(), (unsigned long) ServerInstance->Time() - (*iter)->set_on); HoldMap.erase(assign((*iter)->nickname)); delete *iter; safeiter = iter; diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index ac0b5affb..19521dba6 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -241,7 +241,7 @@ class CommandWatch : public Command user->WriteNumeric(604, "%s %s %s :is online",user->nick, nick, (*wl)[nick].c_str()); if (IS_AWAY(target)) { - user->WriteNumeric(609, "%s %s %s %s %ld :is away", user->nick, target->nick, target->ident, target->dhost, target->awaytime); + user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick, target->nick, target->ident, target->dhost, (unsigned long) target->awaytime); } } else @@ -320,7 +320,7 @@ class CommandWatch : public Command User *targ = ServerInstance->FindNick(q->first.c_str()); if (IS_AWAY(targ)) { - user->WriteNumeric(609, "%s %s %s %s %ld :is away", user->nick, targ->nick, targ->ident, targ->dhost, targ->awaytime); + user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick, targ->nick, targ->ident, targ->dhost, (unsigned long) targ->awaytime); } } else @@ -433,7 +433,7 @@ class Modulewatch : public Module for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick ,user->nick, user->ident, user->dhost, ServerInstance->Time()); + (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick ,user->nick, user->ident, user->dhost, (unsigned long) ServerInstance->Time()); watchlist* wl; if ((*n)->GetExt("watchlist", wl)) @@ -503,7 +503,7 @@ class Modulewatch : public Module for (std::deque::iterator n = x->second.begin(); n != x->second.end(); n++) { if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick, user->nick, user->ident, user->dhost, user->age); + (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick, user->nick, user->ident, user->dhost, (unsigned long) user->age); watchlist* wl; if ((*n)->GetExt("watchlist", wl)) @@ -526,7 +526,7 @@ class Modulewatch : public Module if ((*n)->GetExt("watchlist", wl)) { if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick, oldnick.c_str(), user->ident, user->dhost, user->age); + (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick, oldnick.c_str(), user->ident, user->dhost, (unsigned long) user->age); (*wl)[oldnick.c_str()] = ""; } } diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 5fabb5b8d..f21d2e710 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -22,8 +22,9 @@ KQueueEngine::KQueueEngine(InspIRCd* Instance) : SocketEngine(Instance) { this->RecoverFromFork(); - ref = new EventHandler* [GetMaxFds()]; ke_list = new struct kevent[GetMaxFds()]; + ref = new EventHandler* [GetMaxFds()]; + memset(ref, 0, GetMaxFds() * sizeof(EventHandler*)); } void KQueueEngine::RecoverFromFork() @@ -43,7 +44,6 @@ void KQueueEngine::RecoverFromFork() ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); } CurrentSetSize = 0; - memset(ref, 0, GetMaxFds() * sizeof(EventHandler*)); } KQueueEngine::~KQueueEngine() -- 2.39.5