diff options
| author | 2020-02-06 11:25:42 +0000 | |
|---|---|---|
| committer | 2020-02-06 11:25:42 +0000 | |
| commit | 98e4ddfb21d285c8b675788c155bb204822fbd4a (patch) | |
| tree | 030eb18c989bf3c9e4768a538796e3221ca7934e /src | |
| parent | In C++11 [io]fstream has std::string constructors; use them. (diff) | |
Use C++11 inline initialisation for class members.
Diffstat (limited to 'src')
62 files changed, 134 insertions, 279 deletions
diff --git a/src/base.cpp b/src/base.cpp index 7f3177c20..c7765f1f5 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -75,7 +75,7 @@ void refcountbase::operator delete(void* obj) ::operator delete(obj); } -refcountbase::refcountbase() : refcount(0) +refcountbase::refcountbase() { if (this != last_heap) throw CoreException("Reference allocate on the stack!"); diff --git a/src/channels.cpp b/src/channels.cpp index e374199c6..8c8af6372 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -34,7 +34,8 @@ namespace } Channel::Channel(const std::string &cname, time_t ts) - : name(cname), age(ts), topicset(0) + : name(cname) + , age(ts) { if (!ServerInstance->chanlist.insert(std::make_pair(cname, this)).second) throw CoreException("Cannot create duplicate channel " + cname); diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 0405a5659..579c99fd8 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -327,13 +327,8 @@ void CommandParser::RemoveCommand(Command* x) CommandBase::CommandBase(Module* mod, const std::string& cmd, unsigned int minpara, unsigned int maxpara) : ServiceProvider(mod, cmd, SERVICE_COMMAND) - , flags_needed(0) , min_params(minpara) , max_params(maxpara) - , use_count(0) - , works_before_reg(false) - , allow_empty_last_param(true) - , Penalty(1) { } @@ -352,7 +347,6 @@ RouteDescriptor CommandBase::GetRouting(User* user, const Params& parameters) Command::Command(Module* mod, const std::string& cmd, unsigned int minpara, unsigned int maxpara) : CommandBase(mod, cmd, minpara, maxpara) - , force_manual_route(false) { } diff --git a/src/configparser.cpp b/src/configparser.cpp index fc4be52ff..2f84b971a 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -43,15 +43,13 @@ struct FilePosition std::string name; // The line of the file that this position points to. - unsigned int line; + unsigned int line = 1; // The column of the file that this position points to. - unsigned int column; + unsigned int column = 1; FilePosition(const std::string& Name) : name(Name) - , line(1) - , column(1) { } diff --git a/src/configreader.cpp b/src/configreader.cpp index 286454d1d..cbb78d3d6 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -70,9 +70,7 @@ ServerConfig::ServerConfig() : EmptyTag(CreateEmptyTag()) , Limits(EmptyTag) , Paths(EmptyTag) - , RawLog(false) , CaseMapping("ascii") - , NoSnoticeStack(false) { } diff --git a/src/coremods/core_channel/invite.cpp b/src/coremods/core_channel/invite.cpp index 9267cddf2..f9466f9f1 100644 --- a/src/coremods/core_channel/invite.cpp +++ b/src/coremods/core_channel/invite.cpp @@ -170,7 +170,6 @@ void Invite::APIImpl::Unserialize(LocalUser* user, const std::string& value) Invite::Invite::Invite(LocalUser* u, Channel* c) : user(u) , chan(c) - , expiretimer(NULL) { } diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 2aa0e6dcb..35ec87858 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -226,13 +226,10 @@ class Packet : public Query static const int HEADER_LENGTH = 12; /* ID for this packet */ - RequestId id; - /* Flags on the packet */ - unsigned short flags; + RequestId id = 0; - Packet() : id(0), flags(0) - { - } + /* Flags on the packet */ + unsigned short flags = 0; void Fill(const unsigned char* input, const unsigned short len) { @@ -348,7 +345,7 @@ class MyManager : public Manager, public Timer, public EventHandler cache_map cache; irc::sockets::sockaddrs myserver; - bool unloading; + bool unloading = false; /** Maximum number of entries in cache */ @@ -412,8 +409,9 @@ class MyManager : public Manager, public Timer, public EventHandler public: DNS::Request* requests[MAX_REQUEST_ID+1]; - MyManager(Module* c) : Manager(c), Timer(5*60, true) - , unloading(false) + MyManager(Module* c) + : Manager(c) + , Timer(5*60, true) { for (unsigned int i = 0; i <= MAX_REQUEST_ID; ++i) requests[i] = NULL; @@ -764,7 +762,7 @@ class ModuleDNS : public Module MyManager manager; std::string DNSServer; std::string SourceIP; - unsigned int SourcePort; + unsigned int SourcePort = 0; void FindDNSServer() { @@ -825,8 +823,8 @@ class ModuleDNS : public Module } public: - ModuleDNS() : manager(this) - , SourcePort(0) + ModuleDNS() + : manager(this) { } diff --git a/src/coremods/core_lusers.cpp b/src/coremods/core_lusers.cpp index 7ae703dad..5cb8bc4fb 100644 --- a/src/coremods/core_lusers.cpp +++ b/src/coremods/core_lusers.cpp @@ -29,12 +29,11 @@ struct LusersCounters { unsigned int max_local; unsigned int max_global; - unsigned int invisible; + unsigned int invisible = 0; LusersCounters(UserModeReference& invisiblemode) : max_local(ServerInstance->Users.LocalUserCount()) , max_global(ServerInstance->Users.RegisteredUserCount()) - , invisible(0) { const user_hash& users = ServerInstance->Users.GetUsers(); for (user_hash::const_iterator i = users.begin(); i != users.end(); ++i) diff --git a/src/coremods/core_mode.cpp b/src/coremods/core_mode.cpp index e241633c0..4e890074b 100644 --- a/src/coremods/core_mode.cpp +++ b/src/coremods/core_mode.cpp @@ -27,7 +27,7 @@ class CommandMode : public Command { private: unsigned int sent[256]; - unsigned int seq; + unsigned int seq = 0; ChanModeReference secretmode; ChanModeReference privatemode; @@ -74,7 +74,6 @@ class CommandMode : public Command CommandMode::CommandMode(Module* parent) : Command(parent, "MODE", 1) - , seq(0) , secretmode(creator, "secret") , privatemode(creator, "private") { diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index f64e4e6ff..3647d0081 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -81,11 +81,6 @@ CmdResult CommandWhowas::Handle(User* user, const Params& parameters) return CMD_SUCCESS; } -WhoWas::Manager::Manager() - : GroupSize(0), MaxGroups(0), MaxKeep(0) -{ -} - const WhoWas::Nick* WhoWas::Manager::FindNick(const std::string& nickname) const { whowas_users::const_iterator it = whowas.find(nickname); diff --git a/src/dynamic.cpp b/src/dynamic.cpp index e0d7f6d80..83a431256 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -34,8 +34,7 @@ #define DLL_EXTENSION ".so" DLLManager::DLLManager(const std::string& name) - : lib(NULL) - , libname(name) + : libname(name) { static size_t extlen = strlen(DLL_EXTENSION); if (name.length() <= extlen || name.compare(name.length() - extlen, name.length(), DLL_EXTENSION)) diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 1589ef26b..0ae90f074 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -164,7 +164,6 @@ size_t irc::insensitive::operator()(const std::string &s) const irc::tokenstream::tokenstream(const std::string& msg, size_t start, size_t end) : message(msg, start, end) - , position(0) { } @@ -213,7 +212,9 @@ bool irc::tokenstream::GetTrailing(std::string& token) } irc::sepstream::sepstream(const std::string& source, char separator, bool allowempty) - : tokens(source), sep(separator), pos(0), allow_empty(allowempty) + : tokens(source) + , sep(separator) + , allow_empty(allowempty) { } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 97941c72f..e3ea33d6a 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -448,12 +448,7 @@ void InspIRCd::WritePID(bool exitonfail) } InspIRCd::InspIRCd(int argc, char** argv) - : FakeClient(NULL) - , ConfigFileName(INSPIRCD_CONFIG_PATH "/inspircd.conf") - , ConfigThread(NULL) - , Config(NULL) - , XLines(NULL) - , PI(&DefaultProtocolInterface) + : PI(&DefaultProtocolInterface) , GenRandom(&DefaultGenRandom) , IsChannel(&DefaultIsChannel) , IsNick(&DefaultIsNick) diff --git a/src/logger.cpp b/src/logger.cpp index 8aad5e8f1..d87a06b34 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -58,11 +58,6 @@ const char LogStream::LogHeader[] = "Log started for " INSPIRCD_VERSION; -LogManager::LogManager() - : Logging(false) -{ -} - LogManager::~LogManager() { } @@ -317,7 +312,6 @@ void LogManager::Log(const std::string &type, LogLevel loglevel, const std::stri FileWriter::FileWriter(FILE* logfile, unsigned int flushcount) : log(logfile) , flush(flushcount) - , writeops(0) { } diff --git a/src/mode.cpp b/src/mode.cpp index 6ca7a7c54..302d98c66 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -35,12 +35,8 @@ ModeHandler::ModeHandler(Module* Creator, const std::string& Name, char modelett , modeid(ModeParser::MODEID_MAX) , parameters_taken(Params) , mode(modeletter) - , oper(false) - , list(false) , m_type(type) , type_id(mclass) - , ranktoset(HALFOP_VALUE) - , ranktounset(HALFOP_VALUE) { } @@ -176,7 +172,6 @@ PrefixMode::PrefixMode(Module* Creator, const std::string& Name, char ModeLetter : ModeHandler(Creator, Name, ModeLetter, PARAM_ALWAYS, MODETYPE_CHANNEL, MC_PREFIX) , prefix(PrefixChar) , prefixrank(Rank) - , selfremove(true) { list = true; syntax = "<nick>"; diff --git a/src/modules.cpp b/src/modules.cpp index 438d74a01..254cb2918 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -55,13 +55,6 @@ Version::Version(const std::string &desc, int flags, const std::string& linkdata } // These declarations define the behavours of the base class Module (which does nothing at all) - -Module::Module() - : ModuleDLLManager(NULL) - , dying(false) -{ -} - CullResult Module::cull() { return classbase::cull(); @@ -630,7 +623,8 @@ std::string ModuleManager::ExpandModName(const std::string& modname) } dynamic_reference_base::dynamic_reference_base(Module* Creator, const std::string& Name) - : name(Name), hook(NULL), value(NULL), creator(Creator) + : name(Name) + , creator(Creator) { if (!dynrefs) dynrefs = new insp::intrusive_list<dynamic_reference_base>; diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index 6dfd575e9..46b76ab5f 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -54,16 +54,14 @@ class LDAPRequest public: LDAPService* service; LDAPInterface* inter; - LDAPMessage* message; /* message returned by ldap_ */ - LDAPResult* result; /* final result */ + LDAPMessage* message = nullptr; /* message returned by ldap_ */ + LDAPResult* result = nullptr; /* final result */ struct timeval tv; QueryType type; LDAPRequest(LDAPService* s, LDAPInterface* i) : service(s) , inter(i) - , message(NULL) - , result(NULL) { type = QUERY_UNKNOWN; tv.tv_sec = 0; @@ -183,9 +181,9 @@ class LDAPCompare : public LDAPRequest class LDAPService : public LDAPProvider, public SocketThread { - LDAP* con; + LDAP* con = nullptr; reference<ConfigTag> config; - time_t last_connect; + time_t last_connect = 0; int searchscope; time_t timeout; @@ -275,7 +273,7 @@ class LDAPService : public LDAPProvider, public SocketThread LDAPService(Module* c, ConfigTag* tag) : LDAPProvider(c, "LDAP/" + tag->getString("id")) - , con(NULL), config(tag), last_connect(0) + , config(tag) { std::string scope = config->getString("searchscope"); if (stdalgo::string::equalsci(scope, "base")) diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 179a6790b..f4207dcb2 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -133,12 +133,11 @@ typedef std::deque<ResultQueueItem> ResultQueue; class ModuleSQL : public Module { public: - DispatcherThread* Dispatcher; + DispatcherThread* Dispatcher = nullptr; QueryQueue qq; // MUST HOLD MUTEX ResultQueue rq; // MUST HOLD MUTEX ConnMap connections; // main thread only - ModuleSQL(); void init() override; ~ModuleSQL(); void ReadConfig(ConfigStatus& status) override; @@ -163,15 +162,13 @@ class MySQLresult : public SQL::Result { public: SQL::Error err; - int currentrow; - int rows; + int currentrow = 0; + int rows = 0; std::vector<std::string> colnames; std::vector<SQL::Row> fieldlists; MySQLresult(MYSQL_RES* res, int affected_rows) : err(SQL::SUCCESS) - , currentrow(0) - , rows(0) { if (affected_rows >= 1) { @@ -216,8 +213,6 @@ class MySQLresult : public SQL::Result MySQLresult(SQL::Error& e) : err(e) - , currentrow(0) - , rows(0) { } @@ -301,14 +296,13 @@ class SQLConnection : public SQL::Provider public: reference<ConfigTag> config; - MYSQL *connection; + MYSQL* connection = nullptr; std::mutex lock; // This constructor creates an SQLConnection object with the given credentials, but does not connect yet. SQLConnection(Module* p, ConfigTag* tag) : SQL::Provider(p, tag->getString("id")) , config(tag) - , connection(NULL) { } @@ -439,11 +433,6 @@ class SQLConnection : public SQL::Provider } }; -ModuleSQL::ModuleSQL() - : Dispatcher(NULL) -{ -} - void ModuleSQL::init() { if (mysql_library_init(0, NULL, NULL)) diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 567c2b30f..8702ab8a4 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -92,8 +92,8 @@ struct QueueItem class PgSQLresult : public SQL::Result { PGresult* res; - int currentrow; - int rows; + int currentrow = 0; + int rows = 0; std::vector<std::string> colnames; void getColNames() @@ -105,7 +105,8 @@ class PgSQLresult : public SQL::Result } } public: - PgSQLresult(PGresult* result) : res(result), currentrow(0) + PgSQLresult(PGresult* result) + : res(result) { rows = PQntuples(res); if (!rows) @@ -177,15 +178,13 @@ class SQLConn : public SQL::Provider, public EventHandler public: reference<ConfigTag> conf; /* The <database> entry */ std::deque<QueueItem> queue; - PGconn* sql; /* PgSQL database connection handle */ - SQLstatus status; /* PgSQL database connection status */ + PGconn* sql = nullptr; /* PgSQL database connection handle */ + SQLstatus status = CWRITE; /* PgSQL database connection status */ QueueItem qinprog; /* If there is currently a query in progress */ SQLConn(Module* Creator, ConfigTag* tag) : SQL::Provider(Creator, tag->getString("id")) , conf(tag) - , sql(NULL) - , status(CWRITE) , qinprog(NULL, "") { if (!DoConnect()) @@ -536,12 +535,7 @@ class ModulePgSQL : public Module { public: ConnMap connections; - ReconnectTimer* retimer; - - ModulePgSQL() - : retimer(NULL) - { - } + ReconnectTimer* retimer = nullptr; ~ModulePgSQL() { diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index e60217dff..1b315df27 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -49,15 +49,11 @@ typedef insp::flat_map<std::string, SQLConn*> ConnMap; class SQLite3Result : public SQL::Result { public: - int currentrow; - int rows; + int currentrow = 0; + int rows = 0; std::vector<std::string> columns; std::vector<SQL::Row> fieldlists; - SQLite3Result() : currentrow(0), rows(0) - { - } - int Rows() override { return rows; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 1c193df6a..42192325c 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -611,10 +611,10 @@ namespace GnuTLS class GnuTLSIOHook : public SSLIOHook { private: - gnutls_session_t sess; - issl_status status; + gnutls_session_t sess = nullptr; + issl_status status = ISSL_NONE; #ifdef INSPIRCD_GNUTLS_HAS_CORK - size_t gbuffersize; + size_t gbuffersize = 0; #endif void CloseSession() @@ -909,11 +909,6 @@ info_done_dealloc: public: GnuTLSIOHook(IOHookProvider* hookprov, StreamSocket* sock, unsigned int flags) : SSLIOHook(hookprov) - , sess(NULL) - , status(ISSL_NONE) -#ifdef INSPIRCD_GNUTLS_HAS_CORK - , gbuffersize(0) -#endif { gnutls_init(&sess, flags); gnutls_transport_set_ptr(sess, reinterpret_cast<gnutls_transport_ptr_t>(sock)); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 5cbdb9dcf..b7916b857 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -480,7 +480,7 @@ class OpenSSLIOHook : public SSLIOHook private: SSL* sess; issl_status status; - bool data_to_write; + bool data_to_write = false; // Returns 1 if handshake succeeded, 0 if it is still in progress, -1 if it failed int Handshake(StreamSocket* user) @@ -647,7 +647,6 @@ class OpenSSLIOHook : public SSLIOHook : SSLIOHook(hookprov) , sess(session) , status(ISSL_NONE) - , data_to_write(false) { // Create BIO instance and store a pointer to the socket in it which will be used by the read and write functions BIO* bio = BIO_new(biomethods); diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index cef93c19b..664b36207 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -77,7 +77,7 @@ class ModuleAlias : public Module UserModeReference botmode; // Whether we are actively executing an alias. - bool active; + bool active = false; public: void ReadConfig(ConfigStatus& status) override @@ -116,7 +116,6 @@ class ModuleAlias : public Module ModuleAlias() : botmode(this, "bot") - , active(false) { } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index d43f92ee8..f0737351a 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -248,14 +248,13 @@ class BanRedirect : public ModeWatcher class ModuleBanRedirect : public Module { BanRedirect re; - bool nofollow; + bool nofollow = false; ChanModeReference limitmode; ChanModeReference redirectmode; public: ModuleBanRedirect() : re(this) - , nofollow(false) , limitmode(this, "limit") , redirectmode(this, "redirect") { diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp index d98a564fe..2bf09acfa 100644 --- a/src/modules/m_bcrypt.cpp +++ b/src/modules/m_bcrypt.cpp @@ -42,7 +42,7 @@ class BCryptProvider : public HashProvider } public: - unsigned int rounds; + unsigned int rounds = 10; std::string Generate(const std::string& data, const std::string& salt) { @@ -74,7 +74,6 @@ class BCryptProvider : public HashProvider BCryptProvider(Module* parent) : HashProvider(parent, "bcrypt", 60) - , rounds(10) { } }; diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 0d4a8b752..93867a38c 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -49,7 +49,7 @@ class callerid_data typedef insp::flat_set<User*> UserSet; typedef std::vector<callerid_data*> CallerIdDataSet; - time_t lastnotify; + time_t lastnotify = 0; /** Users I accept messages from */ @@ -59,8 +59,6 @@ class callerid_data */ CallerIdDataSet wholistsme; - callerid_data() : lastnotify(0) { } - std::string ToString(bool human) const { std::ostringstream oss; diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index a3add12a2..a5de222c0 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -50,13 +50,12 @@ bool NewIsChannelHandler::Call(const std::string& channame) class ModuleChannelNames : public Module { std::function<bool(const std::string&)> rememberer; - bool badchan; + bool badchan = false; ChanModeReference permchannelmode; public: ModuleChannelNames() : rememberer(ServerInstance->IsChannel) - , badchan(false) , permchannelmode(this, "permanent") { } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 0fa7e0983..406ab410b 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -85,18 +85,15 @@ typedef std::vector<std::string> CloakList; class CloakUser : public ModeHandler { public: - bool active; + bool active = false; SimpleExtItem<CloakList> ext; std::string debounce_uid; - time_t debounce_ts; - int debounce_count; + time_t debounce_ts = 0; + int debounce_count = 0; CloakUser(Module* source) : ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER) - , active(false) , ext(source, "cloaked_host", ExtensionItem::EXT_USER) - , debounce_ts(0) - , debounce_count(0) { } diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 7dfad4440..66b25cbb0 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -30,18 +30,13 @@ class ModuleConnFlood : public Module unsigned int seconds; unsigned int timeout; unsigned int boot_wait; - unsigned int conns; + unsigned int conns = 0; unsigned int maxconns; - bool throttled; + bool throttled = false; time_t first; std::string quitmsg; public: - ModuleConnFlood() - : conns(0), throttled(false) - { - } - Version GetVersion() override { return Version("Connection throttle", VF_VENDOR); diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 20f602005..84189947e 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -371,14 +371,13 @@ class ModuleDCCAllow : public Module { DCCAllowExt ext; CommandDccallow cmd; - bool blockchat; + bool blockchat = false; std::string defaultaction; public: ModuleDCCAllow() : ext(this) , cmd(this, ext) - , blockchat(false) { } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index dfd8b6b42..dfce068e8 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -191,7 +191,7 @@ class ModuleFilter { typedef insp::flat_set<std::string, irc::insensitive_swo> ExemptTargetSet; - bool initing; + bool initing = true; bool notifyuser; bool warnonselfmsg; RegexFactory* factory; @@ -348,7 +348,6 @@ bool ModuleFilter::AppliesToMe(User* user, FilterResult* filter, int iflags) ModuleFilter::ModuleFilter() : ServerProtocol::SyncEventListener(this) , Stats::EventListener(this) - , initing(true) , filtcommand(this) , RegexEngine(this, "regex") { diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index bad967a1c..67c9c39d7 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -36,10 +36,10 @@ class HideOper : public SimpleUserModeHandler { public: - size_t opercount; + size_t opercount = 0; - HideOper(Module* Creator) : SimpleUserModeHandler(Creator, "hideoper", 'H') - , opercount(0) + HideOper(Module* Creator) + : SimpleUserModeHandler(Creator, "hideoper", 'H') { oper = true; } @@ -66,7 +66,7 @@ class ModuleHideOper { private: HideOper hm; - bool active; + bool active = false; public: ModuleHideOper() @@ -74,7 +74,6 @@ class ModuleHideOper , Who::EventListener(this) , Whois::LineEventListener(this) , hm(this) - , active(false) { } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index b0f4ecf0b..e649cfaca 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -70,12 +70,12 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru HTTPHeaders headers; std::string body; size_t total_buffers; - int status_code; + int status_code = 0; /** True if this object is in the cull list */ - bool waitingcull; - bool messagecomplete; + bool waitingcull = false; + bool messagecomplete = false; bool Tick(time_t currtime) override { @@ -205,9 +205,6 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru : BufferedSocket(newfd) , Timer(timeoutsec) , ip(IP) - , status_code(0) - , waitingcull(false) - , messagecomplete(false) { if ((!via->iohookprovs.empty()) && (via->iohookprovs.back())) { diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index eb6544914..93dcfdfe3 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -408,14 +408,13 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener private: HTTPdAPI API; ISupport::EventProvider isupportevprov; - bool enableparams; + bool enableparams = false; public: ModuleHttpStats() : HTTPRequestEventListener(this) , API(this) , isupportevprov(this) - , enableparams(false) { isevprov = &isupportevprov; } diff --git a/src/modules/m_ircv3_batch.cpp b/src/modules/m_ircv3_batch.cpp index 638118b2d..f6a18ad27 100644 --- a/src/modules/m_ircv3_batch.cpp +++ b/src/modules/m_ircv3_batch.cpp @@ -65,7 +65,7 @@ class IRCv3::Batch::ManagerImpl : public Manager ClientProtocol::EventProvider protoevprov; IntExtItem batchbits; BatchList active_batches; - bool unloading; + bool unloading = false; bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) override { @@ -101,7 +101,6 @@ class IRCv3::Batch::ManagerImpl : public Manager , cap(mod, "batch") , protoevprov(mod, "BATCH") , batchbits(mod, "batchbits", ExtensionItem::EXT_USER) - , unloading(false) { } diff --git a/src/modules/m_ircv3_labeledresponse.cpp b/src/modules/m_ircv3_labeledresponse.cpp index 4f2117209..a56376ed2 100644 --- a/src/modules/m_ircv3_labeledresponse.cpp +++ b/src/modules/m_ircv3_labeledresponse.cpp @@ -27,14 +27,13 @@ class LabeledResponseTag : public ClientProtocol::MessageTagProvider const Cap::Capability& cap; public: - LocalUser* labeluser; + LocalUser* labeluser = nullptr; std::string label; const std::string labeltag; LabeledResponseTag(Module* mod, const Cap::Capability& capref) : ClientProtocol::MessageTagProvider(mod) , cap(capref) - , labeluser(NULL) , labeltag("label") { } @@ -76,7 +75,7 @@ class ModuleIRCv3LabeledResponse : public Module ClientProtocol::EventProvider ackmsgprov; ClientProtocol::EventProvider labelmsgprov; insp::aligned_storage<ClientProtocol::Message> firstmsg; - size_t msgcount; + size_t msgcount = 0; void FlushFirstMsg(LocalUser* user) { @@ -95,8 +94,6 @@ class ModuleIRCv3LabeledResponse : public Module , batchcap(this) , ackmsgprov(this, "ACK") , labelmsgprov(this, "labeled") - , msgcount(0) - { } diff --git a/src/modules/m_ircv3_msgid.cpp b/src/modules/m_ircv3_msgid.cpp index 7d1c99899..f30000912 100644 --- a/src/modules/m_ircv3_msgid.cpp +++ b/src/modules/m_ircv3_msgid.cpp @@ -50,14 +50,13 @@ class MsgIdTag : public ClientProtocol::MessageTagProvider class MsgIdGenerator { - uint64_t counter; + uint64_t counter = 0; std::string strid; const std::string::size_type baselen; public: MsgIdGenerator() - : counter(0) - , strid(InspIRCd::Format("%s~%lu~", ServerInstance->Config->GetSID().c_str(), ServerInstance->startup_time)) + : strid(InspIRCd::Format("%s~%lu~", ServerInstance->Config->GetSID().c_str(), ServerInstance->startup_time)) , baselen(strid.length()) { } diff --git a/src/modules/m_ircv3_servertime.cpp b/src/modules/m_ircv3_servertime.cpp index decd66414..210e97ee9 100644 --- a/src/modules/m_ircv3_servertime.cpp +++ b/src/modules/m_ircv3_servertime.cpp @@ -28,8 +28,8 @@ class ServerTimeTag , public IRCv3::CapTag<ServerTimeTag> , public ServerProtocol::MessageEventListener { - time_t lasttime; - long lasttimens; + time_t lasttime = 0; + long lasttimens = 0; std::string lasttimestring; void RefreshTimeString() @@ -53,8 +53,6 @@ class ServerTimeTag : IRCv3::ServerTime::Manager(mod) , IRCv3::CapTag<ServerTimeTag>(mod, "server-time", "time") , ServerProtocol::MessageEventListener(mod) - , lasttime(0) - , lasttimens(0) { tagprov = this; } diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 1c4550443..ffc0c5147 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -42,11 +42,12 @@ class joinfloodsettings unsigned int secs; unsigned int joins; time_t reset; - time_t unlocktime; - unsigned int counter; + time_t unlocktime = 0; + unsigned int counter = 0; joinfloodsettings(unsigned int b, unsigned int c) - : secs(b), joins(c), unlocktime(0), counter(0) + : secs(b) + , joins(c) { reset = ServerInstance->Time() + secs; } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index bf5abecc1..bc9d7b033 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -93,11 +93,10 @@ class KickRejoinData */ class KickRejoin : public ParamMode<KickRejoin, SimpleExtItem<KickRejoinData> > { - const unsigned int max; + const unsigned int max = 60; public: KickRejoin(Module* Creator) : ParamMode<KickRejoin, SimpleExtItem<KickRejoinData> >(Creator, "kicknorejoin", 'J') - , max(60) { syntax = "<seconds>"; } diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index 6275dc140..089f428b7 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -40,9 +40,9 @@ class BindInterface : public LDAPInterface const std::string provider; const std::string uid; std::string DN; - bool checkingAttributes; - bool passed; - int attrCount; + bool checkingAttributes = false; + bool passed = false; + int attrCount = 0; static std::string SafeReplace(const std::string& text, std::map<std::string, std::string>& replacements) { @@ -100,7 +100,9 @@ class BindInterface : public LDAPInterface public: BindInterface(Module* c, const std::string& p, const std::string& u, const std::string& dn) : LDAPInterface(c) - , provider(p), uid(u), DN(dn), checkingAttributes(false), passed(false), attrCount(0) + , provider(p) + , uid(u) + , DN(dn) { } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 32e26c1cf..5a2406500 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -36,11 +36,12 @@ class nickfloodsettings unsigned int secs; unsigned int nicks; time_t reset; - time_t unlocktime; - unsigned int counter; + time_t unlocktime = 0; + unsigned int counter = 0; nickfloodsettings(unsigned int b, unsigned int c) - : secs(b), nicks(c), unlocktime(0), counter(0) + : secs(b) + , nicks(c) { reset = ServerInstance->Time() + secs; } diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 1b572a574..252694952 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -169,16 +169,14 @@ class ModulePermanentChannels { PermChannel p; - bool dirty; - bool loaded; + bool dirty = false; + bool loaded = false; bool save_listmodes; public: ModulePermanentChannels() : Timer(0, true) , p(this) - , dirty(false) - , loaded(false) { } diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index c4359bcbd..de3a8b3f3 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -79,18 +79,16 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> > struct MemberInfo { RepeatItemList ItemList; - unsigned int Counter; - MemberInfo() : Counter(0) {} + unsigned int Counter = 0; }; struct ModuleSettings { - unsigned int MaxLines; - unsigned int MaxSecs; - unsigned int MaxBacklog; - unsigned int MaxDiff; - unsigned int MaxMessageSize; - ModuleSettings() : MaxLines(0), MaxSecs(0), MaxBacklog(0), MaxDiff() { } + unsigned int MaxLines = 0; + unsigned int MaxSecs = 0; + unsigned int MaxBacklog = 0; + unsigned int MaxDiff = 0; + unsigned int MaxMessageSize = 0; }; std::vector<unsigned int> mx[2]; diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index ded33cdf4..ba88afa68 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -31,7 +31,7 @@ typedef insp::flat_set<std::string, irc::insensitive_swo> AllowChans; class ModuleRestrictChans : public Module { AllowChans allowchans; - bool allowregistered; + bool allowregistered = false; bool CanCreateChannel(LocalUser* user, const std::string& name) { @@ -52,11 +52,6 @@ class ModuleRestrictChans : public Module } public: - ModuleRestrictChans() - : allowregistered(false) - { - } - void ReadConfig(ConfigStatus& status) override { AllowChans newallows; diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index e595b50e3..45f3aafbf 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -226,7 +226,7 @@ class ModuleRLine : public Module, public Stats::EventListener RLineFactory f; CommandRLine r; bool MatchOnNickChange; - bool initing; + bool initing = true; RegexFactory* factory; public: @@ -235,7 +235,6 @@ class ModuleRLine : public Module, public Stats::EventListener , rxfactory(this, "regex") , f(rxfactory) , r(this, f) - , initing(true) { } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 3fbffd07e..df67a0037 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -174,9 +174,9 @@ class SaslAuthenticator private: std::string agent; LocalUser* user; - SaslState state; + SaslState state = SASL_INIT; SaslResult result; - bool state_announced; + bool state_announced = false; void SendHostIP(UserCertificateAPI& sslapi) { @@ -191,8 +191,6 @@ class SaslAuthenticator public: SaslAuthenticator(LocalUser* user_, const std::string& method, UserCertificateAPI& sslapi) : user(user_) - , state(SASL_INIT) - , state_announced(false) { SendHostIP(sslapi); diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 55b95f60b..d362e162a 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -157,7 +157,7 @@ class ModuleServicesAccount Channel_r chanregmode; User_r userregmode; AccountExtItemImpl accountname; - bool checking_ban; + bool checking_ban = false; public: ModuleServicesAccount() @@ -172,7 +172,6 @@ class ModuleServicesAccount , chanregmode(this) , userregmode(this) , accountname(this) - , checking_ban(false) { } diff --git a/src/modules/m_spanningtree/commandbuilder.h b/src/modules/m_spanningtree/commandbuilder.h index 527b53584..927213d74 100644 --- a/src/modules/m_spanningtree/commandbuilder.h +++ b/src/modules/m_spanningtree/commandbuilder.h @@ -35,7 +35,7 @@ class CmdBuilder ClientProtocol::TagMap tags; /** The size of tags within the contents. */ - size_t tagsize; + size_t tagsize = 0; /** Fires the ServerProtocol::MessageEventListener::OnBuildMessage event for a server target. */ void FireEvent(Server* target, const char* cmd, ClientProtocol::TagMap& taglist); @@ -49,7 +49,6 @@ class CmdBuilder public: CmdBuilder(const char* cmd) : content(1, ':') - , tagsize(0) { content.append(ServerInstance->Config->GetSID()); push(cmd); @@ -58,7 +57,6 @@ class CmdBuilder CmdBuilder(TreeServer* src, const char* cmd) : content(1, ':') - , tagsize(0) { content.append(src->GetId()); push(cmd); @@ -67,7 +65,6 @@ class CmdBuilder CmdBuilder(User* src, const char* cmd) : content(1, ':') - , tagsize(0) { content.append(src->uuid); push(cmd); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index cdfcdd3b7..e595c680f 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -47,7 +47,6 @@ ModuleSpanningTree::ModuleSpanningTree() , rsquit(this) , map(this) , commands(this) - , currmembid(0) , broadcasteventprov(this, "event/server-broadcast") , linkeventprov(this, "event/server-link") , messageeventprov(this, "event/server-message") @@ -56,7 +55,6 @@ ModuleSpanningTree::ModuleSpanningTree() , servicetag(this) , DNS(this, "DNS") , tagevprov(this) - , loopCall(false) { } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 839c859af..40f2724f5 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -94,7 +94,7 @@ class ModuleSpanningTree /** Next membership id assigned when a local user joins a channel */ - Membership::Id currmembid; + Membership::Id currmembid = 0; /** The specialized ProtocolInterface that is assigned to ServerInstance->PI on load */ @@ -129,7 +129,7 @@ class ModuleSpanningTree /** Set to true if inside a spanningtree call, to prevent sending * xlines and other things back to their source */ - bool loopCall; + bool loopCall = false; /** Constructor */ diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 7d7755a6b..8bde08a39 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -39,12 +39,12 @@ class FModeBuilder : public CmdBuilder { static const size_t maxline = 480; std::string params; - unsigned int modes; + unsigned int modes = 0; std::string::size_type startpos; public: FModeBuilder(Channel* chan) - : CmdBuilder("FMODE"), modes(0) + : CmdBuilder("FMODE") { push(chan->name).push_int(chan->age).push_raw(" +"); startpos = str().size(); diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index e40f22e91..48bedb839 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -43,14 +43,10 @@ TreeServer::TreeServer() , rawversion(INSPIRCD_VERSION) , Socket(NULL) , behind_bursting(0) - , isdead(false) , pingtimer(this) , ServerUser(ServerInstance->FakeClient) , age(ServerInstance->Time()) , UserCount(ServerInstance->Users.LocalUserCount()) - , OperCount(0) - , rtt(0) - , StartBurst(0) , Hidden(false) { AddHashEntry(); @@ -65,14 +61,10 @@ TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const s , Parent(Above) , Socket(Sock) , behind_bursting(Parent->behind_bursting) - , isdead(false) , pingtimer(this) , ServerUser(new FakeUser(id, this)) , age(ServerInstance->Time()) , UserCount(0) - , OperCount(0) - , rtt(0) - , StartBurst(0) , Hidden(Hide) { ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "New server %s behind_bursting %u", GetName().c_str(), behind_bursting); diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index e6471d77e..1e7c30a1a 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -66,7 +66,7 @@ class TreeServer : public Server /** True if this server has been lost in a split and is awaiting destruction */ - bool isdead; + bool isdead = false; /** Timer handling PINGing the server and killing it on timeout */ @@ -91,7 +91,7 @@ class TreeServer : public Server const time_t age; unsigned int UserCount; /* How many users are on this server? [note: doesn't care about +i] */ - unsigned int OperCount; /* How many opers are on this server? */ + unsigned int OperCount = 0; /* How many opers are on this server? */ /** We use this constructor only to create the 'root' item, Utils->TreeRoot, which * represents our own server. Therefore, it has no route, no parent, and @@ -157,11 +157,11 @@ class TreeServer : public Server /** Round trip time of last ping */ - unsigned long rtt; + unsigned long rtt = 0; /** When we received BURST from this server, used to calculate total burst time at ENDBURST. */ - uint64_t StartBurst; + uint64_t StartBurst = 0; /** True if this server is hidden */ diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 8f59fb3ba..36cde5715 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -99,14 +99,18 @@ class TreeSocket : public BufferedSocket std::string linkID; /* Description for this link */ ServerState LinkState; /* Link state */ CapabData* capab; /* Link setup data (held until burst is sent) */ - TreeServer* MyRoot; /* The server we are talking to */ - unsigned int proto_version; /* Remote protocol version */ + + /* The server we are talking to */ + TreeServer* MyRoot = NULL; + + /* Remote protocol version */ + unsigned int proto_version = 0; /** True if we've sent our burst. * This only changes the behavior of message translation for 1202 protocol servers and it can be * removed once 1202 support is dropped. */ - bool burstsent; + bool burstsent = false; /** Checks if the given servername and sid are both free */ diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 6119b1d38..9e4dd5ddd 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -40,8 +40,9 @@ * and only do minor initialization tasks ourselves. */ TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const irc::sockets::sockaddrs& dest) - : linkID(link->Name), LinkState(CONNECTING), MyRoot(NULL), proto_version(0) - , burstsent(false), age(ServerInstance->Time()) + : linkID(link->Name) + , LinkState(CONNECTING) + , age(ServerInstance->Time()) { capab = new CapabData; capab->link = link; @@ -77,8 +78,9 @@ TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const irc::sockets::sockad */ TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) : BufferedSocket(newfd) - , linkID("inbound from " + client->addr()), LinkState(WAIT_AUTH_1), MyRoot(NULL), proto_version(0) - , burstsent(false), age(ServerInstance->Time()) + , linkID("inbound from " + client->addr()) + , LinkState(WAIT_AUTH_1) + , age(ServerInstance->Time()) { capab = new CapabData; capab->capab_phase = 0; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 33f605912..0f839efe7 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -107,8 +107,7 @@ TreeServer* SpanningTreeUtilities::FindRouteTarget(const std::string& target) } SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) - : Creator(C), TreeRoot(NULL) - , PingFreq(60) // XXX: TreeServer constructor reads this and TreeRoot is created before the config is read, so init it to something (value doesn't matter) to avoid a valgrind warning in TimerManager on unload + : Creator(C) { ServerInstance->Timers.AddTimer(&RefreshTimer); } diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index eb9d76652..01c474f8e 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -86,7 +86,7 @@ class SpanningTreeUtilities : public classbase unsigned int PingWarnTime; /** This variable represents the root of the server tree */ - TreeServer *TreeRoot; + TreeServer *TreeRoot = nullptr; /** IPs allowed to link to us */ std::vector<std::string> ValidIPs; @@ -107,8 +107,12 @@ class SpanningTreeUtilities : public classbase std::vector<reference<Autoconnect> > AutoconnectBlocks; /** Ping frequency of server to server links + * XXX: TreeServer constructor reads this and TreeRoot is created before the + * config is read, so init it to something (value doesn't matter) to avoid a + * valgrind warning in TimerManager on unload */ - unsigned int PingFreq; + unsigned int PingFreq = 60; + /** Initialise utility class */ diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index 9ff52b600..9d7ace7d8 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -164,7 +164,7 @@ class OperQuery : public SQL::Query class ModuleSQLOper : public Module { // Whether OperQuery is running - bool active; + bool active = false; std::string query; // Stores oper blocks from DB std::vector<std::string> my_blocks; @@ -172,8 +172,7 @@ class ModuleSQLOper : public Module public: ModuleSQLOper() - : active(false) - , SQL(this, "SQL") + : SQL(this, "SQL") { } diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp index 0c240b022..817a5861d 100644 --- a/src/modules/m_websocket.cpp +++ b/src/modules/m_websocket.cpp @@ -121,8 +121,8 @@ class WebSocketHook : public IOHookMiddle // Clients sending ping or pong frames faster than this are killed static const time_t MINPINGPONGDELAY = 10; - State state; - time_t lastpingpong; + State state = STATE_HTTPREQ; + time_t lastpingpong = 0; WebSocketConfig& config; static size_t FillHeader(unsigned char* outbuf, size_t sendlength, OpCode opcode) @@ -408,8 +408,6 @@ class WebSocketHook : public IOHookMiddle public: WebSocketHook(IOHookProvider* Prov, StreamSocket* sock, WebSocketConfig& cfg) : IOHookMiddle(Prov) - , state(STATE_HTTPREQ) - , lastpingpong(0) , config(cfg) { sock->AddIOHook(this); diff --git a/src/snomasks.cpp b/src/snomasks.cpp index 17696d072..aa4dc3015 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -86,11 +86,6 @@ bool SnomaskManager::IsSnomaskUsable(char ch) const return ((isalpha(ch)) && (!masks[tolower(ch) - 'a'].Description.empty())); } -Snomask::Snomask() - : Count(0) -{ -} - void Snomask::SendMessage(const std::string& message, char letter) { if ((!ServerInstance->Config->NoSnoticeStack) && (message == LastMessage) && (letter == LastLetter)) diff --git a/src/users.cpp b/src/users.cpp index 151ad2ee8..05310f202 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -79,7 +79,6 @@ std::string User::GetModeLetters(bool includeparams) const User::User(const std::string& uid, Server* srv, UserType type) : age(ServerInstance->Time()) - , signon(0) , uuid(uid) , server(srv) , registered(REG_NONE) @@ -104,18 +103,9 @@ User::User(const std::string& uid, Server* srv, UserType type) LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* servaddr) : User(ServerInstance->UIDGen.GetUID(), ServerInstance->FakeClient->server, USERTYPE_LOCAL) , eh(this) - , serializer(NULL) - , bytes_in(0) - , bytes_out(0) - , cmds_in(0) - , cmds_out(0) , quitting_sendq(false) , lastping(true) , exempt(false) - , nextping(0) - , idle_lastmsg(0) - , CommandFloodPenalty(0) - , already_sent(0) { signon = ServerInstance->Time(); // The user's default nick is their UUID @@ -130,7 +120,6 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so LocalUser::LocalUser(int myfd, const std::string& uid, Serializable::Data& data) : User(uid, ServerInstance->FakeClient->server, USERTYPE_LOCAL) , eh(this) - , already_sent(0) { eh.SetFd(myfd); Deserialize(data); @@ -1217,22 +1206,8 @@ const std::string& FakeUser::GetFullRealHost() ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask) : config(tag) , type(t) - , fakelag(true) , name("unnamed") - , registration_timeout(0) , host(mask) - , pingtime(0) - , softsendqmax(0) - , hardsendqmax(0) - , recvqmax(0) - , penaltythreshold(0) - , commandrate(0) - , maxlocal(0) - , maxglobal(0) - , maxconnwarn(true) - , maxchans(20) - , limit(0) - , resolvehostnames(true) { } |
