cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: out of memory error while posting form data

From: deva seetharam <tagsense_at_yahoo.com>
Date: Wed, 30 Jul 2008 08:55:56 -0700 (PDT)

--- On Tue, 7/29/08, Dan Fandrich <dan_at_coneharvesters.com> wrote:

> From: Dan Fandrich <dan_at_coneharvesters.com>
> Subject: Re: out of memory error while posting form data
> To: curl-library_at_cool.haxx.se
> Date: Tuesday, July 29, 2008, 11:45 PM
> On Tue, Jul 29, 2008 at 08:21:08PM -0700, deva seetharam
> wrote:
> > here is the code (with the error checking removed, for
> brevity). it is arelatively simple code that posts a form
> with 3 text fields and 1 data file.
>
> > int curlUploadData(char* data, unsigned int dataSize)
> {
> [...]
> > /* Add the transmit buffer as a file upload as
> multipart form data,
> > with form item name "datafile" */
> > curl_formadd(&post, &last,
> > CURLFORM_COPYNAME, "datafile",
> > CURLFORM_BUFFER, "filename",
> > CURLFORM_BUFFERPTR, data,
> > CURLFORM_BUFFERLENGTH, dataSize,
> > CURLFORM_END);
>
> CURLFORM_BUFFERLENGTH
> is used in combination with
> CURLFORM_BUFFER. The
> parameter is a long which gives the length
> of the
> buffer.
>
> dataSize is an unsigned int, not a long like it should be.
> On 32-bit x86
> Linux they're the same length, but on x86-64,
> they're not. That's probably
> the problem right there.
it was the problem. fixed it. thank you!

but, i am curious to know why would that be an issue at all. anyways i am up converting - i am using an unsigned int (usually the value is around 1000) in place of an unsigned long.

pls. let me know.

thanks in advance,
deva

      
Received on 2008-07-30