aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/base.h1
-rw-r--r--include/clientprotocol.h8
-rw-r--r--include/configreader.h2
-rw-r--r--include/convto.h6
-rw-r--r--include/extensible.h17
-rw-r--r--include/filelogger.h2
-rw-r--r--include/fileutils.h6
-rw-r--r--include/inspircd.h1
-rw-r--r--include/inspsocket.h3
-rw-r--r--include/inspstring.h2
-rw-r--r--include/logger.h7
-rw-r--r--include/mode.h32
-rw-r--r--include/modechange.h6
-rw-r--r--include/modules.h13
-rw-r--r--include/modules/cap.h2
-rw-r--r--include/modules/dns.h2
-rw-r--r--include/modules/extban.h2
-rw-r--r--include/modules/regex.h6
-rw-r--r--include/numeric.h8
-rw-r--r--include/protocol.h6
-rw-r--r--include/socket.h2
-rw-r--r--include/socketengine.h5
-rw-r--r--include/thread.h2
-rw-r--r--include/threadsocket.h2
-rw-r--r--include/usermanager.h12
-rw-r--r--include/users.h3
-rw-r--r--src/base.cpp4
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/coremods/core_channel/cmd_topic.cpp2
-rw-r--r--src/coremods/core_channel/invite.cpp13
-rw-r--r--src/coremods/core_dns.cpp5
-rw-r--r--src/coremods/core_lusers.cpp31
-rw-r--r--src/coremods/core_mode.cpp2
-rw-r--r--src/coremods/core_oper/cmd_die.cpp10
-rw-r--r--src/coremods/core_reloadmodule.cpp6
-rw-r--r--src/coremods/core_whois.cpp2
-rw-r--r--src/cull.cpp12
-rw-r--r--src/extensible.cpp11
-rw-r--r--src/hashcomp.cpp17
-rw-r--r--src/helperfuncs.cpp2
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/inspsocket.cpp6
-rw-r--r--src/inspstring.cpp2
-rw-r--r--src/listmode.cpp2
-rw-r--r--src/modules.cpp8
-rw-r--r--src/modules/extra/m_geo_maxmind.cpp2
-rw-r--r--src/modules/extra/m_ldap.cpp4
-rw-r--r--src/modules/extra/m_mysql.cpp4
-rw-r--r--src/modules/extra/m_pgsql.cpp4
-rw-r--r--src/modules/extra/m_regex_pcre.cpp2
-rw-r--r--src/modules/extra/m_regex_posix.cpp2
-rw-r--r--src/modules/extra/m_regex_tre.cpp2
-rw-r--r--src/modules/extra/m_sqlite3.cpp4
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp4
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp2
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp4
-rw-r--r--src/modules/extra/m_sslrehashsignal.cpp2
-rw-r--r--src/modules/m_anticaps.cpp4
-rw-r--r--src/modules/m_bcrypt.cpp2
-rw-r--r--src/modules/m_callerid.cpp2
-rw-r--r--src/modules/m_cap.cpp2
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_cloaking.cpp2
-rw-r--r--src/modules/m_codepage.cpp2
-rw-r--r--src/modules/m_customprefix.cpp2
-rw-r--r--src/modules/m_dnsbl.cpp1
-rw-r--r--src/modules/m_exemptchanops.cpp8
-rw-r--r--src/modules/m_filter.cpp1
-rw-r--r--src/modules/m_hidelist.cpp2
-rw-r--r--src/modules/m_httpd.cpp4
-rw-r--r--src/modules/m_httpd_stats.cpp7
-rw-r--r--src/modules/m_ircv3_sts.cpp2
-rw-r--r--src/modules/m_nationalchars.cpp2
-rw-r--r--src/modules/m_pbkdf2.cpp2
-rw-r--r--src/modules/m_rline.cpp2
-rw-r--r--src/modules/m_sasl.cpp66
-rw-r--r--src/modules/m_services_account.cpp2
-rw-r--r--src/modules/m_sha2.cpp4
-rw-r--r--src/modules/m_showfile.cpp2
-rw-r--r--src/modules/m_shun.cpp2
-rw-r--r--src/modules/m_spanningtree/commands.h6
-rw-r--r--src/modules/m_spanningtree/main.h2
-rw-r--r--src/modules/m_spanningtree/metadata.cpp6
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp6
-rw-r--r--src/modules/m_spanningtree/protocolinterface.h6
-rw-r--r--src/modules/m_spanningtree/treeserver.h2
-rw-r--r--src/modules/m_spanningtree/utils.h2
-rw-r--r--src/modules/m_sqloper.cpp2
-rw-r--r--src/modules/m_svshold.cpp2
-rw-r--r--src/modules/m_websocket.cpp2
-rw-r--r--src/snomasks.cpp2
-rw-r--r--src/socket.cpp18
-rw-r--r--src/socketengine.cpp14
-rw-r--r--src/threadsocket.cpp2
-rw-r--r--src/users.cpp6
-rw-r--r--src/wildcard.cpp12
96 files changed, 247 insertions, 301 deletions
diff --git a/include/base.h b/include/base.h
index 4c15f6253..1a733ac79 100644
--- a/include/base.h
+++ b/include/base.h
@@ -224,7 +224,6 @@ class CoreExport ServiceProvider : public Cullable
/** Type of service (must match object type) */
const ServiceType service;
ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type);
- virtual ~ServiceProvider() = default;
/** Retrieves a string that represents the type of this service. */
const char* GetTypeString() const;
diff --git a/include/clientprotocol.h b/include/clientprotocol.h
index 31079e77b..8c4bf1d19 100644
--- a/include/clientprotocol.h
+++ b/include/clientprotocol.h
@@ -358,7 +358,7 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
void PushParam(const std::string& str) { params.emplace_back(0, str); }
/** Add a non-string parameter to the parameter list.
- * @param arg1 Non-string to add, will be copied.
+ * @param param Non-string to add, will be copied.
*/
template<typename T>
void PushParam(T&& param)
@@ -392,20 +392,20 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
* @param index Index of the parameter to replace. Must be less than GetParams().size().
* @param str String to replace the parameter or placeholder with, will be copied.
*/
- void ReplaceParam(unsigned int index, const char* str) { params[index] = Param(0, str); }
+ void ReplaceParam(size_t index, const char* str) { params[index] = Param(0, str); }
/** Replace a parameter or a placeholder that is already in the parameter list.
* @param index Index of the parameter to replace. Must be less than GetParams().size().
* @param str String to replace the parameter or placeholder with, will be copied.
*/
- void ReplaceParam(unsigned int index, const std::string& str) { params[index] = Param(0, str); }
+ void ReplaceParam(size_t index, const std::string& str) { params[index] = Param(0, str); }
/** Replace a parameter or a placeholder that is already in the parameter list.
* @param index Index of the parameter to replace. Must be less than GetParams().size().
* @param str String to replace the parameter or placeholder with.
* The string will NOT be copied, it must remain alive until ClearParams() is called or until the object is destroyed.
*/
- void ReplaceParamRef(unsigned int index, const std::string& str) { params[index] = Param(str); }
+ void ReplaceParamRef(size_t index, const std::string& str) { params[index] = Param(str); }
/** Add a tag.
* @param tagname Raw name of the tag to use in the protocol.
diff --git a/include/configreader.h b/include/configreader.h
index 1e9cf77c5..a0ecde6b5 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -524,7 +524,7 @@ class CoreExport ConfigReaderThread : public Thread
{
}
- ~ConfigReaderThread()
+ ~ConfigReaderThread() override
{
delete Config;
}
diff --git a/include/convto.h b/include/convto.h
index 1fc684829..0827fa17f 100644
--- a/include/convto.h
+++ b/include/convto.h
@@ -30,7 +30,7 @@ template<typename T> inline std::string ConvNumeric(const T& in)
std::string out;
while (quotient)
{
- out += "0123456789"[std::abs((long)quotient % 10)];
+ out += "0123456789"[std::llabs(quotient % 10)];
quotient /= 10;
}
if (in < 0)
@@ -105,7 +105,7 @@ template<> inline char ConvToNum<char>(const std::string& in)
// We specialise ConvToNum for char to avoid istringstream treating
// the input as a character literal.
int16_t num = ConvToNum<int16_t>(in);
- return num >= INT8_MIN && num <= INT8_MAX ? num : 0;
+ return num >= INT8_MIN && num <= INT8_MAX ? static_cast<char>(num) : 0;
}
template<> inline unsigned char ConvToNum<unsigned char>(const std::string& in)
@@ -113,5 +113,5 @@ template<> inline unsigned char ConvToNum<unsigned char>(const std::string& in)
// We specialise ConvToNum for unsigned char to avoid istringstream
// treating the input as a character literal.
uint16_t num = ConvToNum<uint16_t>(in);
- return num <= UINT8_MAX ? num : 0;
+ return num <= UINT8_MAX ? static_cast<unsigned char>(num) : 0;
}
diff --git a/include/extensible.h b/include/extensible.h
index 036a191d8..cf9e4762c 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -51,9 +51,6 @@ class CoreExport ExtensionItem
*/
ExtensionItem(Module* owner, const std::string& key, ExtensibleType exttype);
- /** Destroys an instance of the ExtensionItem class. */
- virtual ~ExtensionItem() = default;
-
/** Sets an ExtensionItem using a value in the internal format.
* @param container A container the ExtensionItem should be set on.
* @param value A value in the internal format.
@@ -157,7 +154,7 @@ class CoreExport Extensible
Extensible();
Cullable::Result Cull() override;
- virtual ~Extensible();
+ ~Extensible() override;
void UnhookExtensions(const std::vector<reference<ExtensionItem>>& toRemove);
/**
@@ -205,9 +202,6 @@ class SimpleExtItem : public ExtensionItem
{
}
- /** Destroys an instance of the SimpleExtItem class. */
- virtual ~SimpleExtItem() = default;
-
inline T* Get(const Extensible* container) const
{
return static_cast<T*>(GetRaw(container));
@@ -257,9 +251,6 @@ class CoreExport StringExtItem : public SimpleExtItem<std::string>
*/
StringExtItem(Module* owner, const std::string& key, ExtensibleType exttype, bool sync = false);
- /** Destroys an instance of the StringExtItem class. */
- virtual ~StringExtItem() = default;
-
/** @copydoc ExtensionItem::FromInternal */
void FromInternal(Extensible* container, const std::string& value) noexcept override;
@@ -289,9 +280,6 @@ class CoreExport IntExtItem : public ExtensionItem
*/
IntExtItem(Module* owner, const std::string& key, ExtensibleType exttype, bool sync = false);
- /** Destroys an instance of the IntExtItem class. */
- virtual ~IntExtItem() = default;
-
/** @copydoc ExtensionItem::Delete */
void Delete(Extensible* container, void* item) override;
@@ -343,9 +331,6 @@ class CoreExport BoolExtItem : public ExtensionItem
*/
BoolExtItem(Module* owner, const std::string& key, ExtensibleType exttype, bool sync = false);
- /** Destroys an instance of the BoolExtItem class. */
- virtual ~BoolExtItem() = default;
-
/** @copydoc ExtensionItem::Delete */
void Delete(Extensible* container, void* item) override;
diff --git a/include/filelogger.h b/include/filelogger.h
index bd4f80151..f5d2caab6 100644
--- a/include/filelogger.h
+++ b/include/filelogger.h
@@ -36,7 +36,7 @@ class CoreExport FileLogStream : public LogStream
public:
FileLogStream(LogLevel loglevel, FileWriter *fw);
- virtual ~FileLogStream();
+ ~FileLogStream() override;
void OnLog(LogLevel loglevel, const std::string& type, const std::string& msg) override;
};
diff --git a/include/fileutils.h b/include/fileutils.h
index a42b5249b..7914610e4 100644
--- a/include/fileutils.h
+++ b/include/fileutils.h
@@ -34,9 +34,9 @@ class CoreExport FilePosition
unsigned int column;
/** Initialises a new file position with the specified name, line, and column.
- * @param name The name of the file that the position points to.
- * @param line The line of the file that this position points to.
- * @param column The column of the file that this position points to.
+ * @param Name The name of the file that the position points to.
+ * @param Line The line of the file that this position points to.
+ * @param Column The column of the file that this position points to.
*/
FilePosition(const std::string& Name, unsigned int Line, unsigned int Column);
diff --git a/include/inspircd.h b/include/inspircd.h
index 0eb412888..0603ed71f 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -390,6 +390,7 @@ class CoreExport InspIRCd
* @param status The exit code to give to the operating system
* (See the ExitStatus enum for valid values)
*/
+ [[noreturn]]
void Exit(int status);
/** Formats the input string with the specified arguments.
diff --git a/include/inspsocket.h b/include/inspsocket.h
index 66f2a4544..f54fdf95f 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -400,6 +400,8 @@ class CoreExport BufferedSocket : public StreamSocket
*/
BufferedSocket(int newfd);
+ ~BufferedSocket() override;
+
/** Begin connection to the given address
* This will create a socket, register with socket engine, and start the asynchronous
* connection process. If an error is detected at this point (such as out of file descriptors),
@@ -431,7 +433,6 @@ class CoreExport BufferedSocket : public StreamSocket
*/
virtual void OnTimeout();
- virtual ~BufferedSocket();
protected:
void OnEventHandlerWrite() override;
BufferedSocketError BeginConnect(const irc::sockets::sockaddrs& dest, const irc::sockets::sockaddrs& bind, unsigned int timeout);
diff --git a/include/inspstring.h b/include/inspstring.h
index 17093eb7c..e037f735b 100644
--- a/include/inspstring.h
+++ b/include/inspstring.h
@@ -36,7 +36,7 @@
va_start(_vaList, last); \
ret.assign(InspIRCd::Format(_vaList, format)); \
va_end(_vaList); \
- } while (false);
+ } while (false)
/** Compose a hex string from raw data.
* @param raw The raw data to compose hex from (can be NULL if rawsize is 0)
diff --git a/include/logger.h b/include/logger.h
index 17b694c43..2327fc13d 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -70,7 +70,7 @@ class CoreExport FileWriter
/** Close the log file and cancel any events.
*/
- virtual ~FileWriter();
+ ~FileWriter();
};
@@ -104,11 +104,6 @@ class CoreExport LogStream : public Cullable
{
}
- /* A LogStream's destructor should do whatever it needs to close any resources it was using (or indicate that it is no longer using a resource
- * in the event that the resource is shared, see for example FileLogStream).
- */
- virtual ~LogStream() = default;
-
/** Changes the loglevel for this LogStream on-the-fly.
* This is needed for -nofork. But other LogStreams could use it to change loglevels.
*/
diff --git a/include/mode.h b/include/mode.h
index 78695d39c..a1f8e4ec5 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -175,7 +175,6 @@ class CoreExport ModeHandler : public ServiceProvider
*/
ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER);
Cullable::Result Cull() override;
- virtual ~ModeHandler() = default;
/** Register this object in the ModeParser
*/
@@ -254,10 +253,8 @@ class CoreExport ModeHandler : public ServiceProvider
/**
* Called when a channel mode change access check for your mode occurs.
* @param source Contains the user setting the mode.
- * @param channel contains the destination channel the modes are being set on.
- * @param parameter The parameter for your mode. This is modifiable.
- * @param adding This value is true when the mode is being set, or false when it is being unset.
- * @return allow, deny, or passthru to check against the required level
+ * @param channel The destination channel the modes are being set on.
+ * @param change Information regarding the mode change.
*/
virtual ModResult AccessCheck(User* source, Channel* channel, Modes::Change& change);
@@ -266,11 +263,7 @@ class CoreExport ModeHandler : public ServiceProvider
* @param source Contains the user setting the mode.
* @param dest For usermodes, contains the destination user the mode is being set on. For channelmodes, this is an undefined value.
* @param channel For channel modes, contains the destination channel the modes are being set on. For usermodes, this is an undefined value.
- * @param parameter The parameter for your mode, if you indicated that your mode requires a parameter when being set or unset. Note that
- * if you alter this value, the new value becomes the one displayed and send out to the network, also, if you set this to an empty string
- * but you specified your mode REQUIRES a parameter, this is equivalent to returning MODEACTION_DENY and will prevent the mode from being
- * displayed.
- * @param adding This value is true when the mode is being set, or false when it is being unset.
+ * @param change Information regarding the mode change.
* @return MODEACTION_ALLOW to allow the mode, or MODEACTION_DENY to prevent the mode, also see the description of 'parameter'.
*/
virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, Modes::Change& change);
@@ -299,7 +292,6 @@ class CoreExport ModeHandler : public ServiceProvider
*/
virtual void OnParameterInvalid(User* user, Channel* targetchannel, User* targetuser, const std::string& parameter);
-
/**
* If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric)
* @param user The user issuing the command
@@ -397,8 +389,7 @@ class CoreExport PrefixMode : public ModeHandler
* Called when a channel mode change access check for your mode occurs.
* @param source Contains the user setting the mode.
* @param channel contains the destination channel the modes are being set on.
- * @param parameter The parameter for your mode. This is modifiable.
- * @param adding This value is true when the mode is being set, or false when it is being unset.
+ * @param change Information regarding the mode change.
* @return allow, deny, or passthru to check against the required level
*/
ModResult AccessCheck(User* source, Channel* channel, Modes::Change& change) override;
@@ -410,8 +401,7 @@ class CoreExport PrefixMode : public ModeHandler
* @param source Source of the mode change, an error message is sent to this user if the target is not found
* @param dest Unused
* @param channel The channel the mode change is happening on
- * @param param The nickname or uuid of the target user
- * @param adding True when the mode is being set, false when it is being unset
+ * @param change Information regarding the mode change.
* @return MODEACTION_ALLOW if the change happened, MODEACTION_DENY if no change happened
* The latter occurs either when the member cannot be found or when the member already has this prefix set
* (when setting) or doesn't have this prefix set (when unsetting).
@@ -513,14 +503,16 @@ class CoreExport ModeWatcher : public Cullable
public:
ModuleRef creator;
+
/**
* The constructor initializes the mode and the mode type
*/
ModeWatcher(Module* creator, const std::string& modename, ModeType type);
+
/**
* The default destructor does nothing.
*/
- virtual ~ModeWatcher();
+ ~ModeWatcher() override;
/**
* Get the mode name being watched
@@ -539,22 +531,20 @@ class CoreExport ModeWatcher : public Cullable
* @param source The sender of the mode
* @param dest The target user for the mode, if you are watching a user mode
* @param channel The target channel for the mode, if you are watching a channel mode
- * @param parameter The parameter of the mode, if the mode is supposed to have a parameter.
+ * @param change Information regarding the mode change.
* If you alter the parameter you are given, the mode handler will see your atered version
* when it handles the mode.
- * @param adding True if the mode is being added and false if it is being removed
* @return True to allow the mode change to go ahead, false to abort it. If you abort the
* change, the mode handler (and ModeWatcher::AfterMode()) will never see the mode change.
*/
virtual bool BeforeMode(User* source, User* dest, Channel* channel, Modes::Change& change);
+
/**
* After the mode character has been processed by the ModeHandler, this method will be called.
* @param source The sender of the mode
* @param dest The target user for the mode, if you are watching a user mode
* @param channel The target channel for the mode, if you are watching a channel mode
- * @param parameter The parameter of the mode, if the mode is supposed to have a parameter.
- * You cannot alter the parameter here, as the mode handler has already processed it.
- * @param adding True if the mode is being added and false if it is being removed
+ * @param change Information regarding the mode change.
*/
virtual void AfterMode(User* source, User* dest, Channel* channel, const Modes::Change& change);
};
diff --git a/include/modechange.h b/include/modechange.h
index 1bd0cd053..4d21377c5 100644
--- a/include/modechange.h
+++ b/include/modechange.h
@@ -89,11 +89,7 @@ class Modes::ChangeList
items.insert(items.end(), first, last);
}
- /** Add a new mode to be changed to this ChangeList
- * @param mh Mode handler
- * @param adding True if this mode is being set, false if removed
- * @param param Mode parameter
- */
+ /** Add a new mode to be changed to this ChangeList. Parameters are forwarded to the Modes::Change constructor. */
template <typename... Args>
void push(Args&&... args)
{
diff --git a/include/modules.h b/include/modules.h
index c032e0aa3..8560f45c8 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -145,7 +145,7 @@ class ModResult
ServerInstance->Logs.Log("MODULE", LOG_DEFAULT, "Exception caught: " + modexcept.GetReason()); \
} \
} \
-} while (0);
+} while (0)
/**
* Custom module result handling loop. This is a paired macro, and should only
@@ -330,11 +330,6 @@ class CoreExport Module : public Cullable, public usecountbase
*/
Cullable::Result Cull() override;
- /** Default destructor.
- * destroys a module class
- */
- virtual ~Module() = default;
-
/** Retrieves link compatibility data for this module.
* @param data The location to store link compatibility data.
*/
@@ -844,10 +839,8 @@ class CoreExport Module : public Cullable, public usecountbase
* Return 1 from this function to block the mode character from being processed entirely.
* @param user The user who is sending the mode
* @param chan The channel the mode is being sent to (or NULL if a usermode)
- * @param mh The mode handler for the mode being changed
- * @param param The parameter for the mode or an empty string
- * @param adding true of the mode is being added, false if it is being removed
- * @return ACR_DENY to deny the mode, ACR_DEFAULT to do standard mode checking, and ACR_ALLOW
+ * @param change Information regarding the mode change.
+ * @return MOD_RES_DENY to deny the mode, MOD_RES_DEFAULT to do standard mode checking, and MOD_RES_ALLOW
* to skip all permission checking. Please note that for remote mode changes, your return value
* will be ignored!
*/
diff --git a/include/modules/cap.h b/include/modules/cap.h
index 9f08826db..150393520 100644
--- a/include/modules/cap.h
+++ b/include/modules/cap.h
@@ -177,7 +177,7 @@ namespace Cap
Unregister();
}
- ~Capability()
+ ~Capability() override
{
SetActive(false);
}
diff --git a/include/modules/dns.h b/include/modules/dns.h
index aca01b54f..33baa8284 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -188,7 +188,7 @@ namespace DNS
{
}
- virtual ~Request()
+ ~Request() override
{
manager->RemoveRequest(this);
}
diff --git a/include/modules/extban.h b/include/modules/extban.h
index a8f986e9e..4f0031aef 100644
--- a/include/modules/extban.h
+++ b/include/modules/extban.h
@@ -256,7 +256,7 @@ class ExtBan::EventListener
public:
/** Called when an extban is being checked.
* @param user The user which the extban is being checked against.
- * @param channel The channel which the extban is set on.
+ * @param chan The channel which the extban is set on.
* @param extban The extban which is being checked against.
*/
virtual ModResult OnExtBanCheck(User* user, Channel* chan, ExtBan::Base* extban) = 0;
diff --git a/include/modules/regex.h b/include/modules/regex.h
index 6c9f659da..1ae7acd73 100644
--- a/include/modules/regex.h
+++ b/include/modules/regex.h
@@ -72,7 +72,7 @@ class Regex::Engine
virtual PatternPtr Create(const std::string& pattern, uint8_t options = Regex::OPT_NONE) = 0;
/** Compiles a regular expression from the human-writable form.
- * @param The pattern to compile in the format /pattern/flags.
+ * @param pattern The pattern to compile in the format /pattern/flags.
* @return A shared pointer to an instance of the Regex::Pattern class.
*/
PatternPtr CreateHuman(const std::string& pattern);
@@ -157,8 +157,8 @@ class Regex::Pattern
protected:
/** Initializes a new instance of the Pattern class.
- * @param Pattern The pattern as a string.
- * @param Options The options used when matching this pattern.
+ * @param pattern The pattern as a string.
+ * @param options The options used when matching this pattern.
*/
Pattern(const std::string& pattern, uint8_t options)
: optionflags(options)
diff --git a/include/numeric.h b/include/numeric.h
index b6069e85e..79a569c22 100644
--- a/include/numeric.h
+++ b/include/numeric.h
@@ -50,8 +50,9 @@ class Numeric::Numeric
{
}
- /** Add a parameter to the numeric. The parameter will be converted to a string first with ConvToStr().
- * @param x Parameter to add
+ /** Add a parameter pack to the numeric.
+ * @param x1 The first element of the parameter pack.
+ * @param x2 The rest of the parameter pack.
*/
template <typename T1, typename... T2>
Numeric& push(const T1& x1, T2... x2)
@@ -59,6 +60,9 @@ class Numeric::Numeric
return push(x1).push(std::forward<T2>(x2)...);
}
+ /** Add a parameter to the numeric. The parameter will be converted to a string first with ConvToStr().
+ * @param x The parameter to add to the numeric.
+ */
template <typename T>
Numeric& push(const T& x)
{
diff --git a/include/protocol.h b/include/protocol.h
index 721205ba0..de5e21255 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -83,21 +83,21 @@ class CoreExport ProtocolInterface
* @param key The 'key' of the data, e.g. "swhois" for swhois desc on a user
* @param data The string representation of the data
*/
- virtual void SendMetaData(Channel* chan, const std::string& key, const std::string& data) { }
+ virtual void SendMetaData(const Channel* chan, const std::string& key, const std::string& data) { }
/** Send metadata for a user to other linked servers.
* @param user The user to send metadata for
* @param key The 'key' of the data, e.g. "swhois" for swhois desc on a user
* @param data The string representation of the data
*/
- virtual void SendMetaData(User* user, const std::string& key, const std::string& data) { }
+ virtual void SendMetaData(const User* user, const std::string& key, const std::string& data) { }
/** Send metadata for a user to other linked servers.
* @param memb The membership to send metadata for
* @param key The 'key' of the data, e.g. "swhois" for swhois desc on a user
* @param data The string representation of the data
*/
- virtual void SendMetaData(Membership* memb, const std::string& key, const std::string& data) { }
+ virtual void SendMetaData(const Membership* memb, const std::string& key, const std::string& data) { }
/** Send metadata related to the server to other linked servers.
* @param key The 'key' of the data
diff --git a/include/socket.h b/include/socket.h
index f26a1ae17..0e9475f3e 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -196,7 +196,7 @@ class CoreExport ListenSocket : public EventHandler
ListenSocket(std::shared_ptr<ConfigTag> tag, const irc::sockets::sockaddrs& bind_to);
/** Close the socket
*/
- ~ListenSocket();
+ ~ListenSocket() override;
/** Handles new connections, called by the socket engine
*/
diff --git a/include/socketengine.h b/include/socketengine.h
index af9504310..081c7f904 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -194,10 +194,6 @@ class CoreExport EventHandler : public Cullable
*/
EventHandler();
- /** Destructor
- */
- virtual ~EventHandler() = default;
-
/** Called by the socket engine in case of a read event
*/
virtual void OnEventHandlerRead() = 0;
@@ -290,6 +286,7 @@ class CoreExport SocketEngine
static void LookupMaxFds();
/** Terminates the program when the socket engine fails to initialize. */
+ [[noreturn]]
static void InitError();
static void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
diff --git a/include/thread.h b/include/thread.h
index 3b15d1846..3f71a7037 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -40,7 +40,7 @@ class CoreExport Thread
virtual void OnStart() = 0;
/** Callback which is executed on the calling thread before this thread is stopped. */
- virtual void OnStop() { };
+ virtual void OnStop() { }
/** Initialises an instance of the Thread class. */
Thread() = default;
diff --git a/include/threadsocket.h b/include/threadsocket.h
index 5d0d035ec..13e004a80 100644
--- a/include/threadsocket.h
+++ b/include/threadsocket.h
@@ -48,7 +48,7 @@ class CoreExport SocketThread : public Thread
*/
void NotifyParent();
SocketThread();
- virtual ~SocketThread();
+ ~SocketThread() override;
/** Lock queue.
*/
void LockQueue()
diff --git a/include/usermanager.h b/include/usermanager.h
index 7192af736..49ebd0cda 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -97,7 +97,7 @@ class CoreExport UserManager
/** Number of unregistered users online right now.
* (Unregistered means before USER/NICK/dns)
*/
- unsigned int unregistered_count;
+ size_t unregistered_count;
/** Perform background user events for all local users such as PING checks, registration timeouts,
* penalty management and recvq processing for users who have data in their recvq due to throttling.
@@ -157,22 +157,22 @@ class CoreExport UserManager
/** Return a count of fully registered connections on the network
* @return The number of registered users on the network
*/
- unsigned int RegisteredUserCount() { return this->clientlist.size() - this->UnregisteredUserCount() - this->ServiceCount(); }
+ size_t RegisteredUserCount() { return this->clientlist.size() - this->UnregisteredUserCount() - this->ServiceCount(); }
/** Return a count of local unregistered (before NICK/USER) users
* @return The number of local unregistered (unknown) connections
*/
- unsigned int UnregisteredUserCount() const { return this->unregistered_count; }
+ size_t UnregisteredUserCount() const { return this->unregistered_count; }
/** Return a count of users on a services servers.
* @return The number of users on services servers.
*/
- unsigned int ServiceCount() const { return this->all_services.size(); }
+ size_t ServiceCount() const { return this->all_services.size(); }
/** Return a count of local registered users
* @return The number of registered local users
*/
- unsigned int LocalUserCount() const { return (this->local_users.size() - this->UnregisteredUserCount()); }
+ size_t LocalUserCount() const { return (this->local_users.size() - this->UnregisteredUserCount()); }
/** Get a hash map containing all users, keyed by their nickname
* @return A hash map mapping nicknames to User pointers
@@ -203,7 +203,7 @@ class CoreExport UserManager
User* Find(const std::string& nickuuid);
/** Find a user by their nickname.
- * @param The nickname of the user to find.
+ * @param nick The nickname of the user to find.
* @return If the user was found then a pointer to a User object; otherwise, nullptr.
*/
User* FindNick(const std::string& nick);
diff --git a/include/users.h b/include/users.h
index 96865f5b7..d52e85492 100644
--- a/include/users.h
+++ b/include/users.h
@@ -620,9 +620,6 @@ class CoreExport User : public Extensible
*/
void PurgeEmptyChannels();
- /** Default destructor
- */
- virtual ~User() = default;
Cullable::Result Cull() override;
/** @copydoc Serializable::Deserialize */
diff --git a/src/base.cpp b/src/base.cpp
index 86261d0f8..594498d24 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -52,14 +52,14 @@ refcountbase::~refcountbase()
{
if (refcount && ServerInstance)
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "refcountbase::~ @%p with refcount %d",
- (void*)this, refcount);
+ static_cast<void*>(this), refcount);
}
usecountbase::~usecountbase()
{
if (usecount && ServerInstance)
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "usecountbase::~ @%p with refcount %d",
- (void*)this, usecount);
+ static_cast<void*>(this), usecount);
}
void ServiceProvider::RegisterService()
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 8b96d60cc..c367271c4 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -148,7 +148,7 @@ CmdResult CommandParser::CallHandler(const std::string& commandname, const Comma
case CmdAccess::SERVER: // Only servers can execute.
bOkay = IS_SERVER(user);
break;
- };
+ }
}
else
{
diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp
index 605961007..67f951f6c 100644
--- a/src/coremods/core_channel/cmd_topic.cpp
+++ b/src/coremods/core_channel/cmd_topic.cpp
@@ -103,5 +103,5 @@ CmdResult CommandTopic::HandleLocal(LocalUser* user, const Params& parameters)
void Topic::ShowTopic(LocalUser* user, Channel* chan)
{
user->WriteNumeric(RPL_TOPIC, chan->name, chan->topic);
- user->WriteNumeric(RPL_TOPICTIME, chan->name, chan->setby, (unsigned long)chan->topicset);
+ user->WriteNumeric(RPL_TOPICTIME, chan->name, chan->setby, chan->topicset);
}
diff --git a/src/coremods/core_channel/invite.cpp b/src/coremods/core_channel/invite.cpp
index 7f23977c1..3b52726cb 100644
--- a/src/coremods/core_channel/invite.cpp
+++ b/src/coremods/core_channel/invite.cpp
@@ -95,7 +95,8 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout)
// Expired, don't bother
return;
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): user=%s chan=%s timeout=%lu", user->uuid.c_str(), chan->name.c_str(), (unsigned long)timeout);
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): user=%s chan=%s timeout=%lu",
+ user->uuid.c_str(), chan->name.c_str(), static_cast<unsigned long>(timeout));
Invite* inv = Find(user, chan);
if (inv)
@@ -104,7 +105,8 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout)
if (!inv->IsTimed())
return;
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): changing expiration in %p", (void*) inv);
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): changing expiration in %p",
+ static_cast<void*>(inv));
if (timeout == 0)
{
// Convert timed invite to non-expiring
@@ -128,7 +130,8 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout)
userext.Get(user, true)->invites.push_front(inv);
chanext.Get(chan, true)->invites.push_front(inv);
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): created new Invite %p", (void*) inv);
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::APIImpl::Create(): created new Invite %p",
+ static_cast<void*>(inv));
}
}
@@ -176,7 +179,7 @@ Invite::Invite::Invite(LocalUser* u, Channel* c)
Invite::Invite::~Invite()
{
delete expiretimer;
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::~ %p", (void*) this);
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Invite::~ %p", static_cast<void*>(this));
}
void Invite::Invite::Serialize(bool human, bool show_chans, std::string& out)
@@ -202,7 +205,7 @@ InviteExpireTimer::InviteExpireTimer(Invite::Invite* invite, time_t timeout)
bool InviteExpireTimer::Tick(time_t currtime)
{
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "InviteExpireTimer::Tick(): expired %p", (void*) inv);
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "InviteExpireTimer::Tick(): expired %p", static_cast<void*>(inv));
apiimpl->Destruct(inv);
return false;
}
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index 8ac41866e..3b67ffee4 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -398,7 +398,7 @@ class MyManager : public Manager, public Timer, public EventHandler
cachettl = rr.ttl;
}
- cachettl = std::min(cachettl, (unsigned int)5*60);
+ cachettl = std::min<unsigned int>(cachettl, 5*60);
ResourceRecord& rr = r.answers.front();
// Set TTL to what we've determined to be the lowest
rr.ttl = cachettl;
@@ -418,7 +418,7 @@ class MyManager : public Manager, public Timer, public EventHandler
ServerInstance->Timers.AddTimer(this);
}
- ~MyManager()
+ ~MyManager() override
{
// Ensure Process() will fail for new requests
Close();
@@ -557,7 +557,6 @@ class MyManager : public Manager, public Timer, public EventHandler
return "DNS lookups are disabled";
case ERROR_NONE:
case ERROR_UNKNOWN:
- default:
return "Unknown error";
}
}
diff --git a/src/coremods/core_lusers.cpp b/src/coremods/core_lusers.cpp
index 3e2b9260f..e93e5e17b 100644
--- a/src/coremods/core_lusers.cpp
+++ b/src/coremods/core_lusers.cpp
@@ -28,9 +28,9 @@
struct LusersCounters
{
- unsigned int max_local;
- unsigned int max_global;
- unsigned int invisible = 0;
+ size_t max_local;
+ size_t max_global;
+ size_t invisible = 0;
LusersCounters(UserModeReference& invisiblemode)
: max_local(ServerInstance->Users.LocalUserCount())
@@ -47,7 +47,7 @@ struct LusersCounters
inline void UpdateMaxUsers()
{
- unsigned int current = ServerInstance->Users.LocalUserCount();
+ size_t current = ServerInstance->Users.LocalUserCount();
if (current > max_local)
max_local = current;
@@ -80,11 +80,11 @@ class CommandLusers : public Command
*/
CmdResult CommandLusers::Handle(User* user, const Params& parameters)
{
- unsigned int n_users = ServerInstance->Users.RegisteredUserCount();
+ size_t n_users = ServerInstance->Users.RegisteredUserCount();
ProtocolInterface::ServerList serverlist;
ServerInstance->PI->GetServerList(serverlist);
- unsigned int n_serv = serverlist.size();
- unsigned int n_local_servs = 0;
+ size_t n_serv = serverlist.size();
+ size_t n_local_servs = 0;
for (ProtocolInterface::ServerList::const_iterator i = serverlist.begin(); i != serverlist.end(); ++i)
{
if (i->parentname == ServerInstance->Config->ServerName)
@@ -96,10 +96,10 @@ CmdResult CommandLusers::Handle(User* user, const Params& parameters)
counters.UpdateMaxUsers();
- user->WriteNumeric(RPL_LUSERCLIENT, InspIRCd::Format("There are %d users and %d invisible on %d servers",
+ user->WriteNumeric(RPL_LUSERCLIENT, InspIRCd::Format("There are %zu users and %zu invisible on %zu servers",
n_users - counters.invisible, counters.invisible, n_serv));
- unsigned int opercount = ServerInstance->Users.all_opers.size();
+ size_t opercount = ServerInstance->Users.all_opers.size();
if (opercount)
user->WriteNumeric(RPL_LUSEROP, opercount, "operator(s) online");
@@ -107,19 +107,20 @@ CmdResult CommandLusers::Handle(User* user, const Params& parameters)
user->WriteNumeric(RPL_LUSERUNKNOWN, ServerInstance->Users.UnregisteredUserCount(), "unknown connections");
user->WriteNumeric(RPL_LUSERCHANNELS, ServerInstance->GetChans().size(), "channels formed");
- user->WriteNumeric(RPL_LUSERME, InspIRCd::Format("I have %d clients and %d servers", ServerInstance->Users.LocalUserCount(), n_local_servs));
- user->WriteNumeric(RPL_LOCALUSERS, InspIRCd::Format("Current local users: %d Max: %d", ServerInstance->Users.LocalUserCount(), counters.max_local));
- user->WriteNumeric(RPL_GLOBALUSERS, InspIRCd::Format("Current global users: %d Max: %d", n_users, counters.max_global));
+ user->WriteNumeric(RPL_LUSERME, InspIRCd::Format("I have %zu clients and %zu servers", ServerInstance->Users.LocalUserCount(), n_local_servs));
+ user->WriteNumeric(RPL_LOCALUSERS, InspIRCd::Format("Current local users: %zu Max: %zu", ServerInstance->Users.LocalUserCount(), counters.max_local));
+ user->WriteNumeric(RPL_GLOBALUSERS, InspIRCd::Format("Current global users: %zu Max: %zu", n_users, counters.max_global));
return CmdResult::SUCCESS;
}
class InvisibleWatcher : public ModeWatcher
{
- unsigned int& invisible;
+ size_t& invisible;
public:
- InvisibleWatcher(Module* mod, unsigned int& Invisible)
- : ModeWatcher(mod, "invisible", MODETYPE_USER), invisible(Invisible)
+ InvisibleWatcher(Module* mod, size_t& Invisible)
+ : ModeWatcher(mod, "invisible", MODETYPE_USER)
+ , invisible(Invisible)
{
}
diff --git a/src/coremods/core_mode.cpp b/src/coremods/core_mode.cpp
index 865bf2bcb..d65d3b45e 100644
--- a/src/coremods/core_mode.cpp
+++ b/src/coremods/core_mode.cpp
@@ -248,7 +248,7 @@ void CommandMode::DisplayCurrentModes(User* user, User* targetuser, Channel* tar
modenum.push(targetchannel->name);
GetModeList(modenum, targetchannel, user);
user->WriteNumeric(modenum);
- user->WriteNumeric(RPL_CHANNELCREATED, targetchannel->name, (unsigned long)targetchannel->age);
+ user->WriteNumeric(RPL_CHANNELCREATED, targetchannel->name, targetchannel->age);
}
else
{
diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp
index 6ef846018..a4887f192 100644
--- a/src/coremods/core_oper/cmd_die.cpp
+++ b/src/coremods/core_oper/cmd_die.cpp
@@ -62,12 +62,9 @@ CmdResult CommandDie::Handle(User* user, const Params& parameters)
{
if (irc::equals(parameters[0], ServerInstance->Config->ServerName))
{
- {
- std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating.";
- ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, diebuf);
- DieRestart::SendError(diebuf);
- }
-
+ const std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating.";
+ ServerInstance->Logs.Log(MODNAME, LOG_SPARSE, diebuf);
+ DieRestart::SendError(diebuf);
ServerInstance->Exit(EXIT_STATUS_DIE);
}
else
@@ -76,5 +73,4 @@ CmdResult CommandDie::Handle(User* user, const Params& parameters)
ServerInstance->SNO.WriteGlobalSno('a', "Failed DIE command from %s.", user->GetFullRealHost().c_str());
return CmdResult::FAILURE;
}
- return CmdResult::SUCCESS;
}
diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp
index 2f211767f..96fe48586 100644
--- a/src/coremods/core_reloadmodule.cpp
+++ b/src/coremods/core_reloadmodule.cpp
@@ -179,7 +179,7 @@ class DataKeeper
// Data saved for each user
struct UserData : public OwnedModesExts
{
- static const size_t UNUSED_INDEX = (size_t)-1;
+ static const size_t UNUSED_INDEX = SIZE_MAX;
size_t serializerindex;
UserData(User* user, size_t serializeridx)
@@ -520,7 +520,7 @@ void DataKeeper::Save(Module* currmod)
reloadevprov->Call(&ReloadModule::EventListener::OnReloadModuleSave, mod, this->moddata);
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Saved data about %lu users %lu chans %lu modules", (unsigned long)userdatalist.size(), (unsigned long)chandatalist.size(), (unsigned long)moddata.list.size());
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Saved data about %zu users %zu chans %zu modules", userdatalist.size(), chandatalist.size(), moddata.list.size());
}
void DataKeeper::VerifyServiceProvider(const ProviderInfo& service, const char* type)
@@ -694,7 +694,7 @@ void DataKeeper::DoRestoreModules()
for (ReloadModule::CustomData::List::iterator i = moddata.list.begin(); i != moddata.list.end(); ++i)
{
ReloadModule::CustomData::Data& data = *i;
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Calling module data handler %p", (void*)data.handler);
+ ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Calling module data handler %p", static_cast<void*>(data.handler));
data.handler->OnReloadModuleRestore(mod, data.data);
}
}
diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp
index a6ca4a2bc..fdfb0b6c6 100644
--- a/src/coremods/core_whois.cpp
+++ b/src/coremods/core_whois.cpp
@@ -315,7 +315,7 @@ CmdResult CommandWhois::HandleLocal(LocalUser* user, const Params& parameters)
LocalUser* localuser = IS_LOCAL(dest);
if (localuser && (ServerInstance->Config->HideServer.empty() || parameters.size() > 1))
{
- idle = labs((long)((localuser->idle_lastmsg)-ServerInstance->Time()));
+ idle = std::max<unsigned long>(localuser->idle_lastmsg - ServerInstance->Time(), 0);
signon = dest->signon;
}
diff --git a/src/cull.cpp b/src/cull.cpp
index ed4b06c09..9a6665a29 100644
--- a/src/cull.cpp
+++ b/src/cull.cpp
@@ -35,7 +35,7 @@ Cullable::Cullable()
if (ServerInstance)
{
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Cullable::+%s @%p",
- typeid(*this).name(), (void*)this);
+ typeid(*this).name(), static_cast<void*>(this));
}
#endif
}
@@ -46,7 +46,7 @@ Cullable::~Cullable()
if (ServerInstance)
{
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Cullable::~%s @%p",
- typeid(*this).name(), (void*)this);
+ typeid(*this).name(), static_cast<void*>(this));
}
#endif
}
@@ -57,7 +57,7 @@ Cullable::Result Cullable::Cull()
if (ServerInstance)
{
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Cullable::-%s @%p",
- typeid(*this).name(), (void*)this);
+ typeid(*this).name(), static_cast<void*>(this));
}
#endif
return Result();
@@ -88,9 +88,9 @@ void CullList::Apply()
{
#ifdef INSPIRCD_ENABLE_RTTI
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Deleting %s @%p", typeid(*c).name(),
- (void*)c);
+ static_cast<void*>(c));
#else
- ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Deleting @%p", (void*)c);
+ ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Deleting @%p", static_cast<void*>(c));
#endif
c->Cull();
queue.push_back(c);
@@ -98,7 +98,7 @@ void CullList::Apply()
else
{
ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "WARNING: Object @%p culled twice!",
- (void*)c);
+ static_cast<void*>(c));
}
}
list.clear();
diff --git a/src/extensible.cpp b/src/extensible.cpp
index bb236061d..88230ae9a 100644
--- a/src/extensible.cpp
+++ b/src/extensible.cpp
@@ -55,7 +55,10 @@ Extensible::Extensible()
Extensible::~Extensible()
{
if ((!extensions.empty() || !culled) && ServerInstance)
- ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p", (void*)this);
+ {
+ ServerInstance->Logs.Log("CULLLIST", LOG_DEBUG, "Extensible destructor called without cull @%p",
+ static_cast<void*>(this));
+ }
}
Cullable::Result Extensible::Cull()
@@ -137,15 +140,15 @@ void ExtensionItem::Sync(const Extensible* container, void* item)
switch (type)
{
case ExtensionItem::EXT_CHANNEL:
- ServerInstance->PI->SendMetaData((Channel*)container, name, networkstr);
+ ServerInstance->PI->SendMetaData(static_cast<const Channel*>(container), name, networkstr);
break;
case ExtensionItem::EXT_MEMBERSHIP:
- ServerInstance->PI->SendMetaData((Membership*)container, name, networkstr);
+ ServerInstance->PI->SendMetaData(static_cast<const Membership*>(container), name, networkstr);
break;
case ExtensionItem::EXT_USER:
- ServerInstance->PI->SendMetaData((User*)container, name, networkstr);
+ ServerInstance->PI->SendMetaData(static_cast<const User*>(container), name, networkstr);
break;
}
}
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index ff12328b3..37158bb06 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -89,8 +89,8 @@ unsigned const char ascii_case_insensitive_map[256] = {
bool irc::equals(const std::string& s1, const std::string& s2)
{
- const unsigned char* n1 = (const unsigned char*)s1.c_str();
- const unsigned char* n2 = (const unsigned char*)s2.c_str();
+ const unsigned char* n1 = reinterpret_cast<const unsigned char*>(s1.c_str());
+ const unsigned char* n2 = reinterpret_cast<const unsigned char*>(s2.c_str());
for (; *n1 && *n2; n1++, n2++)
if (national_case_insensitive_map[*n1] != national_case_insensitive_map[*n2])
return false;
@@ -111,7 +111,9 @@ size_t irc::find(const std::string& haystack, const std::string& needle)
bool found = true;
for (size_t npos = 0; npos < needle.length(); ++npos)
{
- if (national_case_insensitive_map[(unsigned char)needle[npos]] != national_case_insensitive_map[(unsigned char)haystack[hpos + npos]])
+ unsigned char unpos = needle[npos];
+ unsigned char uhpos = haystack[hpos + npos];
+ if (national_case_insensitive_map[unpos] != national_case_insensitive_map[uhpos])
{
// Uh-oh, characters at the current haystack position don't match.
found = false;
@@ -131,15 +133,14 @@ size_t irc::find(const std::string& haystack, const std::string& needle)
bool irc::insensitive_swo::operator()(const std::string& a, const std::string& b) const
{
- const unsigned char* charmap = national_case_insensitive_map;
std::string::size_type asize = a.size();
std::string::size_type bsize = b.size();
std::string::size_type maxsize = std::min(asize, bsize);
for (std::string::size_type i = 0; i < maxsize; i++)
{
- unsigned char A = charmap[(unsigned char)a[i]];
- unsigned char B = charmap[(unsigned char)b[i]];
+ unsigned char A = national_case_insensitive_map[static_cast<unsigned char>(a[i])];
+ unsigned char B = national_case_insensitive_map[static_cast<unsigned char>(b[i])];
if (A > B)
return false;
else if (A < B)
@@ -157,8 +158,8 @@ size_t irc::insensitive::operator()(const std::string &s) const
* This avoids a copy to use hash<const char*>
*/
size_t t = 0;
- for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
- t = 5 * t + national_case_insensitive_map[(unsigned char)*x];
+ for (const auto& c : s)
+ t = 5 * t + national_case_insensitive_map[static_cast<unsigned char>(c)];
return t;
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 9e3f1d4e1..607f44a28 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -501,7 +501,7 @@ std::string InspIRCd::GenRandomStr(unsigned int length, bool printable)
unsigned long InspIRCd::GenRandomInt(unsigned long max)
{
unsigned long rv;
- GenRandom((char*)&rv, sizeof(rv));
+ GenRandom(reinterpret_cast<char*>(&rv), sizeof(rv));
return rv % max;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 526514329..a934a5b62 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -65,6 +65,7 @@ unsigned const char* national_case_insensitive_map = ascii_case_insensitive_map;
namespace
{
+ [[noreturn]]
void VoidSignalHandler(int);
// Warns a user running as root that they probably shouldn't.
@@ -309,7 +310,6 @@ namespace
<< con_bright << "Usage: " << con_reset << argv[0] << " [--config <file>] [--debug] [--nofork] [--nolog]" << std::endl
<< std::string(strlen(argv[0]) + 8, ' ') << "[--nopid] [--runasroot] [--version]" << std::endl;
ServerInstance->Exit(EXIT_STATUS_ARGV);
- break;
}
}
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 893bc304a..0f12aebbe 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -294,7 +294,7 @@ void StreamSocket::FlushSendQ(SendQueue& sq)
rv = SocketEngine::WriteV(this, iovecs, bufcount);
}
- if (rv == (int)sq.bytes())
+ if (rv == static_cast<int>(sq.bytes()))
{
// it's our lucky day, everything got written out. Fast cleanup.
// This won't ever happen if the number of buffers got capped.
@@ -311,7 +311,7 @@ void StreamSocket::FlushSendQ(SendQueue& sq)
while (rv > 0 && !sq.empty())
{
const SendQueue::Element& front = sq.front();
- if (front.length() <= (size_t)rv)
+ if (front.length() <= static_cast<size_t>(rv))
{
// this string got fully written out
rv -= front.length();
@@ -518,7 +518,7 @@ void StreamSocket::AddIOHook(IOHook* newhook)
return;
}
- IOHookMiddle* lasthook;
+ IOHookMiddle* lasthook = nullptr;
while (curr)
{
lasthook = IOHookMiddle::ToMiddleHook(curr);
diff --git a/src/inspstring.cpp b/src/inspstring.cpp
index 3cbf06602..a94b46fac 100644
--- a/src/inspstring.cpp
+++ b/src/inspstring.cpp
@@ -50,7 +50,7 @@ std::string BinToBase64(const std::string& data_str, const char* table, char pad
table = b64table;
uint32_t buffer;
- uint8_t* data = (uint8_t*)data_str.data();
+ const uint8_t* data = reinterpret_cast<const uint8_t*>(data_str.data());
std::string rv;
size_t i = 0;
while (i + 2 < data_str.length())
diff --git a/src/listmode.cpp b/src/listmode.cpp
index 7ecdc2eeb..42ba49114 100644
--- a/src/listmode.cpp
+++ b/src/listmode.cpp
@@ -40,7 +40,7 @@ void ListModeBase::DisplayList(User* user, Channel* channel)
{
for (ModeList::const_iterator it = cd->list.begin(); it != cd->list.end(); ++it)
{
- user->WriteNumeric(listnumeric, channel->name, it->mask, it->setter, (unsigned long) it->time);
+ user->WriteNumeric(listnumeric, channel->name, it->mask, it->setter, it->time);
}
}
user->WriteNumeric(endoflistnumeric, channel->name, endofliststring);
diff --git a/src/modules.cpp b/src/modules.cpp
index 5ff3b8041..495d82930 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -209,19 +209,19 @@ void ModuleManager::Attach(Implementation* i, Module* mod, size_t sz)
void ModuleManager::AttachAll(Module* mod)
{
for (size_t i = 0; i != I_END; ++i)
- Attach((Implementation)i, mod);
+ Attach(static_cast<Implementation>(i), mod);
}
void ModuleManager::DetachAll(Module* mod)
{
for (size_t n = 0; n != I_END; ++n)
- Detach((Implementation)n, mod);
+ Detach(static_cast<Implementation>(n), mod);
}
void ModuleManager::SetPriority(Module* mod, Priority s)
{
for (size_t n = 0; n != I_END; ++n)
- SetPriority(mod, (Implementation)n, s);
+ SetPriority(mod, static_cast<Implementation>(n), s);
}
bool ModuleManager::SetPriority(Module* mod, Implementation i, Priority s, Module* which)
@@ -608,7 +608,7 @@ void ModuleManager::DelService(ServiceProvider& item)
case SERVICE_MODE:
if (!ServerInstance->Modes.DelMode(static_cast<ModeHandler*>(&item)))
throw ModuleException("Mode "+std::string(item.name)+" does not exist.");
- // Fall through
+ [[fallthrough]];
case SERVICE_DATA:
case SERVICE_IOHOOK:
{
diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp
index e39e171a6..da045868d 100644
--- a/src/modules/extra/m_geo_maxmind.cpp
+++ b/src/modules/extra/m_geo_maxmind.cpp
@@ -156,7 +156,7 @@ class ModuleGeoMaxMind : public Module
memset(&geoapi.mmdb, 0, sizeof(geoapi.mmdb));
}
- ~ModuleGeoMaxMind()
+ ~ModuleGeoMaxMind() override
{
MMDB_close(&geoapi.mmdb);
}
diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp
index 09c9a3f6e..bfb1397cb 100644
--- a/src/modules/extra/m_ldap.cpp
+++ b/src/modules/extra/m_ldap.cpp
@@ -294,7 +294,7 @@ class LDAPService : public LDAPProvider, public SocketThread
Connect();
}
- ~LDAPService()
+ ~LDAPService() override
{
this->LockQueue();
@@ -623,7 +623,7 @@ class ModuleLDAP : public Module
{
}
- ~ModuleLDAP()
+ ~ModuleLDAP() override
{
for (ServiceMap::iterator i = LDAPServices.begin(); i != LDAPServices.end(); ++i)
{
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 446bf730b..728f5a04a 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -140,7 +140,7 @@ class ModuleSQL : public Module
void init() override;
ModuleSQL();
- ~ModuleSQL();
+ ~ModuleSQL() override;
void ReadConfig(ConfigStatus& status) override;
void OnUnloadModule(Module* mod) override;
};
@@ -305,7 +305,7 @@ class SQLConnection : public SQL::Provider
{
}
- ~SQLConnection()
+ ~SQLConnection() override
{
mysql_close(connection);
}
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 368e5e363..baa22b999 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -207,7 +207,7 @@ class SQLConn : public SQL::Provider, public EventHandler
return this->EventHandler::Cull();
}
- ~SQLConn()
+ ~SQLConn() override
{
SQL::Error err(SQL::BAD_DBID);
if (qinprog.c)
@@ -532,7 +532,7 @@ class ModulePgSQL : public Module
{
}
- ~ModulePgSQL()
+ ~ModulePgSQL() override
{
delete retimer;
ClearAllConnections();
diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp
index 4d51be31b..fca30b4bf 100644
--- a/src/modules/extra/m_regex_pcre.cpp
+++ b/src/modules/extra/m_regex_pcre.cpp
@@ -63,7 +63,7 @@ class PCREPattern final
throw Regex::Exception(pattern, error, erroroffset);
}
- ~PCREPattern()
+ ~PCREPattern() override
{
pcre_free(regex);
}
diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp
index 943f7cca4..be3c28093 100644
--- a/src/modules/extra/m_regex_posix.cpp
+++ b/src/modules/extra/m_regex_posix.cpp
@@ -57,7 +57,7 @@ class POSIXPattern final
throw Regex::Exception(pattern, std::string(&errormsg[0], errormsg.size()));
}
- ~POSIXPattern()
+ ~POSIXPattern() override
{
regfree(&regex);
}
diff --git a/src/modules/extra/m_regex_tre.cpp b/src/modules/extra/m_regex_tre.cpp
index a0c901230..2285adaa6 100644
--- a/src/modules/extra/m_regex_tre.cpp
+++ b/src/modules/extra/m_regex_tre.cpp
@@ -64,7 +64,7 @@ class TREPattern final
throw Regex::Exception(pattern, std::string(&errormsg[0], errormsg.size()));
}
- ~TREPattern()
+ ~TREPattern() override
{
regfree(&regex);
}
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index 3cd9713cb..2f3954a84 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -113,7 +113,7 @@ class SQLConn : public SQL::Provider
}
}
- ~SQLConn()
+ ~SQLConn() override
{
if (conn)
{
@@ -237,7 +237,7 @@ class ModuleSQLite3 : public Module
{
}
- ~ModuleSQLite3()
+ ~ModuleSQLite3() override
{
ClearConns();
}
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 5557a3806..d4f33d819 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -1086,7 +1086,7 @@ class GnuTLSIOHookProvider : public SSLIOHookProvider
ServerInstance->Modules.AddService(*this);
}
- ~GnuTLSIOHookProvider()
+ ~GnuTLSIOHookProvider() override
{
ServerInstance->Modules.DelService(*this);
}
@@ -1199,7 +1199,7 @@ class ModuleSSLGnuTLS : public Module
}
}
- ~ModuleSSLGnuTLS()
+ ~ModuleSSLGnuTLS() override
{
ServerInstance->GenRandom = &InspIRCd::DefaultGenRandom;
}
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index 5282ee261..dd14ec080 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -818,7 +818,7 @@ class mbedTLSIOHookProvider : public SSLIOHookProvider
ServerInstance->Modules.AddService(*this);
}
- ~mbedTLSIOHookProvider()
+ ~mbedTLSIOHookProvider() override
{
ServerInstance->Modules.DelService(*this);
}
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index d7e5e3782..2a0479e3e 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -869,7 +869,7 @@ class OpenSSLIOHookProvider : public SSLIOHookProvider
ServerInstance->Modules.AddService(*this);
}
- ~OpenSSLIOHookProvider()
+ ~OpenSSLIOHookProvider() override
{
ServerInstance->Modules.DelService(*this);
}
@@ -952,7 +952,7 @@ class ModuleSSLOpenSSL : public Module
biomethods = OpenSSL::BIOMethod::alloc();
}
- ~ModuleSSLOpenSSL()
+ ~ModuleSSLOpenSSL() override
{
BIO_meth_free(biomethods);
}
diff --git a/src/modules/extra/m_sslrehashsignal.cpp b/src/modules/extra/m_sslrehashsignal.cpp
index c50ea10f2..b911c6a43 100644
--- a/src/modules/extra/m_sslrehashsignal.cpp
+++ b/src/modules/extra/m_sslrehashsignal.cpp
@@ -36,7 +36,7 @@ class ModuleSSLRehashSignal : public Module
{
}
- ~ModuleSSLRehashSignal()
+ ~ModuleSSLRehashSignal() override
{
signal(SIGUSR1, SIG_IGN);
}
diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp
index 7c7dc8844..645b2b916 100644
--- a/src/modules/m_anticaps.cpp
+++ b/src/modules/m_anticaps.cpp
@@ -142,10 +142,6 @@ class AntiCapsMode : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettin
case ACM_KICK_BAN:
out.append("kickban");
break;
- default:
- out.append("unknown~");
- out.append(ConvToStr(acs->method));
- break;
}
out.push_back(':');
out.append(ConvToStr(acs->minlen));
diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp
index a47ce8f36..9f3c9f7d5 100644
--- a/src/modules/m_bcrypt.cpp
+++ b/src/modules/m_bcrypt.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/// $CompilerFlags: -Ivendor_directory("bcrypt")
+/// $CompilerFlags: -isystem vendor_directory("bcrypt")
#include "inspircd.h"
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 4a01b569c..887c8b337 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -423,7 +423,7 @@ public:
time_t now = ServerInstance->Time();
/* +g and *not* accepted */
user->WriteNumeric(ERR_TARGUMODEG, dest->nick, "is in +g mode (server-side ignore).");
- if (now > (dat->lastnotify + (time_t)notify_cooldown))
+ if (now > (dat->lastnotify + notify_cooldown))
{
user->WriteNumeric(RPL_TARGNOTIFY, dest->nick, "has been informed that you messaged them.");
dest->WriteRemoteNumeric(RPL_UMODEGMSG, user->nick, InspIRCd::Format("%s@%s", user->ident.c_str(), user->GetDisplayedHost().c_str()), InspIRCd::Format("is messaging you, and you have user mode +g set. Use /ACCEPT +%s to allow.",
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index e368145b8..fd1cc2127 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -158,7 +158,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener
managerimpl = this;
}
- ~ManagerImpl()
+ ~ManagerImpl() override
{
for (CapMap::iterator i = caps.begin(); i != caps.end(); ++i)
{
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 8ca02402b..70c01109d 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -180,7 +180,7 @@ class ModuleCBan : public Module, public Stats::EventListener
ServerInstance->XLines->RegisterFactory(&f);
}
- ~ModuleCBan()
+ ~ModuleCBan() override
{
ServerInstance->XLines->DelAll("CBAN");
ServerInstance->XLines->UnregisterFactory(&f);
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 2000f1c40..79fa98faa 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -494,8 +494,8 @@ class ModuleCloaking : public Module
break;
}
case MODE_OPAQUE:
- default:
chost = SegmentIP(info, ip, true);
+ break;
}
return chost;
}
diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp
index 69bd6c1ad..4884da5d6 100644
--- a/src/modules/m_codepage.cpp
+++ b/src/modules/m_codepage.cpp
@@ -124,7 +124,7 @@ class ModuleCodepage
{
}
- ~ModuleCodepage()
+ ~ModuleCodepage() override
{
ServerInstance->IsNick = origisnick;
CheckInvalidNick();
diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp
index 5cfb0fe3f..aa71fd3c1 100644
--- a/src/modules/m_customprefix.cpp
+++ b/src/modules/m_customprefix.cpp
@@ -103,7 +103,7 @@ class ModuleCustomPrefix : public Module
}
}
- ~ModuleCustomPrefix()
+ ~ModuleCustomPrefix() override
{
stdalgo::delete_all(modes);
}
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index fc1465f7a..1857465af 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -234,7 +234,6 @@ class DNSBLResolver : public DNS::Request
break;
}
case DNSBLConfEntry::I_UNKNOWN:
- default:
break;
}
diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp
index 37146e03c..b44a825fb 100644
--- a/src/modules/m_exemptchanops.cpp
+++ b/src/modules/m_exemptchanops.cpp
@@ -40,12 +40,12 @@ class ExemptChanOps : public ListModeBase
syntax = "<restriction>:<prefix>";
}
- static PrefixMode* FindMode(const std::string& mode)
+ static PrefixMode* FindMode(const std::string& pmode)
{
- if (mode.length() == 1)
- return ServerInstance->Modes.FindPrefixMode(mode[0]);
+ if (pmode.length() == 1)
+ return ServerInstance->Modes.FindPrefixMode(pmode[0]);
- ModeHandler* mh = ServerInstance->Modes.FindMode(mode, MODETYPE_CHANNEL);
+ ModeHandler* mh = ServerInstance->Modes.FindMode(pmode, MODETYPE_CHANNEL);
return mh ? mh->IsPrefixMode() : NULL;
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index e2cfb13ed..cc9f2a211 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -128,7 +128,6 @@ class FilterResult
break;
default:
return *n;
- break;
}
}
return 0;
diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp
index 3f8e5bc12..afcafbcce 100644
--- a/src/modules/m_hidelist.cpp
+++ b/src/modules/m_hidelist.cpp
@@ -86,7 +86,7 @@ class ModuleHideList : public Module
{
}
- ~ModuleHideList()
+ ~ModuleHideList() override
{
stdalgo::delete_all(watchers);
}
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 9a2006035..168f0bdca 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -26,7 +26,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/// $CompilerFlags: -Ivendor_directory("http_parser")
+/// $CompilerFlags: -isystem vendor_directory("http_parser")
#include "inspircd.h"
@@ -225,7 +225,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru
ServerInstance->Timers.AddTimer(this);
}
- ~HttpServerSocket()
+ ~HttpServerSocket() override
{
sockets.erase(this);
}
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index c18c8c960..41e592f7f 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -320,17 +320,14 @@ namespace Stats
bool operator()(User* u1, User* u2)
{
- switch (order) {
+ switch (order)
+ {
case OB_LASTMSG:
return Compare(IS_LOCAL(u1)->idle_lastmsg, IS_LOCAL(u2)->idle_lastmsg);
- break;
case OB_NICK:
return Compare(u1->nick, u2->nick);
- break;
- default:
case OB_NONE:
return false;
- break;
}
}
};
diff --git a/src/modules/m_ircv3_sts.cpp b/src/modules/m_ircv3_sts.cpp
index ef1586208..4ee85bf73 100644
--- a/src/modules/m_ircv3_sts.cpp
+++ b/src/modules/m_ircv3_sts.cpp
@@ -74,7 +74,7 @@ class STSCap : public Cap::Capability
DisableAutoRegister();
}
- ~STSCap()
+ ~STSCap() override
{
// TODO: Send duration=0 when STS vanishes.
}
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index 539465b42..a57ae26fd 100644
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -311,7 +311,7 @@ class ModuleNationalChars : public Module
}
}
- ~ModuleNationalChars()
+ ~ModuleNationalChars() override
{
ServerInstance->IsNick = rememberer;
national_case_insensitive_map = lowermap_rememberer;
diff --git a/src/modules/m_pbkdf2.cpp b/src/modules/m_pbkdf2.cpp
index 6804ba89d..ddaa7a8e3 100644
--- a/src/modules/m_pbkdf2.cpp
+++ b/src/modules/m_pbkdf2.cpp
@@ -207,7 +207,7 @@ class ModulePBKDF2 : public Module
{
}
- ~ModulePBKDF2()
+ ~ModulePBKDF2() override
{
stdalgo::delete_all(providers);
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 80a597846..fe9bd7e48 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -232,7 +232,7 @@ class ModuleRLine
ServerInstance->XLines->RegisterFactory(&f);
}
- ~ModuleRLine()
+ ~ModuleRLine() override
{
ServerInstance->XLines->DelAll("R");
ServerInstance->XLines->UnregisterFactory(&f);
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 095a42fe7..b7318c86d 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -231,43 +231,41 @@ class SaslAuthenticator
{
switch (this->state)
{
- case SASL_INIT:
- this->agent = msg[0];
- this->state = SASL_COMM;
- /* fall through */
- case SASL_COMM:
- if (msg[0] != this->agent)
- return this->state;
+ case SASL_INIT:
+ this->agent = msg[0];
+ this->state = SASL_COMM;
+ [[fallthrough]];
- if (msg.size() < 4)
- return this->state;
+ case SASL_COMM:
+ if (msg[0] != this->agent)
+ return this->state;
- if (msg[2] == "C")
- {
- ClientProtocol::Message authmsg("AUTHENTICATE");
- authmsg.PushParamRef(msg[3]);
+ if (msg.size() < 4)
+ return this->state;
- ClientProtocol::Event authevent(*g_protoev, authmsg);
- LocalUser* const localuser = IS_LOCAL(user);
- if (localuser)
- localuser->Send(authevent);
- }
- else if (msg[2] == "D")
- {
- this->state = SASL_DONE;
- this->result = this->GetSaslResult(msg[3]);
- }
- else if (msg[2] == "M")
- this->user->WriteNumeric(RPL_SASLMECHS, msg[3], "are available SASL mechanisms");
- else
- ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
+ if (msg[2] == "C")
+ {
+ ClientProtocol::Message authmsg("AUTHENTICATE");
+ authmsg.PushParamRef(msg[3]);
- break;
- case SASL_DONE:
- break;
- default:
- ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state);
- break;
+ ClientProtocol::Event authevent(*g_protoev, authmsg);
+ LocalUser* const localuser = IS_LOCAL(user);
+ if (localuser)
+ localuser->Send(authevent);
+ }
+ else if (msg[2] == "D")
+ {
+ this->state = SASL_DONE;
+ this->result = this->GetSaslResult(msg[3]);
+ }
+ else if (msg[2] == "M")
+ this->user->WriteNumeric(RPL_SASLMECHS, msg[3], "are available SASL mechanisms");
+ else
+ ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
+ break;
+
+ case SASL_DONE:
+ break;
}
return this->state;
@@ -306,8 +304,6 @@ class SaslAuthenticator
case SASL_FAIL:
this->user->WriteNumeric(ERR_SASLFAIL, "SASL authentication failed");
break;
- default:
- break;
}
this->state_announced = true;
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index db15f8c26..cdef9ec04 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -264,7 +264,6 @@ class ModuleServicesAccount
// User is messaging a +M channel and is not registered or exempt.
user->WriteNumeric(ERR_NEEDREGGEDNICK, targchan->name, "You need to be identified to a registered account to message this channel");
return MOD_RES_DENY;
- break;
}
case MessageTarget::TYPE_USER:
{
@@ -278,7 +277,6 @@ class ModuleServicesAccount
// User is messaging a +R user and is not registered or on an accept list.
user->WriteNumeric(ERR_NEEDREGGEDNICK, targuser->nick, "You need to be identified to a registered account to message this user");
return MOD_RES_DENY;
- break;
}
case MessageTarget::TYPE_SERVER:
break;
diff --git a/src/modules/m_sha2.cpp b/src/modules/m_sha2.cpp
index 3c3560d5c..e3ad8a6f7 100644
--- a/src/modules/m_sha2.cpp
+++ b/src/modules/m_sha2.cpp
@@ -23,7 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/// $CompilerFlags: -Ivendor_directory("sha2")
+/// $CompilerFlags: -isystem vendor_directory("sha2")
#include "inspircd.h"
@@ -43,7 +43,7 @@ class HashSHA2 : public HashProvider
std::string GenerateRaw(const std::string& data) override
{
std::vector<char> bytes(out_size);
- SHA((unsigned char*)data.data(), data.size(), (unsigned char*)&bytes[0]);
+ SHA(reinterpret_cast<const unsigned char*>(data.data()), data.size(), reinterpret_cast<unsigned char*>(&bytes[0]));
return std::string(&bytes[0], bytes.size());
}
};
diff --git a/src/modules/m_showfile.cpp b/src/modules/m_showfile.cpp
index 3c9973853..d8e8ef827 100644
--- a/src/modules/m_showfile.cpp
+++ b/src/modules/m_showfile.cpp
@@ -171,7 +171,7 @@ class ModuleShowFile : public Module
cmds.swap(newcmds);
}
- ~ModuleShowFile()
+ ~ModuleShowFile() override
{
stdalgo::delete_all(cmds);
}
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 6ff15645d..404ddbb43 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -185,7 +185,7 @@ class ModuleShun : public Module, public Stats::EventListener
ServerInstance->XLines->RegisterFactory(&shun);
}
- ~ModuleShun()
+ ~ModuleShun() override
{
ServerInstance->XLines->DelAll("SHUN");
ServerInstance->XLines->UnregisterFactory(&shun);
diff --git a/src/modules/m_spanningtree/commands.h b/src/modules/m_spanningtree/commands.h
index 234776d7c..152ee25d7 100644
--- a/src/modules/m_spanningtree/commands.h
+++ b/src/modules/m_spanningtree/commands.h
@@ -102,9 +102,9 @@ class CommandMetadata : public ServerCommand
class Builder : public CmdBuilder
{
public:
- Builder(User* user, const std::string& key, const std::string& val);
- Builder(Channel* chan, const std::string& key, const std::string& val);
- Builder(Membership* memb, const std::string& key, const std::string& val);
+ Builder(const User* user, const std::string& key, const std::string& val);
+ Builder(const Channel* chan, const std::string& key, const std::string& val);
+ Builder(const Membership* memb, const std::string& key, const std::string& val);
Builder(const std::string& key, const std::string& val);
};
};
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 0d4c32d72..7b1f8ef5b 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -220,6 +220,6 @@ class ModuleSpanningTree
void OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags) override;
void OnShutdown(const std::string& reason) override;
Cullable::Result Cull() override;
- ~ModuleSpanningTree();
+ ~ModuleSpanningTree() override;
void Prioritize() override;
};
diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp
index f250861f1..aabd4cbbc 100644
--- a/src/modules/m_spanningtree/metadata.cpp
+++ b/src/modules/m_spanningtree/metadata.cpp
@@ -110,7 +110,7 @@ CmdResult CommandMetadata::Handle(User* srcuser, Params& params)
return CmdResult::SUCCESS;
}
-CommandMetadata::Builder::Builder(User* user, const std::string& key, const std::string& val)
+CommandMetadata::Builder::Builder(const User* user, const std::string& key, const std::string& val)
: CmdBuilder("METADATA")
{
push(user->uuid);
@@ -118,7 +118,7 @@ CommandMetadata::Builder::Builder(User* user, const std::string& key, const std:
push_last(val);
}
-CommandMetadata::Builder::Builder(Channel* chan, const std::string& key, const std::string& val)
+CommandMetadata::Builder::Builder(const Channel* chan, const std::string& key, const std::string& val)
: CmdBuilder("METADATA")
{
push(chan->name);
@@ -127,7 +127,7 @@ CommandMetadata::Builder::Builder(Channel* chan, const std::string& key, const s
push_last(val);
}
-CommandMetadata::Builder::Builder(Membership* memb, const std::string& key, const std::string& val)
+CommandMetadata::Builder::Builder(const Membership* memb, const std::string& key, const std::string& val)
: CmdBuilder("METADATA")
{
push_raw("@");
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 59a282378..8e0d0fd4d 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -87,17 +87,17 @@ void SpanningTreeProtocolInterface::BroadcastEncap(const std::string& cmd, const
CmdBuilder(source, "ENCAP * ").push_raw(cmd).insert(params).Forward(server);
}
-void SpanningTreeProtocolInterface::SendMetaData(User* u, const std::string& key, const std::string& data)
+void SpanningTreeProtocolInterface::SendMetaData(const User* u, const std::string& key, const std::string& data)
{
CommandMetadata::Builder(u, key, data).Broadcast();
}
-void SpanningTreeProtocolInterface::SendMetaData(Channel* c, const std::string& key, const std::string& data)
+void SpanningTreeProtocolInterface::SendMetaData(const Channel* c, const std::string& key, const std::string& data)
{
CommandMetadata::Builder(c, key, data).Broadcast();
}
-void SpanningTreeProtocolInterface::SendMetaData(Membership* m, const std::string& key, const std::string& data)
+void SpanningTreeProtocolInterface::SendMetaData(const Membership* m, const std::string& key, const std::string& data)
{
CommandMetadata::Builder(m, key, data).Broadcast();
}
diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h
index b44599db0..e4cda3c84 100644
--- a/src/modules/m_spanningtree/protocolinterface.h
+++ b/src/modules/m_spanningtree/protocolinterface.h
@@ -37,9 +37,9 @@ class SpanningTreeProtocolInterface : public ProtocolInterface
bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source) override;
void BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source, User* omit) override;
- void SendMetaData(User* user, const std::string& key, const std::string& data) override;
- void SendMetaData(Channel* chan, const std::string& key, const std::string& data) override;
- void SendMetaData(Membership* memb, const std::string& key, const std::string& data) override;
+ void SendMetaData(const User* user, const std::string& key, const std::string& data) override;
+ void SendMetaData(const Channel* chan, const std::string& key, const std::string& data) override;
+ void SendMetaData(const Membership* memb, const std::string& key, const std::string& data) override;
void SendMetaData(const std::string& key, const std::string& data) override;
void SendSNONotice(char snomask, const std::string& text) override;
void SendMessage(Channel* target, char status, const std::string& text, MessageType msgtype) override;
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index 028bbf49d..8b09f3817 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -234,7 +234,7 @@ class TreeServer : public Server
/** Destructor, deletes ServerUser unless IsRoot()
*/
- ~TreeServer();
+ ~TreeServer() override;
/** Returns the TreeServer the given user is connected to
* @param user The user whose server to return
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 2782330d5..daca8417b 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -123,7 +123,7 @@ class SpanningTreeUtilities : public Cullable
/** Destroy class and free listeners etc
*/
- ~SpanningTreeUtilities();
+ ~SpanningTreeUtilities() override;
void RouteCommand(TreeServer* origin, CommandBase* cmd, const CommandBase::Params& parameters, User* user);
diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp
index f037336ff..7ff0b1759 100644
--- a/src/modules/m_sqloper.cpp
+++ b/src/modules/m_sqloper.cpp
@@ -195,7 +195,7 @@ public:
GetOperBlocks();
}
- ~ModuleSQLOper()
+ ~ModuleSQLOper() override
{
// Remove all oper blocks that were from the DB
for (std::vector<std::string>::const_iterator i = my_blocks.begin(); i != my_blocks.end(); ++i)
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index 4b60e5110..e7b7027db 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -223,7 +223,7 @@ class ModuleSVSHold : public Module, public Stats::EventListener
return MOD_RES_PASSTHRU;
}
- ~ModuleSVSHold()
+ ~ModuleSVSHold() override
{
ServerInstance->XLines->DelAll("SVSHOLD");
ServerInstance->XLines->UnregisterFactory(&s);
diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp
index bd9ce068b..9bbf6ffa0 100644
--- a/src/modules/m_websocket.cpp
+++ b/src/modules/m_websocket.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/// $CompilerFlags: -Ivendor_directory("utfcpp")
+/// $CompilerFlags: -isystem vendor_directory("utfcpp")
#include "inspircd.h"
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index cf1f2554a..296525534 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -147,6 +147,6 @@ std::string Snomask::GetDescription(char letter) const
if (!Description.empty())
ret += Description;
else
- ret += std::string("SNO-") + (char)tolower(letter);
+ ret += InspIRCd::Format("SNO-%c", tolower(letter));
return ret;
}
diff --git a/src/socket.cpp b/src/socket.cpp
index 4e408ec33..34da4d79e 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -236,13 +236,13 @@ std::string irc::sockets::sockaddrs::addr() const
{
case AF_INET:
char ip4addr[INET_ADDRSTRLEN];
- if (!inet_ntop(AF_INET, (void*)&in4.sin_addr, ip4addr, sizeof(ip4addr)))
+ if (!inet_ntop(AF_INET, static_cast<const void*>(&in4.sin_addr), ip4addr, sizeof(ip4addr)))
return "0.0.0.0";
return ip4addr;
case AF_INET6:
char ip6addr[INET6_ADDRSTRLEN];
- if (!inet_ntop(AF_INET6, (void*)&in6.sin6_addr, ip6addr, sizeof(ip6addr)))
+ if (!inet_ntop(AF_INET6, static_cast<const void*>(&in6.sin6_addr), ip6addr, sizeof(ip6addr)))
return "0:0:0:0:0:0:0:0";
return ip6addr;
@@ -261,13 +261,13 @@ std::string irc::sockets::sockaddrs::str() const
{
case AF_INET:
char ip4addr[INET_ADDRSTRLEN];
- if (!inet_ntop(AF_INET, (void*)&in4.sin_addr, ip4addr, sizeof(ip4addr)))
+ if (!inet_ntop(AF_INET, static_cast<const void*>(&in4.sin_addr), ip4addr, sizeof(ip4addr)))
strcpy(ip4addr, "0.0.0.0");
return InspIRCd::Format("%s:%u", ip4addr, ntohs(in4.sin_port));
case AF_INET6:
char ip6addr[INET6_ADDRSTRLEN];
- if (!inet_ntop(AF_INET6, (void*)&in6.sin6_addr, ip6addr, sizeof(ip6addr)))
+ if (!inet_ntop(AF_INET6, static_cast<const void*>(&in6.sin6_addr), ip6addr, sizeof(ip6addr)))
strcpy(ip6addr, "0:0:0:0:0:0:0:0");
return InspIRCd::Format("[%s]:%u", ip6addr, ntohs(in6.sin6_port));
@@ -340,13 +340,13 @@ static void sa2cidr(irc::sockets::cidr_mask& cidr, const irc::sockets::sockaddrs
case AF_INET:
cidr.length = range > 32 ? 32 : range;
target_byte = sizeof(sa.in4.sin_addr);
- base = (unsigned char*)&sa.in4.sin_addr;
+ base = reinterpret_cast<const unsigned char*>(&sa.in4.sin_addr);
break;
case AF_INET6:
cidr.length = range > 128 ? 128 : range;
target_byte = sizeof(sa.in6.sin6_addr);
- base = (unsigned char*)&sa.in6.sin6_addr;
+ base = reinterpret_cast<const unsigned char*>(&sa.in6.sin6_addr);
break;
default:
@@ -402,12 +402,12 @@ std::string irc::sockets::cidr_mask::str() const
switch (type)
{
case AF_INET:
- base = (unsigned char*)&sa.in4.sin_addr;
+ base = reinterpret_cast<unsigned char*>(&sa.in4.sin_addr);
len = 4;
break;
case AF_INET6:
- base = (unsigned char*)&sa.in6.sin6_addr;
+ base = reinterpret_cast<unsigned char*>(&sa.in6.sin6_addr);
len = 16;
break;
@@ -421,7 +421,7 @@ std::string irc::sockets::cidr_mask::str() const
}
memcpy(base, bits, len);
- return sa.addr() + "/" + ConvToStr((int)length);
+ return sa.addr() + "/" + ConvToStr(length);
}
bool irc::sockets::cidr_mask::operator==(const cidr_mask& other) const
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 9186f2c8c..2841e20a2 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -231,33 +231,33 @@ int SocketEngine::NonBlocking(int fd)
void SocketEngine::SetReuse(int fd)
{
int on = 1;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on));
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, static_cast<void*>(&on), sizeof(on));
}
int SocketEngine::RecvFrom(EventHandler* fd, void *buf, size_t len, int flags, sockaddr *from, socklen_t *fromlen)
{
- int nbRecvd = recvfrom(fd->GetFd(), (char*)buf, len, flags, from, fromlen);
+ int nbRecvd = recvfrom(fd->GetFd(), static_cast<char*>(buf), len, flags, from, fromlen);
stats.UpdateReadCounters(nbRecvd);
return nbRecvd;
}
int SocketEngine::Send(EventHandler* fd, const void *buf, size_t len, int flags)
{
- int nbSent = send(fd->GetFd(), (const char*)buf, len, flags);
+ int nbSent = send(fd->GetFd(), static_cast<const char*>(buf), len, flags);
stats.UpdateWriteCounters(nbSent);
return nbSent;
}
int SocketEngine::Recv(EventHandler* fd, void *buf, size_t len, int flags)
{
- int nbRecvd = recv(fd->GetFd(), (char*)buf, len, flags);
+ int nbRecvd = recv(fd->GetFd(), static_cast<char*>(buf), len, flags);
stats.UpdateReadCounters(nbRecvd);
return nbRecvd;
}
int SocketEngine::SendTo(EventHandler* fd, const void* buf, size_t len, int flags, const irc::sockets::sockaddrs& address)
{
- int nbSent = sendto(fd->GetFd(), (const char*)buf, len, flags, &address.sa, address.sa_size());
+ int nbSent = sendto(fd->GetFd(), static_cast<const char*>(buf), len, flags, &address.sa, address.sa_size());
stats.UpdateWriteCounters(nbSent);
return nbSent;
}
@@ -354,8 +354,8 @@ void SocketEngine::Statistics::CheckFlush() const
void SocketEngine::Statistics::GetBandwidth(float& kbitpersec_in, float& kbitpersec_out, float& kbitpersec_total) const
{
CheckFlush();
- float in_kbit = indata * 8;
- float out_kbit = outdata * 8;
+ float in_kbit = static_cast<float>(indata) * 8;
+ float out_kbit = static_cast<float>(outdata) * 8;
kbitpersec_total = ((in_kbit + out_kbit) / 1024);
kbitpersec_in = in_kbit / 1024;
kbitpersec_out = out_kbit / 1024;
diff --git a/src/threadsocket.cpp b/src/threadsocket.cpp
index a2d0aae82..4a8b542eb 100644
--- a/src/threadsocket.cpp
+++ b/src/threadsocket.cpp
@@ -35,7 +35,7 @@ class ThreadSignalSocket : public EventHandler
SocketEngine::AddFd(this, FD_WANT_FAST_READ | FD_WANT_NO_WRITE);
}
- ~ThreadSignalSocket()
+ ~ThreadSignalSocket() override
{
SocketEngine::Close(this);
}
diff --git a/src/users.cpp b/src/users.cpp
index fd68c6761..4415a2f01 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -234,8 +234,8 @@ void UserIOHandler::OnDataReady()
if (recvq.length() > user->GetClass()->GetRecvqMax() && !user->HasPrivPermission("users/flood/increased-buffers"))
{
ServerInstance->Users.QuitUser(user, "RecvQ exceeded");
- ServerInstance->SNO.WriteToSnoMask('a', "User %s RecvQ of %lu exceeds connect class maximum of %lu",
- user->nick.c_str(), (unsigned long)recvq.length(), user->GetClass()->GetRecvqMax());
+ ServerInstance->SNO.WriteToSnoMask('a', "User %s RecvQ of %zu exceeds connect class maximum of %lu",
+ user->nick.c_str(), recvq.length(), user->GetClass()->GetRecvqMax());
return;
}
@@ -796,7 +796,7 @@ void LocalUser::Write(const ClientProtocol::SerializedMessage& text)
if (nlpos == std::string::npos)
nlpos = text.length(); // TODO is this ok, test it
- ServerInstance->Logs.Log("USEROUTPUT", LOG_RAWIO, "C[%s] O %.*s", uuid.c_str(), (int) nlpos, text.c_str());
+ ServerInstance->Logs.Log("USEROUTPUT", LOG_RAWIO, "C[%s] O %.*s", uuid.c_str(), static_cast<int>(nlpos), text.c_str());
}
eh.AddWriteBuf(text);
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index f9e706906..364051cf1 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -26,10 +26,10 @@
static bool MatchInternal(const unsigned char* str, const unsigned char* mask, unsigned const char* map)
{
- unsigned char* cp = NULL;
- unsigned char* mp = NULL;
- unsigned char* string = (unsigned char*)str;
- unsigned char* wild = (unsigned char*)mask;
+ const unsigned char* cp = nullptr;
+ const unsigned char* mp = nullptr;
+ const unsigned char* string = reinterpret_cast<const unsigned char*>(str);
+ const unsigned char* wild = reinterpret_cast<const unsigned char*>(mask);
while ((*string) && (*wild != '*'))
{
@@ -81,7 +81,7 @@ bool InspIRCd::Match(const std::string& str, const std::string& mask, unsigned c
if (!map)
map = national_case_insensitive_map;
- return MatchInternal((const unsigned char*)str.c_str(), (const unsigned char*)mask.c_str(), map);
+ return MatchInternal(reinterpret_cast<const unsigned char*>(str.c_str()), reinterpret_cast<const unsigned char*>(mask.c_str()), map);
}
bool InspIRCd::Match(const char* str, const char* mask, unsigned const char* map)
@@ -89,7 +89,7 @@ bool InspIRCd::Match(const char* str, const char* mask, unsigned const char* map
if (!map)
map = national_case_insensitive_map;
- return MatchInternal((const unsigned char*)str, (const unsigned char*)mask, map);
+ return MatchInternal(reinterpret_cast<const unsigned char*>(str), reinterpret_cast<const unsigned char*>(mask), map);
}
bool InspIRCd::MatchCIDR(const std::string& str, const std::string& mask, unsigned const char* map)