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: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 21 Jan 2022 14:11:37 +0100 (CET)

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.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-01-21