From 195681d7d76b59d639d0865b61761df8d6a08e54 Mon Sep 17 00:00:00 2001 From: kroimon Date: Tue, 30 Sep 2008 12:57:10 +0000 Subject: [PATCH] Added length argument to CString::StrCmp() like in CString::CaseCmp() git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1231 726aef4b-f618-498e-8847-2d620e286838 --- ZNCString.cpp | 7 +++++-- ZNCString.h | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ZNCString.cpp b/ZNCString.cpp index a0a558b7..fa7f9169 100644 --- a/ZNCString.cpp +++ b/ZNCString.cpp @@ -172,14 +172,17 @@ inline unsigned char* CString::strnchr(const unsigned char* src, unsigned char c return NULL; } -int CString::CaseCmp(const CString& s, u_long uLen) const { +int CString::CaseCmp(const CString& s, unsigned long 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) const { +int CString::StrCmp(const CString& s, unsigned long uLen) const { + if (uLen != CString::npos) { + return strncmp(c_str(), s.c_str(), uLen); + } return strcmp(c_str(), s.c_str()); } diff --git a/ZNCString.h b/ZNCString.h index 683e0356..48e8f57f 100644 --- a/ZNCString.h +++ b/ZNCString.h @@ -80,8 +80,8 @@ public: virtual ~CString() {} inline unsigned char* strnchr(const unsigned char* src, unsigned char c, unsigned int iMaxBytes, unsigned char* pFill = NULL, unsigned int* piCount = NULL) const; - int CaseCmp(const CString& s, u_long uLen = CString::npos) const; - int StrCmp(const CString& s) const; + int CaseCmp(const CString& s, unsigned long uLen = CString::npos) const; + int StrCmp(const CString& s, unsigned long uLen = CString::npos) const; static bool WildCmp(const CString& sWild, const CString& sString); bool WildCmp(const CString& sWild) const;