Title: Message
If suffix.length() is bigger than s.length() you'll get std::out_of_range exception, because s.length() - suffix.length() will yield a *very* big value.
(but I haven't looked at the source code to see whether the arguments are being checked by the caller, so sorry for my comment, if that's the case)
 
Cheers,
Stoyan
-----Original Message-----
From: BjÑrn Carlsson [mailto:[EMAIL PROTECTED]
Sent: 03/09/2005 12:00
To: log4cxx-user@logging.apache.org
Subject: Corrected bug in StringHelper::endsWith on CVS HEAD

Both
    bool StringHelper::endsWith(const std::string& s, const std::string& suffix)
and
    bool StringHelper::endsWith(const std::wstring& s, const std::wstring& suffix)
should be like this:
      return s.compare(s.length() - suffix.length(), suffix.length(), suffix) == 0;

and not
      return suffix.compare(s.length() - suffix.length(), suffix.length(), s) == 0;

--
/BjÃrn Carlsson
VersionSupport.com

Reply via email to