1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-23 08:38:49 -05:00

doh: minor edits to please Coverity

The gcc typecheck macros and coverity combined made it warn on the 2nd
argument for ERROR_CHECK_SETOPT(). Here's minor rearrange to please it.

Coverity CID 1439115 and CID 1439114.
This commit is contained in:
Daniel Stenberg 2018-09-07 09:26:08 +02:00
parent 10009222fe
commit c515294cec
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -218,11 +218,14 @@ static CURLcode dohprobe(struct Curl_easy *data,
/* Curl_open() is the internal version of curl_easy_init() */ /* Curl_open() is the internal version of curl_easy_init() */
result = Curl_open(&doh); result = Curl_open(&doh);
if(!result) { if(!result) {
/* pass in the struct pointer via a local variable to please coverity and
the gcc typecheck helpers */
struct dohresponse *resp = &p->serverdoh;
ERROR_CHECK_SETOPT(CURLOPT_URL, url); ERROR_CHECK_SETOPT(CURLOPT_URL, url);
ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_write_cb); ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_write_cb);
ERROR_CHECK_SETOPT(CURLOPT_WRITEDATA, (void *)&p->serverdoh); ERROR_CHECK_SETOPT(CURLOPT_WRITEDATA, resp);
if(!data->set.doh_get) { if(!data->set.doh_get) {
ERROR_CHECK_SETOPT(CURLOPT_POSTFIELDS, &p->dohbuffer[0]); ERROR_CHECK_SETOPT(CURLOPT_POSTFIELDS, p->dohbuffer);
ERROR_CHECK_SETOPT(CURLOPT_POSTFIELDSIZE, p->dohlen); ERROR_CHECK_SETOPT(CURLOPT_POSTFIELDSIZE, p->dohlen);
} }
ERROR_CHECK_SETOPT(CURLOPT_HTTPHEADER, headers); ERROR_CHECK_SETOPT(CURLOPT_HTTPHEADER, headers);