diff --git a/include/znc/Utils.h b/include/znc/Utils.h index 91f29d79f6..2406653cc9 100644 --- a/include/znc/Utils.h +++ b/include/znc/Utils.h @@ -312,7 +312,7 @@ class TCacheMap { * @return true if item existed and was removed, false if it never existed */ bool RemItem(const K& Item) { - return m_mItems.erase(Item); + return (m_mItems.erase(Item) != 0); } /** diff --git a/include/znc/ZNCString.h b/include/znc/ZNCString.h index 88ef0d5da1..569f07e426 100644 --- a/include/znc/ZNCString.h +++ b/include/znc/ZNCString.h @@ -102,7 +102,7 @@ class CString : public std::string { * @return An integer less than, equal to, or greater than zero if this * string smaller, equal.... to the given string. */ - int CaseCmp(const CString& s, unsigned long uLen = CString::npos) const; + int CaseCmp(const CString& s, CString::size_type uLen = CString::npos) const; /** * Compare this string case sensitively to some other string. * @param s The string to compare to. @@ -110,7 +110,7 @@ class CString : public std::string { * @return An integer less than, equal to, or greater than zero if this * string smaller, equal.... to the given string. */ - int StrCmp(const CString& s, unsigned long uLen = CString::npos) const; + int StrCmp(const CString& s, CString::size_type uLen = CString::npos) const; /** * Check if this string is equal to some other string. * @param s The string to compare to. @@ -119,7 +119,7 @@ class CString : public std::string { * @param uLen Number of characters to consider. * @return True if the strings are equal. */ - bool Equals(const CString& s, bool bCaseSensitive = false, unsigned long uLen = CString::npos) const; + bool Equals(const CString& s, bool bCaseSensitive = false, CString::size_type uLen = CString::npos) const; /** * Do a wildcard comparision between two strings. * For example, the following returns true: diff --git a/include/znc/znc.h b/include/znc/znc.h index 9ba506213b..e6247ebfe9 100644 --- a/include/znc/znc.h +++ b/include/znc/znc.h @@ -160,7 +160,7 @@ class CZNC { // !MOTD void AddServerThrottle(CString sName) { m_sConnectThrottle.AddItem(sName); } - bool GetServerThrottle(CString sName) { return m_sConnectThrottle.GetItem(sName); } + bool GetServerThrottle(CString sName) { bool *b = m_sConnectThrottle.GetItem(sName); return (b && *b); } void AddNetworkToQueue(CIRCNetwork *pNetwork); std::list& GetConnectionQueue() { return m_lpConnectQueue; } diff --git a/modules/autoop.cpp b/modules/autoop.cpp index dba91d3c36..260e935842 100644 --- a/modules/autoop.cpp +++ b/modules/autoop.cpp @@ -321,19 +321,21 @@ class CAutoOpMod : public CModule { bool CheckAutoOp(const CNick& Nick, CChan& Channel) { CAutoOpUser *pUser = FindUserByHost(Nick.GetHostMask(), Channel.GetName()); - if (pUser) { - if (pUser->GetUserKey().Equals("__NOKEY__")) { - PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick()); - } else { - // then insert this nick into the queue, the timer does the rest - CString sNick = Nick.GetNick().AsLower(); - if (m_msQueue.find(sNick) == m_msQueue.end()) { - m_msQueue[sNick] = ""; - } + if (!pUser) { + return false; + } + + if (pUser->GetUserKey().Equals("__NOKEY__")) { + PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick()); + } else { + // then insert this nick into the queue, the timer does the rest + CString sNick = Nick.GetNick().AsLower(); + if (m_msQueue.find(sNick) == m_msQueue.end()) { + m_msQueue[sNick] = ""; } } - return pUser; + return true; } void DelUser(const CString& sUser) { diff --git a/modules/sasl.cpp b/modules/sasl.cpp index bb325ae9ce..452726ff44 100644 --- a/modules/sasl.cpp +++ b/modules/sasl.cpp @@ -478,7 +478,7 @@ class CSASLMod : public CModule { return sCap.Equals("sasl"); } - virtual void OnServerCapResult(const CString& sCap, const bool bSuccess) { + virtual void OnServerCapResult(const CString& sCap, bool bSuccess) { if (sCap.Equals("sasl")) { if (bSuccess) { GetMechanismsString().Split(" ", m_Mechanisms); diff --git a/src/ZNCString.cpp b/src/ZNCString.cpp index 506a3a244a..d0140ab546 100644 --- a/src/ZNCString.cpp +++ b/src/ZNCString.cpp @@ -65,21 +65,21 @@ unsigned char* CString::strnchr(const unsigned char* src, unsigned char c, unsig return NULL; } -int CString::CaseCmp(const CString& s, unsigned long uLen) const { +int CString::CaseCmp(const CString& s, CString::size_type uLen) const { if (uLen != CString::npos) { return strncasecmp(c_str(), s.c_str(), uLen); } return strcasecmp(c_str(), s.c_str()); } -int CString::StrCmp(const CString& s, unsigned long uLen) const { +int CString::StrCmp(const CString& s, CString::size_type uLen) const { if (uLen != CString::npos) { return strncmp(c_str(), s.c_str(), uLen); } return strcmp(c_str(), s.c_str()); } -bool CString::Equals(const CString& s, bool bCaseSensitive, unsigned long uLen) const { +bool CString::Equals(const CString& s, bool bCaseSensitive, CString::size_type uLen) const { if (bCaseSensitive) { return (StrCmp(s, uLen) == 0); } else {