diff options
author | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-30 02:48:54 +0000 |
---|---|---|
committer | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-30 02:48:54 +0000 |
commit | 58385dd458e927994957b6d603f7f9da3fc52e14 (patch) | |
tree | 70c39a58446bd4f60205a9c34cac78524a67dc54 | |
parent | bca70575cb3d58127f80d92a388b60b5f5ed2fde (diff) |
Commit -Wformat=2 -Wmissing-format-attributes, printf-like functions in inspircd now get treated like printf (meaning compile-time check goodness) in GCC
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9217 e03df62e-2008-0410-955e-edbf42e46eb7
33 files changed, 70 insertions, 64 deletions
@@ -559,8 +559,8 @@ sub svnupdate if (scalar(@conflicted) > 0) { print STDERR "\e[0;33;1mERROR:\e[0m You have local modifications which conflicted with the updates from SVN\n"; - printf STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -%supdate", (($coredirchanged || $configurechanged) ? "" : "mod"); - print "Conflicted files: " . join ", ", @conflicted; + printf STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -%supdate\n", (($coredirchanged || $configurechanged) ? "" : "mod"); + print "Conflicted files: " . join ", ", @conflicted . "\n"; exit 1; } if ($configurechanged || $coredirchanged) @@ -1133,8 +1133,8 @@ sub getosflags { # Beware: Linux sets it's own cflags below for some retarded reason $config{LDLIBS} = "-pthread -lstdc++"; - $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}"; - $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -Wshadow -Wall -g"; + $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall $config{OPTIMISATI}"; + $config{DEVELOPER} = "-fPIC -Woverloaded-virtual -Wshadow -Wall -Wformat=2 -Wmissing-format-attribute -g"; $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared" unless defined $opt_disablerpath; $config{MAKEPROG} = "make"; @@ -1160,7 +1160,7 @@ sub getosflags { if ($config{OSNAME} =~ /Linux/i) { $config{LDLIBS} = "-ldl -lstdc++ -pthread"; - $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}"; +# $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}"; $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS}); $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS}); $config{MAKEPROG} = "make"; diff --git a/include/channels.h b/include/channels.h index 50076fd86..693f429f4 100644 --- a/include/channels.h +++ b/include/channels.h @@ -371,7 +371,7 @@ class CoreExport Channel : public Extensible * @param text A printf-style format string which builds the output line without prefix * @param ... Zero or more POD types */ - void WriteChannel(User* user, const char* text, ...); + void WriteChannel(User* user, const char* text, ...) CUSTOM_PRINTF(3, 4); /** Write to a channel, from a user, using std::string for text * @param user User whos details to prefix the line with @@ -384,7 +384,7 @@ class CoreExport Channel : public Extensible * @param text A printf-style format string which builds the output line without prefix * @param ... Zero or more POD type */ - void WriteChannelWithServ(const char* ServName, const char* text, ...); + void WriteChannelWithServ(const char* ServName, const char* text, ...) CUSTOM_PRINTF(3, 4); /** Write to a channel, from a server, using std::string for text * @param ServName Server name to prefix the line with @@ -401,7 +401,7 @@ class CoreExport Channel : public Extensible * @param text A printf-style format string which builds the output line without prefix * @param ... Zero or more POD type */ - void WriteAllExceptSender(User* user, bool serversource, char status, const char* text, ...); + void WriteAllExceptSender(User* user, bool serversource, char status, const char* text, ...) CUSTOM_PRINTF(5, 6); /** Write to all users on a channel except a list of users, using va_args for text * @param user User whos details to prefix the line with, and to omit from receipt of the message @@ -412,7 +412,7 @@ class CoreExport Channel : public Extensible * @param text A printf-style format string which builds the output line without prefix * @param ... Zero or more POD type */ - void WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const char* text, ...); + void WriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const char* text, ...) CUSTOM_PRINTF(6, 7); /** Write to all users on a channel except a specific user, using std::string for text. * Internally, this calls WriteAllExcept(). diff --git a/include/inspircd.h b/include/inspircd.h index 84995710d..9798af4f2 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -25,6 +25,12 @@ #undef ERROR #endif +#ifdef __GNUC__ +#define CUSTOM_PRINTF(STRING, FIRST) __attribute__((format(printf, STRING, FIRST))) +#else +#define CUSTOM_PRINTF(STRING, FIRST) +#endif + // Required system headers. #include <time.h> #include <stdarg.h> @@ -796,7 +802,7 @@ class CoreExport InspIRCd : public classbase * @param text Format string of to write to the log * @param ... Format arguments of text to write to the log */ - void Log(int level, const char* text, ...); + void Log(int level, const char* text, ...) CUSTOM_PRINTF(3, 4); /** Output a log message to the ircd.log file * The text will only be output if the current loglevel @@ -821,7 +827,7 @@ class CoreExport InspIRCd : public classbase * @param format Format string for the numeric * @param ... Parameters for the format string */ - void SendWhoisLine(User* user, User* dest, int numeric, const char* format, ...); + void SendWhoisLine(User* user, User* dest, int numeric, const char* format, ...) CUSTOM_PRINTF(5, 6); /** Quit a user for excess flood, and if they are not * fully registered yet, temporarily zline their IP. diff --git a/include/logger.h b/include/logger.h index 596f98aee..25dcea85f 100644 --- a/include/logger.h +++ b/include/logger.h @@ -253,7 +253,7 @@ class CoreExport LogManager : public classbase * @param loglevel Log message level (DEBUG, VERBOSE, DEFAULT, SPARSE, NONE) * @param msg The format of the message to be logged. See your C manual on printf() for details. */ - void Log(const std::string &type, int loglevel, const char *fmt, ...); + void Log(const std::string &type, int loglevel, const char *fmt, ...) CUSTOM_PRINTF(4, 5); }; #endif diff --git a/include/snomasks.h b/include/snomasks.h index 9541715e3..6e3f75d7a 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -100,7 +100,7 @@ class CoreExport SnomaskManager : public Extensible * @param text A format string containing text to send * @param ... Format arguments */ - void WriteToSnoMask(char letter, const char* text, ...); + void WriteToSnoMask(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4); /** Called once per 5 seconds from the mainloop, this flushes any cached * snotices. The way the caching works is as follows: diff --git a/include/usermanager.h b/include/usermanager.h index 6016a2462..552fb4136 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -138,13 +138,13 @@ class CoreExport UserManager : public classbase * @param text The text format string to send * @param ... The format arguments */ - void ServerNoticeAll(const char* text, ...); + void ServerNoticeAll(const char* text, ...) CUSTOM_PRINTF(2, 3); /** Send a server message (PRIVMSG) to all local users * @param text The text format string to send * @param ... The format arguments */ - void ServerPrivmsgAll(const char* text, ...); + void ServerPrivmsgAll(const char* text, ...) CUSTOM_PRINTF(2, 3); /** Send text to all users with a specific set of modes * @param modes The modes to check against, without a +, e.g. 'og' @@ -154,7 +154,7 @@ class CoreExport UserManager : public classbase * @param text The text format string to send * @param ... The format arguments */ - void WriteMode(const char* modes, int flags, const char* text, ...); + void WriteMode(const char* modes, int flags, const char* text, ...) CUSTOM_PRINTF(4, 5); }; #endif diff --git a/include/users.h b/include/users.h index 74b55202d..29db518b7 100644 --- a/include/users.h +++ b/include/users.h @@ -931,7 +931,7 @@ class CoreExport User : public connection * @param text The format string for text to send to the user * @param ... POD-type format arguments */ - void Write(const char *text, ...); + void Write(const char *text, ...) CUSTOM_PRINTF(2, 3); /** Write text to this user, appending CR/LF and prepending :server.name * @param text A std::string to send to the user @@ -942,9 +942,9 @@ class CoreExport User : public connection * @param text The format string for text to send to the user * @param ... POD-type format arguments */ - void WriteServ(const char* text, ...); + void WriteServ(const char* text, ...) CUSTOM_PRINTF(2, 3); - void WriteNumeric(unsigned int numeric, const char* text, ...); + void WriteNumeric(unsigned int numeric, const char* text, ...) CUSTOM_PRINTF(3, 4); void WriteNumeric(unsigned int numeric, const std::string &text); @@ -959,7 +959,7 @@ class CoreExport User : public connection * @param text The format string for text to send to the user * @param ... POD-type format arguments */ - void WriteFrom(User *user, const char* text, ...); + void WriteFrom(User *user, const char* text, ...) CUSTOM_PRINTF(3, 4); /** Write text to the user provided in the first parameter, appending CR/LF, and prepending THIS user's :nick!user@host. * @param dest The user to route the message to @@ -972,7 +972,7 @@ class CoreExport User : public connection * @param text The format string for text to send to the user * @param ... POD-type format arguments */ - void WriteTo(User *dest, const char *data, ...); + void WriteTo(User *dest, const char *data, ...) CUSTOM_PRINTF(3, 4); /** Write to all users that can see this user (including this user in the list), appending CR/LF * @param text A std::string to send to the users @@ -983,13 +983,13 @@ class CoreExport User : public connection * @param text The format string for text to send to the users * @param ... POD-type format arguments */ - void WriteCommon(const char* text, ...); + void WriteCommon(const char* text, ...) CUSTOM_PRINTF(2, 3); /** Write to all users that can see this user (not including this user in the list), appending CR/LF * @param text The format string for text to send to the users * @param ... POD-type format arguments */ - void WriteCommonExcept(const char* text, ...); + void WriteCommonExcept(const char* text, ...) CUSTOM_PRINTF(2, 3); /** Write to all users that can see this user (not including this user in the list), appending CR/LF * @param text A std::string to send to the users @@ -1008,7 +1008,7 @@ class CoreExport User : public connection * @param text The format string to send in the WALLOPS message * @param ... Format arguments */ - void WriteWallOps(const char* text, ...); + void WriteWallOps(const char* text, ...) CUSTOM_PRINTF(2, 3); /** Write a WALLOPS message from this user to all local opers. * If this user is not opered, the function will return without doing anything. @@ -1058,7 +1058,7 @@ class CoreExport User : public connection * @param text The text format string to send * @param ... Format arguments */ - void SendAll(const char* command, const char* text, ...); + void SendAll(const char* command, const char* text, ...) CUSTOM_PRINTF(3, 4); /** Compile a channel list for this user, and send it to the user 'source' * Used internally by WHOIS diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp index 764297f58..2c7971edd 100644 --- a/src/commands/cmd_list.cpp +++ b/src/commands/cmd_list.cpp @@ -64,13 +64,13 @@ CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *us bool n = i->second->HasUser(user); if ((i->second->IsModeSet('p')) && (!n)) { - user->WriteNumeric(322, "%s *",user->nick,i->second->name); + user->WriteNumeric(322, "%s *",user->nick); } else { if (((!(i->second->IsModeSet('p'))) && (!(i->second->IsModeSet('s')))) || (n)) { - user->WriteNumeric(322, "%s %s %d :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic); + user->WriteNumeric(322, "%s %s %ld :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic); } } } diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp index 95f2b1529..313e2d2b5 100644 --- a/src/commands/cmd_lusers.cpp +++ b/src/commands/cmd_lusers.cpp @@ -31,7 +31,7 @@ CmdResult CommandLusers::Handle (const char* const*, int, User *user) if (ServerInstance->Users->UnregisteredUserCount()) user->WriteNumeric(253, "%s %d :unknown connections",user->nick,ServerInstance->Users->UnregisteredUserCount()); if (ServerInstance->ChannelCount()) - user->WriteNumeric(254, "%s %d :channels formed",user->nick,ServerInstance->ChannelCount()); + user->WriteNumeric(254, "%s %ld :channels formed",user->nick,ServerInstance->ChannelCount()); if (ServerInstance->Users->LocalUserCount()) user->WriteNumeric(255, "%s :I have %d clients and 0 servers",user->nick,ServerInstance->Users->LocalUserCount()); diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp index eac31edd0..4e4679ce4 100644 --- a/src/commands/cmd_modules.cpp +++ b/src/commands/cmd_modules.cpp @@ -62,7 +62,7 @@ CmdResult CommandModules::Handle (const char* const*, int, User *user) strlcpy(modulename,module_names[i].c_str(),256); if (IS_OPER(user)) { - user->WriteNumeric(702, "%s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,m,V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2); + user->WriteNumeric(702, "%s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,(unsigned long)m,V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2); } else { diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp index f271a597d..2f1e2ea8c 100644 --- a/src/commands/cmd_topic.cpp +++ b/src/commands/cmd_topic.cpp @@ -37,7 +37,7 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u if (Ptr->topicset) { user->WriteNumeric(332, "%s %s :%s", user->nick, Ptr->name, Ptr->topic); - user->WriteNumeric(333, "%s %s %s %d", user->nick, Ptr->name, Ptr->setby, Ptr->topicset); + user->WriteNumeric(333, "%s %s %s %ld", user->nick, Ptr->name, Ptr->setby, Ptr->topicset); } else { diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index b0ce2b320..b72fd73e5 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -72,7 +72,7 @@ void do_whois(InspIRCd* ServerInstance, User* user, User* dest,unsigned long sig */ if ((idle) || (signon)) { - ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %d %d :seconds idle, signon time",user->nick, dest->nick, idle, signon); + ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %lu %lu :seconds idle, signon time",user->nick, dest->nick, idle, signon); } ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick, dest->nick); diff --git a/src/configreader.cpp b/src/configreader.cpp index cba015ec9..35c65fede 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -741,7 +741,7 @@ void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail, ServerInstance->SNO->WriteToSnoMask('A', "There were errors in the configuration file:"); while (start < errors.length()) { - ServerInstance->SNO->WriteToSnoMask('A', errors.substr(start, 360).c_str()); + ServerInstance->SNO->WriteToSnoMask('A', errors.substr(start, 360)); start += 360; } } diff --git a/src/dns.cpp b/src/dns.cpp index 447b90781..4bb2da020 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -1116,7 +1116,7 @@ void DNS::HandleEvent(EventType, int) /** Add a derived Resolver to the working set */ bool DNS::AddResolverClass(Resolver* r) { - ServerInstance->Logs->Log("RESOLVER",DEBUG,"AddResolverClass %08lx", r); + ServerInstance->Logs->Log("RESOLVER",DEBUG,"AddResolverClass 0x%08lx", (unsigned long)r); /* Check the pointers validity and the id's validity */ if ((r) && (r->GetId() > -1)) { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 0e5e11207..8d7046ef6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -678,7 +678,7 @@ int InspIRCd::Run() { if (TIME < OLDTIME) { - SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",OLDTIME-TIME); + SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %ld secs.",OLDTIME-TIME); } if ((TIME % 3600) == 0) diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp index 1b2cad8fd..db0a64c05 100644 --- a/src/modules/extra/m_rline.cpp +++ b/src/modules/extra/m_rline.cpp @@ -91,7 +91,7 @@ class CoreExport RLine : public XLine void DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed R-Line %s (set by %s %d seconds ago)", this->matchtext.c_str(), this->source, this->duration); + ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed R-Line %s (set by %s %ld seconds ago)", this->matchtext.c_str(), this->source, this->duration); } const char* Displayable() diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 6ee124f22..81d919ad6 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -172,13 +172,13 @@ class ModuleSSLGnuTLS : public Module for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr)) ServerInstance->Config->ports[i]->SetDescription("ssl"); - ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno); sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";"); } catch (ModuleException &e) { - ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); + ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); } } } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index c4bc180e5..c8fdefe62 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -195,13 +195,13 @@ class ModuleSSLOpenSSL : public Module for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr)) ServerInstance->Config->ports[i]->SetDescription("ssl"); - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno); sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";"); } catch (ModuleException &e) { - ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); + ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason()); } } } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 047c55e7f..bb59cde3d 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -64,7 +64,7 @@ class BanRedirect : public ModeWatcher if(adding && (channel->bans.size() > static_cast<unsigned>(maxbans))) { - source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %d)", source->nick, channel->name, channel->name, maxbans); + source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick, channel->name, channel->name, maxbans); return false; } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 1f2b6227a..747616bc0 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -172,7 +172,7 @@ class CommandDccallow : public Command if (length > 0) { - user->WriteNumeric(993, "%s %s :Added %s to DCCALLOW list for %d seconds", user->nick, user->nick, target->nick, length); + user->WriteNumeric(993, "%s %s :Added %s to DCCALLOW list for %ld seconds", user->nick, user->nick, target->nick, length); } else { diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 126221dd2..88a654cc7 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -188,7 +188,7 @@ class ModuleDelayJoin : public Module user->Shrink("delayjoin"); } - void WriteCommonFrom(User *user, Channel* channel, const char* text, ...) + void WriteCommonFrom(User *user, Channel* channel, const char* text, ...) CUSTOM_PRINTF(4, 5) { va_list argsPtr; char textbuffer[MAXBUF]; diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index 9cf6e45b4..ef3cf5c33 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -260,7 +260,7 @@ void HTTPSocket::Connect(const std::string &ip) { this->response = new HTTPClientResponse((Module*)Mod, req.GetSource() , url.url, 0, ""); - Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::Connect(%s) response=%08lx", ip.c_str(), response); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::Connect(%s) response=%08lx", ip.c_str(), (unsigned long)response); strlcpy(this->IP, ip.c_str(), MAXBUF); strlcpy(this->host, ip.c_str(), MAXBUF); @@ -354,7 +354,7 @@ void HTTPSocket::OnClose() if (!closed) { closed = true; - Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnClose response=%08lx", response); + Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnClose response=%08lx", (unsigned long)response); std::string e; if (data.empty()) { diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 685dc209a..b90394164 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -258,7 +258,7 @@ class ModuleInvisible : public Module } /* Fix by Eric @ neowin.net, thanks :) -- Brain */ - void WriteCommonFrom(User *user, Channel* channel, const char* text, ...) + void WriteCommonFrom(User *user, Channel* channel, const char* text, ...) CUSTOM_PRINTF(4,5) { va_list argsPtr; char textbuffer[MAXBUF]; diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 972f78441..b436b953b 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -74,7 +74,7 @@ class ModuleOperLevels : public Module } if (dest_level > source_level) { - ServerInstance->SNO->WriteToSnoMask('A', "Oper %s (level %d) attempted to /kill a higher oper: %s (level %d): Reason: %s",source->nick,source_level,dest->nick,dest_level,reason.c_str()); + ServerInstance->SNO->WriteToSnoMask('A', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick,source_level,dest->nick,dest_level,reason.c_str()); dest->WriteServ("NOTICE %s :Oper %s attempted to /kill you!",dest->nick,source->nick); source->WriteNumeric(481, "%s :Permission Denied - Oper %s is a higher level than you",source->nick,dest->nick); return 1; diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index b2c4273e3..8543e9719 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -60,7 +60,7 @@ class ModuleRestrictChans : public Module // channel does not yet exist (record is null, about to be created IF we were to allow it) if (!chan) { - user->WriteNumeric(530, "%s %s :Only IRC operators may create new channels",user->nick,cname,cname); + user->WriteNumeric(530, "%s %s :Only IRC operators may create new channels",user->nick,cname); return 1; } } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 3974cf017..95227e770 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 %d seconds of connecting. Please try again later.",user->nick, WaitTime); + user->WriteServ("NOTICE %s :*** You cannot list within the first %ld seconds of connecting. Please try again later.",user->nick, 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_silence.cpp b/src/modules/m_silence.cpp index 4ff26aca6..165f00df9 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -110,7 +110,7 @@ class CommandSilence : public Command } if (sl->size() >= maxsilence) { - user->WriteNumeric(952, "%s %s :Your silence list is full",user->nick, user->nick, mask.c_str()); + user->WriteNumeric(952, "%s %s :Your silence list is full",user->nick, user->nick); return CMD_FAILURE; } sl->insert(std::make_pair<irc::string, time_t>(mask.c_str(), ServerInstance->Time())); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 067b729ad..b37edf583 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -153,7 +153,7 @@ void ModuleSpanningTree::HandleLusers(const char* const* parameters, int pcnt, U user->WriteNumeric(253, "%s %d :unknown connections",user->nick,ServerInstance->Users->UnregisteredUserCount()); if (ServerInstance->ChannelCount()) - user->WriteNumeric(254, "%s %d :channels formed",user->nick,ServerInstance->ChannelCount()); + user->WriteNumeric(254, "%s %ld :channels formed",user->nick,ServerInstance->ChannelCount()); user->WriteNumeric(255, "%s :I have %d clients and %d servers",user->nick,ServerInstance->Users->LocalUserCount(),ulined_local_count ? this->CountLocalServs() - ulined_local_count : this->CountLocalServs()); user->WriteNumeric(265, "%s :Current Local Users: %d Max: %d",user->nick,ServerInstance->Users->LocalUserCount(),max_local); diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 4002ad61e..a3d249a51 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -134,7 +134,7 @@ class ModuleSpanningTree : public Module /** Attempt to send a message to a user */ - void RemoteMessage(User* user, const char* format, ...); + void RemoteMessage(User* user, const char* format, ...) CUSTOM_PRINTF(3, 4); /** Returns oper-specific MAP information */ diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index b176d4a50..c5538dabd 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -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 %u seconds ago expired", (*iter)->length, (*iter)->nickname.c_str(), (*iter)->reason.c_str(), ServerInstance->Time() - (*iter)->set_on); + 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); HoldMap.erase(assign((*iter)->nickname)); delete *iter; safeiter = iter; diff --git a/src/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp index f3bd530f7..821a8363b 100644 --- a/src/modules/m_xmlsocket.cpp +++ b/src/modules/m_xmlsocket.cpp @@ -71,7 +71,7 @@ class ModuleXMLSocket : public Module } catch (ModuleException &e) { - ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe you have another similar module loaded?", portno, e.GetReason()); + ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %ld: %s. Maybe you have another similar module loaded?", portno, e.GetReason()); } } } diff --git a/src/users.cpp b/src/users.cpp index f8a95af49..f8a1bd330 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -224,7 +224,7 @@ User::~User() if (this->MyClass) { this->MyClass->RefCount--; - ServerInstance->Logs->Log("USERS", DEBUG, "User destructor -- connect refcount now: %u", this->MyClass->RefCount); + ServerInstance->Logs->Log("USERS", DEBUG, "User destructor -- connect refcount now: %lu", this->MyClass->RefCount); } if (this->AllowedOperCommands) { @@ -520,7 +520,7 @@ bool User::AddBuffer(std::string a) if (this->MyClass && (recvq.length() > this->MyClass->GetRecvqMax())) { this->SetWriteError("RecvQ exceeded"); - ServerInstance->SNO->WriteToSnoMask('A', "User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->MyClass->GetRecvqMax()); + ServerInstance->SNO->WriteToSnoMask('A', "User %s RecvQ of %d exceeds connect class maximum of %lu",this->nick,recvq.length(),this->MyClass->GetRecvqMax()); return false; } @@ -597,7 +597,7 @@ void User::AddWriteBuf(const std::string &data) * to repeatedly add the text to the sendq! */ this->SetWriteError("SendQ exceeded"); - ServerInstance->SNO->WriteToSnoMask('A', "User %s SendQ of %d exceeds connect class maximum of %d",this->nick,sendq.length() + data.length(),this->MyClass->GetSendqMax()); + ServerInstance->SNO->WriteToSnoMask('A', "User %s SendQ of %d exceeds connect class maximum of %lu",this->nick,sendq.length() + data.length(),this->MyClass->GetSendqMax()); return; } @@ -1708,7 +1708,7 @@ ConnectClass* User::SetClass(const std::string &explicit_name) /* deny change if change will take class over the limit */ if (found->limit && (found->RefCount + 1 >= found->limit)) { - ServerInstance->Logs->Log("USERS", DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit); + ServerInstance->Logs->Log("USERS", DEBUG, "OOPS: Connect class limit (%lu) hit, denying", found->limit); return this->MyClass; } @@ -1718,12 +1718,12 @@ ConnectClass* User::SetClass(const std::string &explicit_name) if (found == this->MyClass) // no point changing this shit :P return this->MyClass; this->MyClass->RefCount--; - ServerInstance->Logs->Log("USERS", DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount); + ServerInstance->Logs->Log("USERS", DEBUG, "Untying user from connect class -- refcount: %lu", this->MyClass->RefCount); } this->MyClass = found; this->MyClass->RefCount++; - ServerInstance->Logs->Log("USERS", DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount); + ServerInstance->Logs->Log("USERS", DEBUG, "User tied to new class -- connect refcount now: %lu", this->MyClass->RefCount); } return this->MyClass; diff --git a/src/xline.cpp b/src/xline.cpp index 19a15decf..3f0ddbf2b 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -552,27 +552,27 @@ void ELine::OnAdd() void ELine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed E-Line %s@%s (set by %s %d seconds ago)",this->identmask,this->hostmask,this->source,this->duration); + ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed E-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,this->duration); } void QLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Q-Line %s (set by %s %d seconds ago)",this->nick,this->source,this->duration); + ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Q-Line %s (set by %s %ld seconds ago)",this->nick,this->source,this->duration); } void ZLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Z-Line %s (set by %s %d seconds ago)",this->ipaddr,this->source,this->duration); + ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Z-Line %s (set by %s %ld seconds ago)",this->ipaddr,this->source,this->duration); } void KLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed K-Line %s@%s (set by %s %d seconds ago)",this->identmask,this->hostmask,this->source,this->duration); + ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed K-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,this->duration); } void GLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed G-Line %s@%s (set by %s %d seconds ago)",this->identmask,this->hostmask,this->source,this->duration); + ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed G-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,this->duration); } const char* ELine::Displayable() |