cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: write callback issues (was Re: A new problem)

From: Daniel Egger <daniel_at_eggers-club.de>
Date: Thu, 3 Apr 2008 15:34:03 +0200

On 03.04.2008, at 14:57, Prasad J Pandit wrote:

> if (rsp->data)
> {
> memset (rsp->data, '\0', rsp->len);
> _snprintf (rsp->data, rsp->len, "%s", (char *)buf);

The memset is kinda redundant. And a usual snprintf will only output
data til it finds a \0 in the buffer which might or might not happen
in your case. A memcpy might be more useful in this case.

Also the allocation happening in the recv function strikes me a little
odd plus there's no data being exchanged with the outside which is kinda
unusual.

You could as well just use the curl buffer without any further code.

Servus,
       Daniel
Received on 2008-04-03