mirror of
https://github.com/curl/curl.git
synced 2026-07-23 01:27:16 +03:00
lib/src/docs/test: improve curl_easy_setopt() calls
Fix invokes where the argument was not the correct type. Closes #17160
This commit is contained in:
parent
179aeeaf22
commit
f9f1a15699
22 changed files with 39 additions and 34 deletions
|
|
@ -161,7 +161,7 @@ int main(void)
|
|||
/* call this function to set options for the socket */
|
||||
curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ struct callback_data {
|
|||
};
|
||||
|
||||
static long file_is_coming(struct curl_fileinfo *finfo,
|
||||
struct callback_data *data,
|
||||
void *data,
|
||||
int remains);
|
||||
|
||||
static long file_is_downloaded(struct callback_data *data);
|
||||
static long file_is_downloaded(void *data);
|
||||
|
||||
static size_t write_it(char *buff, size_t size, size_t nmemb,
|
||||
void *cb_data);
|
||||
|
|
@ -93,10 +93,10 @@ int main(int argc, char **argv)
|
|||
return (int)rc;
|
||||
}
|
||||
|
||||
static long file_is_coming(struct curl_fileinfo *finfo,
|
||||
struct callback_data *data,
|
||||
static long file_is_coming(struct curl_fileinfo *finfo, void *input,
|
||||
int remains)
|
||||
{
|
||||
struct callback_data *data = input;
|
||||
printf("%3d %40s %10luB ", remains, finfo->filename,
|
||||
(unsigned long)finfo->size);
|
||||
|
||||
|
|
@ -128,8 +128,9 @@ static long file_is_coming(struct curl_fileinfo *finfo,
|
|||
return CURL_CHUNK_BGN_FUNC_OK;
|
||||
}
|
||||
|
||||
static long file_is_downloaded(struct callback_data *data)
|
||||
static long file_is_downloaded(void *input)
|
||||
{
|
||||
struct callback_data *data = input;
|
||||
if(data->output) {
|
||||
printf("DOWNLOADED\n");
|
||||
fclose(data->output);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ int main(void)
|
|||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
|
||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V6);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://curl.se/");
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ int main(void)
|
|||
/* We activate ssh agent. For this to work you need
|
||||
to have ssh-agent running (type set | grep SSH_AGENT to check) or
|
||||
pageant on Windows (there is an icon in systray if so) */
|
||||
curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_AGENT);
|
||||
curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, (long)CURLSSH_AUTH_AGENT);
|
||||
#endif
|
||||
|
||||
/* Switch on full protocol/debug output */
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
|
|||
curl_easy_setopt(curlHandlePtr, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_URL, i_remoteFile);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_NOPROGRESS, 1);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_NOBODY, 1);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_HEADER, 1);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_FILETIME, 1);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_NOPROGRESS, 1L);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_NOBODY, 1L);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_HEADER, 1L);
|
||||
curl_easy_setopt(curlHandlePtr, CURLOPT_FILETIME, 1L);
|
||||
|
||||
result = curl_easy_perform(curlHandlePtr);
|
||||
if(CURLE_OK == result) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue