You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Tommi Mäkitalo <to...@epgmbh.de> on 2005/01/13 21:50:15 UTC

bug in stringhelper

Hi,

There is a bug in StringHelper::startsWith: "std::string::compare(size_type 
pos, size_type len, const std::string& s)" compares a substring of the string 
with s and not vice versa.

Here is a patch.

After that it works at least with easy cases on my x86-64.

Thank you Curt. I vote for a 0.9.8 soon.


Tommi

Re: bug in stringhelper

Posted by Tommi Maekitalo <to...@epgmbh.de>.
Hi,

sorry - I meant endsWith, which does not work. This was the fix for the bug I 
found.

I will look at Cppunit. I haven't used it before. And also at Jira. I don't 
know it either.


Tommi


Am Freitag, 14. Januar 2005 06:03 schrieb Curt Arnold:
> The patch you sent seems to be modifying StringHelper::endsWith, not
>
> ::startsWith and then intent was that
>
> StringHelper::endsWith("foobar", "bar") == true
>
> I believe the existing code would do that and the patched version would
> not but haven't had a chance to create a unit test case for those
> functions.
>
> Could you describe the symptom that you believe that a bug in
> StringHelper is causing? It would be helpful if you could also create a
> test case for every bug that you fix so that we can detect regressions.
> I'd also prefer that you use Jira to submit patches.
>
> On Jan 13, 2005, at 2:50 PM, Tommi Mäkitalo wrote:
> > Hi,
> >
> > There is a bug in StringHelper::startsWith:
> > "std::string::compare(size_type pos, size_type len, const std::string&
> > s)" compares a substring of the string with s and not vice versa.
> >
> > Here is a patch.
> >
> > After that it works at least with easy cases on my x86-64.
> >
> > Thank you Curt. I vote for a 0.9.8 soon.
> >
> >
> > Tommi
> > <stringhelper.diff>

Re: bug in stringhelper

Posted by Curt Arnold <ca...@apache.org>.
The patch you sent seems to be modifying StringHelper::endsWith, not 
::startsWith and then intent was that

StringHelper::endsWith("foobar", "bar") == true

I believe the existing code would do that and the patched version would 
not but haven't had a chance to create a unit test case for those 
functions.

Could you describe the symptom that you believe that a bug in 
StringHelper is causing? It would be helpful if you could also create a 
test case for every bug that you fix so that we can detect regressions. 
I'd also prefer that you use Jira to submit patches.

On Jan 13, 2005, at 2:50 PM, Tommi Mäkitalo wrote:


> Hi,
>
> There is a bug in StringHelper::startsWith: 
> "std::string::compare(size_type pos, size_type len, const std::string& 
> s)" compares a substring of the string with s and not vice versa.
>
> Here is a patch.
>
> After that it works at least with easy cases on my x86-64.
>
> Thank you Curt. I vote for a 0.9.8 soon.
>
>
> Tommi
> <stringhelper.diff>