]> jfr.im git - irc/evilnet/znc.git/commitdiff
Fix some unitialized fields in modules.
authorAlexey Sokolov <redacted>
Fri, 30 Oct 2015 14:52:51 +0000 (14:52 +0000)
committerAlexey Sokolov <redacted>
Fri, 30 Oct 2015 14:52:51 +0000 (14:52 +0000)
They are not used before OnLoad anyway, but Coverity will be happier.

modules/adminlog.cpp
modules/clientnotify.cpp
modules/ctcpflood.cpp
modules/cyrusauth.cpp
modules/fail2ban.cpp
modules/keepnick.cpp
modules/kickrejoin.cpp
modules/notes.cpp
modules/q.cpp
modules/sasl.cpp

index f73c4834269e199459dc91d1a11c665a97237c25..d5af21a25fc475c4bd2f2da48bbc66056df6d1a5 100644 (file)
@@ -174,7 +174,7 @@ private:
                LOG_TO_SYSLOG = 1 << 1,
                LOG_TO_BOTH   = LOG_TO_FILE | LOG_TO_SYSLOG
        };
-       LogMode m_eLogMode;
+       LogMode m_eLogMode = LOG_TO_FILE;
        CString m_sLogFile;
 };
 
index 40d96d3485682aa186723caedee313509a5f52f9..ca55efd37c86fbae28b639af4ee6b42c9ebbc10a 100644 (file)
@@ -22,8 +22,8 @@ using std::set;
 class CClientNotifyMod : public CModule {
 protected:
        CString m_sMethod;
-       bool m_bNewOnly;
-       bool m_bOnDisconnect;
+       bool m_bNewOnly{};
+       bool m_bOnDisconnect{};
 
        set<CString> m_sClientsSeen;
 
index 45e3d1426668820426bd840e7dcddcd2cca45290..c727e97684e86e4753f285093767fe045d20c0d9 100644 (file)
@@ -20,9 +20,6 @@
 class CCtcpFloodMod : public CModule {
 public:
        MODCONSTRUCTOR(CCtcpFloodMod) {
-               m_tLastCTCP = 0;
-               m_iNumCTCP = 0;
-
                AddHelpCommand();
                AddCommand("Secs", static_cast<CModCommand::ModCmdFunc>(&CCtcpFloodMod::OnSecsCommand), "<limit>", "Set seconds limit");
                AddCommand("Lines", static_cast<CModCommand::ModCmdFunc>(&CCtcpFloodMod::OnLinesCommand), "<limit>", "Set lines limit");
@@ -130,11 +127,11 @@ public:
        }
 
 private:
-       time_t m_tLastCTCP;
-       unsigned int m_iNumCTCP;
+       time_t m_tLastCTCP = 0;
+       unsigned int m_iNumCTCP = 0;
 
-       time_t m_iThresholdSecs;
-       unsigned int m_iThresholdMsgs;
+       time_t m_iThresholdSecs{};
+       unsigned int m_iThresholdMsgs{};
 };
 
 template<> void TModInfo<CCtcpFloodMod>(CModInfo& Info) {
index 6d4e61a1643537273d280bf6c952dc07dff67783..cba01a0b8984cd8c5b2b9c8dcbd86b55f8ae673a 100644 (file)
@@ -31,6 +31,13 @@ public:
        MODCONSTRUCTOR(CSASLAuthMod) {
                m_Cache.SetTTL(60000/*ms*/);
 
+               m_cbs[0].id = SASL_CB_GETOPT;
+               m_cbs[0].proc = reinterpret_cast<int(*)()>(CSASLAuthMod::getopt);
+               m_cbs[0].context = this;
+               m_cbs[1].id = SASL_CB_LIST_END;
+               m_cbs[1].proc = NULL;
+               m_cbs[1].context = NULL;
+
                AddHelpCommand();
                AddCommand("CreateUser",       static_cast<CModCommand::ModCmdFunc>(&CSASLAuthMod::CreateUserCommand),
                        "[yes|no]");
@@ -77,13 +84,6 @@ public:
                        return false;
                }
 
-               m_cbs[0].id = SASL_CB_GETOPT;
-               m_cbs[0].proc = reinterpret_cast<int(*)()>(CSASLAuthMod::getopt);
-               m_cbs[0].context = this;
-               m_cbs[1].id = SASL_CB_LIST_END;
-               m_cbs[1].proc = NULL;
-               m_cbs[1].context = NULL;
-
                return true;
        }
 
index beb4f9ffa536503c9efd35967c07bec5ae8d4427..2fbe862f8148ea5531b7fb3b13fb46e8ca42d5ef 100644 (file)
@@ -100,7 +100,7 @@ public:
 
 private:
        TCacheMap<CString, unsigned int> m_Cache;
-       unsigned int                     m_uiAllowedFailed;
+       unsigned int                     m_uiAllowedFailed{};
 };
 
 template<> void TModInfo<CFailToBanMod>(CModInfo& Info) {
index 0c03ead8d087834f874ca56c2eeb4d82236b6205..207f4f7f5c13ec275bc17dc6af5362d22e568f70 100644 (file)
@@ -192,7 +192,7 @@ public:
 
 private:
        // If this is NULL, we are turned off for some reason
-       CKeepNickTimer* m_pTimer;
+       CKeepNickTimer* m_pTimer = nullptr;
 };
 
 CKeepNickTimer::CKeepNickTimer(CKeepNickMod *pMod) : CTimer(pMod, 30, 0,
index b43d5720b33d42d7788ae66c874fd321ebff2cb8..a009bf5f8b0bc84dae012c91f876b2c8353e1df8 100644 (file)
@@ -47,7 +47,7 @@ protected:
 
 class CRejoinMod : public CModule {
 private:
-       unsigned int delay;
+       unsigned int delay = 10;
 
 public:
        MODCONSTRUCTOR(CRejoinMod) {
index b4a720c1583cdf61f56ae570b0cdf307778ebc05..f8e2dbf9ce3168bc3ab6a13992d61c826880d79b 100644 (file)
@@ -19,7 +19,7 @@
 using std::stringstream;
 
 class CNotesMod : public CModule {
-       bool bShowNotesOnLogin;
+       bool m_bShowNotesOnLogin{};
 
        void ListCommand(const CString &sLine) {
                ListNotes();
@@ -85,14 +85,14 @@ public:
        virtual ~CNotesMod() {}
 
        virtual bool OnLoad(const CString& sArgs, CString& sMessage) override {
-               bShowNotesOnLogin = !sArgs.Equals("-disableNotesOnLogin");
+               m_bShowNotesOnLogin = !sArgs.Equals("-disableNotesOnLogin");
                return true;
        }
 
        virtual CString GetWebMenuTitle() override { return "Notes"; }
 
        virtual void OnClientLogin() override {
-               if (bShowNotesOnLogin) {
+               if (m_bShowNotesOnLogin) {
                        ListNotes(true);
                }
        }
index a64e756b161ff3632d5dd0b557c3efdd389725c6..263e488d8ef777f49b3d9aec046c83598aa7b103 100644 (file)
@@ -372,11 +372,11 @@ public:
        }
 
 private:
-       bool m_bCloaked;
-       bool m_bAuthed;
-       bool m_bRequestedWhoami;
-       bool m_bRequestedChallenge;
-       bool m_bCatchResponse;
+       bool m_bCloaked{};
+       bool m_bAuthed{};
+       bool m_bRequestedWhoami{};
+       bool m_bRequestedChallenge{};
+       bool m_bCatchResponse{};
        MCString m_msChanModes;
 
        void PutQ(const CString& sMessage) {
@@ -590,11 +590,11 @@ private:
 /* Settings */
        CString m_sUsername;
        CString m_sPassword;
-       bool    m_bUseCloakedHost;
-       bool    m_bUseChallenge;
-       bool    m_bRequestPerms;
-       bool    m_bJoinOnInvite;
-       bool    m_bJoinAfterCloaked;
+       bool    m_bUseCloakedHost{};
+       bool    m_bUseChallenge{};
+       bool    m_bRequestPerms{};
+       bool    m_bJoinOnInvite{};
+       bool    m_bJoinAfterCloaked{};
 
        void SetUsername(const CString& sUsername) {
                m_sUsername = sUsername;
index b068a42f3e721eaf035875705a6abb2ec697f157..4f2fc3def3c608114af70dfb6c6fed7d54e67a0a 100644 (file)
@@ -61,7 +61,7 @@ public:
        }
 
 private:
-       unsigned int m_uiIndex;
+       unsigned int m_uiIndex = 0;
 };
 
 class CSASLMod : public CModule {