Permalink
Browse files

squash some compiler warnings

(cherry picked from commit b3021f9)
  • Loading branch information...
1 parent 4f40500 commit e69032af177958fb2520af0219a9abc4e11b4e04 @KiNgMaR KiNgMaR committed with DarthGandalf Feb 6, 2014
Showing with 21 additions and 19 deletions.
  1. +1 −1 include/znc/Utils.h
  2. +3 −3 include/znc/ZNCString.h
  3. +1 −1 include/znc/znc.h
  4. +12 −10 modules/autoop.cpp
  5. +1 −1 modules/sasl.cpp
  6. +3 −3 src/ZNCString.cpp
View
@@ -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);
}
/**
@@ -102,15 +102,15 @@ 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.
* @param uLen The number of characters to compare.
* @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:
View
@@ -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<CIRCNetwork*>& GetConnectionQueue() { return m_lpConnectQueue; }
View
@@ -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) {
View
@@ -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);
View
@@ -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 {

0 comments on commit e69032a

Please sign in to comment.