curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: CURLOPT_WRITEFUNCTION issues - warning: curl_easy_setopt expects a curl_write_callback argument

From: Gavin Henry via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 21 Jan 2022 14:48:20 +0000

On Fri, 21 Jan 2022 at 13:11, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Fri, 21 Jan 2022, Gavin Henry via curl-library wrote:
>
> > json_t *json = outstream;
> > json = json_loadb(buffer, size * nmemb, 0, NULL);
> >
> > "The value is never used". I'll leave gcc and clang to sort.
>
> The first statement here is pointless since you discard the contents and
> assign it again in the second line, which doesn't look right. I think you
> probably want something similar to:
>
> json_t **json = outstream;
> *json = json_loadb(buffer, size * nmemb, 0, NULL);
>
> Because outside of the callback you pass do:
>
> json_t *json = 0;
> curl_easy_setopt(curl, CURLOPT_WRITEDATA, &json);
>
> ... so that's a pointer to a pointer.
>

Thanks. Yeah, this is messy.

-- 
Kind Regards,
Gavin Henry.
https://sentrypeer.org
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-01-21