cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEFUNCTION - cannot make it working...

From: Paolo Piacentini <paolopiace_at_hotmail.com>
Date: Fri, 3 Jun 2011 23:41:52 -0700

> (*page_status).currentSize += nbytes;

DF>> On the first pass through, currentSize will be equal to the length of the current data.

Thanks. But that increment works fine. The problem occurs BEFORE that increment, either at the casting:

> struct thread_status *page_status = (struct thread_status *)thePage;

or at the caller of writeFunction in curl_easy_perform.

I do check storedUndrl.currentSize and .spacemade before curl_easy_perform and they are perfectly initialized to zero.

Then I check them again within writeFunction at the very first call through the pointer (*page_status) and I find them both huge, ~3G.
That's before any action on them, except casting the (void *).

DF>> There's an example called getinmemory.c that has been time tested and would be a good starting point for code to do this sort of thing.

That's where I got the prototype. My writeFunction is *identical* to the WriteMemoryCallback of getinmemory.c up to the casting. And the problem I describe is certainly isolated between curl_easy_perform (the caller) and the casting.

Basically, I cannot see what changes .currentSize and .spacemade from their initialized value to that huge number, as I'm not doing anything to them.

Thanks for looking @ it.
                                               

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-04