curl-library
Re: Minor Inconsistent Use Of strequal()
Date: Wed, 11 Dec 2002 21:21:56 -0500
<embarrassed grin>
You're absolutely right. I should have read that more carefully.
I imagine this'll be the first reversal of some of my proposed fixes...!
Thank you.
----- Original Message -----
From: "Daniel Stenberg" <daniel_at_haxx.se>
To: "Curl Library List" <curl-library_at_lists.sourceforge.net>
Sent: Wednesday, December 11, 2002 6:47 AM
Subject: Re: Minor Inconsistent Use Of strequal()
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/ ------------------------------------------------------- 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-12