curl-library
Re: Minor Inconsistent Use Of strequal()
Date: Wed, 11 Dec 2002 12:47:29 +0100 (MET)
On Wed, 11 Dec 2002, Alexander J. Oss wrote:
> While plowing through libcurl 7.10.2 eliminating warnings that Borland C++
> Builder generates, I came across line 318 of cookie.c:
>
> co->field1=strequal(ptr, "TRUE")+1; /* store information */
>
> The problem here is that in some cases strequal() is a call to stricmp,
> which is only documented as returning "<0, 0, or >0". In cookie.h, the
> Cookie.field1 struct element is only supposed to have the values 1 or 2.
> I think there's an incorrect assumption that strequal will only return 0 or
> 1.
I'm grateful for your effort and your "audit", but I think you're wrong here:
The call to stricmp is made as "return !(stricmp)(first, second)"
(lib/strequal.c line 36) and the !-letter will thus make the return code be 0
or 1, nothing else.
Correct me if I'm wrong.
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/Received on 2002-12-11