From 35b1badb5a50ff044eaa2b1e305cf201e3acbf3b Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Wed, 9 Sep 2015 23:33:36 +0100 Subject: Fix the wonky fix to the wonky va_list usage --- src/client/cl_curl.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/client') 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; -- cgit