I'm confused about what you're trying to do.outstream is an input parameter. It will contain whatever you set in the CURLOPT_WRITEDATA option.
If it's a json structure that's input to your callback, overwriting the pointer with json_loadb doesn't make sense.
In fact, the value of outstream, now in json isn't used - loadb simply overwrites it.
Further, your callback may be called many times with pieces of the json string. You need to get the entire response before calling json_loadb, or use another call.
You can use "outstream" as a pointer to a buffer that accumulates the response, or to a struct with the next write pointer and remaining count in that buffer, or ...
You need to re-architect this code. Timothe Litt ACM Distinguished Engineer -------------------------- This communication may not represent the ACM or my employer's views, if any, on the matters discussed. On 21-Jan-22 07:34, Gavin Henry via curl-library wrote:
Thanks. Switched it to:
static size_t curl_to_jansson_to_version(void *buffer, size_t size,
size_t nmemb, void *outstream)
{
json_t *json = outstream;
json = json_loadb(buffer, size * nmemb, 0, NULL);
assert_non_null(json);
then my CLion moans, but is OK :-)
"The value is never used". I'll leave gcc and clang to sort.
OpenPGP_signature
Description: OpenPGP digital signature
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
