18
18
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
* KIND, either express or implied.
21
* $Id: easy.c,v 1.72 2005/04/07 15:27:13 bagder Exp $
21
* $Id: easy.c,v 1.73 2005/07/17 12:44:11 bagder Exp $
22
22
***************************************************************************/
308
308
* curl_easy_setopt() is the external interface for setting options on an
311
typedef int (*func_T)(void);
312
312
CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
315
func_T param_func = (func_T)0;
317
void *param_obj = NULL;
318
curl_off_t param_offset = 0;
319
315
struct SessionHandle *data = curl;
320
CURLcode ret=CURLE_FAILED_INIT;
323
319
return CURLE_BAD_FUNCTION_ARGUMENT;
325
321
va_start(arg, tag);
328
Object pointers can't necessarily be casted to function pointers and
329
therefore we need to know what type it is and read the correct type
330
at once. This should also correct problems with different sizes of
334
if(tag < CURLOPTTYPE_OBJECTPOINT) {
335
/* This is a LONG type */
336
param_long = va_arg(arg, long);
337
ret = Curl_setopt(data, tag, param_long);
339
else if(tag < CURLOPTTYPE_FUNCTIONPOINT) {
340
/* This is a object pointer type */
341
param_obj = va_arg(arg, void *);
342
ret = Curl_setopt(data, tag, param_obj);
344
else if(tag < CURLOPTTYPE_OFF_T) {
345
/* This is a function pointer type */
346
param_func = va_arg(arg, func_T );
347
ret = Curl_setopt(data, tag, param_func);
350
/* This is a curl_off_t type */
351
param_offset = va_arg(arg, curl_off_t);
352
ret = Curl_setopt(data, tag, param_offset);
323
ret = Curl_setopt(data, tag, arg);