cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: returning -1 to CURLOPT_WRITEFUNCTION

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 15 Oct 2001 14:35:37 +0200 (MET DST)

On Sat, 13 Oct 2001, jonatan wrote:

> the docs say to return -1 to the function set with CURLOPT_WRITEFUNCTION
> to signal error. but that function is defined as returning size_t, which
> is unsigned. how are you supposed to return -1 when you can only return
> an unsigned value?

That is indeed a very good question! ;-)

> maybe the return type of CURLOPT_WRITEFUNCTION should be ssize_t or
> ptrdiff_t instead of size_t.

Well, to avoid having to change the prototype I think I'll change the
documentation!

The return code doesn't really matter, as returning anything other than the
actually passed in size will make libcurl return CURLE_WRITE_ERROR.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-10-15