Skip to content

Commit

Permalink
squash some compiler warnings
Browse files Browse the repository at this point in the history
(cherry picked from commit b3021f9)
  • Loading branch information
KiNgMaR authored and DarthGandalf committed Apr 14, 2014
1 parent 4f40500 commit e69032a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion include/znc/Utils.h
Expand Up @@ -312,7 +312,7 @@ class TCacheMap {
* @return true if item existed and was removed, false if it never existed * @return true if item existed and was removed, false if it never existed
*/ */
bool RemItem(const K& Item) { bool RemItem(const K& Item) {
return m_mItems.erase(Item); return (m_mItems.erase(Item) != 0);
} }


/** /**
Expand Down
6 changes: 3 additions & 3 deletions include/znc/ZNCString.h
Expand Up @@ -102,15 +102,15 @@ class CString : public std::string {
* @return An integer less than, equal to, or greater than zero if this * @return An integer less than, equal to, or greater than zero if this
* string smaller, equal.... to the given string. * 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. * Compare this string case sensitively to some other string.
* @param s The string to compare to. * @param s The string to compare to.
* @param uLen The number of characters to compare. * @param uLen The number of characters to compare.
* @return An integer less than, equal to, or greater than zero if this * @return An integer less than, equal to, or greater than zero if this
* string smaller, equal.... to the given string. * 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. * Check if this string is equal to some other string.
* @param s The string to compare to. * @param s The string to compare to.
Expand All @@ -119,7 +119,7 @@ class CString : public std::string {
* @param uLen Number of characters to consider. * @param uLen Number of characters to consider.
* @return True if the strings are equal. * @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. * Do a wildcard comparision between two strings.
* For example, the following returns true: * For example, the following returns true:
Expand Down
2 changes: 1 addition & 1 deletion include/znc/znc.h
Expand Up @@ -160,7 +160,7 @@ class CZNC {
// !MOTD // !MOTD


void AddServerThrottle(CString sName) { m_sConnectThrottle.AddItem(sName); } 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); void AddNetworkToQueue(CIRCNetwork *pNetwork);
std::list<CIRCNetwork*>& GetConnectionQueue() { return m_lpConnectQueue; } std::list<CIRCNetwork*>& GetConnectionQueue() { return m_lpConnectQueue; }
Expand Down
22 changes: 12 additions & 10 deletions modules/autoop.cpp
Expand Up @@ -321,19 +321,21 @@ class CAutoOpMod : public CModule {
bool CheckAutoOp(const CNick& Nick, CChan& Channel) { bool CheckAutoOp(const CNick& Nick, CChan& Channel) {
CAutoOpUser *pUser = FindUserByHost(Nick.GetHostMask(), Channel.GetName()); CAutoOpUser *pUser = FindUserByHost(Nick.GetHostMask(), Channel.GetName());


if (pUser) { if (!pUser) {
if (pUser->GetUserKey().Equals("__NOKEY__")) { return false;
PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick()); }
} else {
// then insert this nick into the queue, the timer does the rest if (pUser->GetUserKey().Equals("__NOKEY__")) {
CString sNick = Nick.GetNick().AsLower(); PutIRC("MODE " + Channel.GetName() + " +o " + Nick.GetNick());
if (m_msQueue.find(sNick) == m_msQueue.end()) { } else {
m_msQueue[sNick] = ""; // 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) { void DelUser(const CString& sUser) {
Expand Down
2 changes: 1 addition & 1 deletion modules/sasl.cpp
Expand Up @@ -478,7 +478,7 @@ class CSASLMod : public CModule {
return sCap.Equals("sasl"); 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 (sCap.Equals("sasl")) {
if (bSuccess) { if (bSuccess) {
GetMechanismsString().Split(" ", m_Mechanisms); GetMechanismsString().Split(" ", m_Mechanisms);
Expand Down
6 changes: 3 additions & 3 deletions src/ZNCString.cpp
Expand Up @@ -65,21 +65,21 @@ unsigned char* CString::strnchr(const unsigned char* src, unsigned char c, unsig
return NULL; 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) { if (uLen != CString::npos) {
return strncasecmp(c_str(), s.c_str(), uLen); return strncasecmp(c_str(), s.c_str(), uLen);
} }
return strcasecmp(c_str(), s.c_str()); 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) { if (uLen != CString::npos) {
return strncmp(c_str(), s.c_str(), uLen); return strncmp(c_str(), s.c_str(), uLen);
} }
return strcmp(c_str(), s.c_str()); 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) { if (bCaseSensitive) {
return (StrCmp(s, uLen) == 0); return (StrCmp(s, uLen) == 0);
} else { } else {
Expand Down

0 comments on commit e69032a

Please sign in to comment.