This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] setup.exe: Stop NetIO_HTTP from treating entire stream as a header


On Tue, Nov 27, 2001 at 12:36:52PM -0600, Gary R Van Sickle wrote:
>> "Gary R. Van Sickle" wrote:
>> >
>> > Ok, setup.exe seems to work much better with this patch
>> applied (also attached):
>>
>> Yep, I'm the one that screwed this up. Here is how it was before
>> my patch was applied.
>>
>>   do {
>>     l = s->gets ();
>>     if (_strnicmp (l, "Content-Length:", 15) == 0)
>>       sscanf (l, "%*s %d", &file_size);
>>   } while (*l);
>>
>>
>> What about replacing this in your patch:
>> > +  while (((l = s->gets ()) != 0) && (strlen(l) != 0))
>> with
>>   +  while (((l = s->gets ()) != 0) && *l)
>>
>
>Ah, better yet.  Jeez you guys are clever ;-).  But how about we make it:
>
>	while (((l = s->gets ()) != 0) && (*l != '\0'))
>
>in the interest of making it a bit more self-documenting?

Actually, how about not using != 0.  Use NULL in this context.

I don't think that *l is hard to understand, fwiw.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]