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

Christopher Faylor cgf@redhat.com
Thu Oct 18 08:16:00 GMT 2001


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



More information about the Cygwin-patches mailing list