diff options
author | Tim Angus <tim@ngus.net> | 2015-09-09 23:33:36 +0100 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2016-04-07 11:05:38 +0100 |
commit | 35b1badb5a50ff044eaa2b1e305cf201e3acbf3b (patch) | |
tree | 731fc5f30c140dbd24085af5be61c501d36bdddc /src/client | |
parent | 9bb0f2a8841f4bf5d1af9e516e547ecdfdb6f0d8 (diff) |
Fix the wonky fix to the wonky va_list usage
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/cl_curl.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/client/cl_curl.c b/src/client/cl_curl.c index 80aefabe..7f23e7df 100644 --- a/src/client/cl_curl.c +++ b/src/client/cl_curl.c @@ -218,25 +218,27 @@ static size_t CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb, return size*nmemb; } -static CURLcode qcurl_easy_setopt_warn_valist(CURL *curl, CURLoption option, va_list args) -{ - CURLcode result; - - result = qcurl_easy_setopt(curl, option, args); - if(result != CURLE_OK) { - Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result)); - } - - return result; -} - CURLcode qcurl_easy_setopt_warn(CURL *curl, CURLoption option, ...) { CURLcode result; va_list argp; va_start(argp, option); - result = qcurl_easy_setopt_warn_valist(curl, option, argp); + + if(option < CURLOPTTYPE_OBJECTPOINT) { + long longValue = va_arg(argp, long); + result = qcurl_easy_setopt_warn(curl, option, longValue); + } else if(option < CURLOPTTYPE_OFF_T) { + void *pointerValue = va_arg(argp, void *); + result = qcurl_easy_setopt_warn(curl, option, pointerValue); + } else { + curl_off_t offsetValue = va_arg(argp, curl_off_t); + result = qcurl_easy_setopt_warn(curl, option, offsetValue); + } + + if(result != CURLE_OK) { + Com_DPrintf("qcurl_easy_setopt failed: %s\n", qcurl_easy_strerror(result)); + } va_end(argp); return result; |