Permalink
Browse files

"no" should be false in CString::ToBool()

  • Loading branch information...
1 parent a0f977d commit c31e36169416b0bd429f0ddec0c8b07ce4cae054 @kylef kylef committed Jan 15, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 ZNCString.cpp
View
@@ -902,7 +902,14 @@ CString CString::ToTimeStr(unsigned long s) {
return sRet.RightChomp_n();
}
-bool CString::ToBool() const { return (!Trim_n().Trim_n("0").empty() && !Trim_n().Equals("false")); }
+bool CString::ToBool() const {
+ CString sTrimmed = Trim_n();
+ return (!sTrimmed.Trim_n("0").empty() &&
+ !sTrimmed.Equals("false") &&
+ !sTrimmed.Equals("no") &&
+ !sTrimmed.Equals("n"));
+}
+
short CString::ToShort() const { return strtoul(this->c_str(), (char**) NULL, 10); }
unsigned short CString::ToUShort() const { return strtoul(this->c_str(), (char**) NULL, 10); }
unsigned int CString::ToUInt() const { return strtoul(this->c_str(), (char**) NULL, 10); }

0 comments on commit c31e361

Please sign in to comment.