cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Win32 version of curl

From: Dave M <DaveM_at_mich.com>
Date: Thu, 03 Nov 2005 14:00:38 -0500
At 02:28 AM 11/3/2005 , Daniel Stenberg wrote:
When you do simple 'curl' invokes?

Yes, I just run it with no parameters. It is trying to stream the instruction string for using the --help parameter ("curl: try 'curl --help' ..."). The first char ('c') passed to OUTCHAR() causes an error in KERNEL32.DLL.

It looks like it is not able to properly cast void* data to FILE* data. It looks like data should be stderr cast to void* and then cast to FILE*. Stream expects FILE* but that is where I get the error.  Maybe this should be obvious but its been a while since I worked on pure C code. So its not so obvious to me. If I change OUTCHAR() as follows:

/*    if(stream((unsigned char)(x), (FILE *)data) != -1) \*/
    if(stream((unsigned char)(x), stderr) != -1) \

Then it works.

Then how come that doesn't happen when you use the curl other people have built from the same set of sources?

Good question...

Eh, because it was written that way! ;-) Feel free to improve the code and send back patches if you think you can improve it. I certainly won't claim that it is perfect.

I would rather not change things unless I know why something was done the way it was done. I am new here and, given that the code works (in most cases), I would rather not break it by changing something out of ignorance as to why it was done that way. So I guess I am wondering why it goes from stderr to void* to FILE*? Would it not make more sense to use FILE* consistently?

But, either way, I am baffled as to why it works for everyone else and not me. It is valid code so it should work, even in MSVC...

-------------------------------
Dave M
Davem (at) Mich (dot) Com
Ann Arbor, Mich. USA
Endangered electronic species: http://www.eff.org/endangered/list.php
Received on 2005-11-03