mirror of https://github.com/moparisthebest/curl
examples: fix compiler warnings
This commit is contained in:
parent
8219bc9e19
commit
9583b4af90
|
@ -9,9 +9,12 @@
|
||||||
|
|
||||||
static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream)
|
static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)ptr;
|
||||||
return size * nmemb;
|
return size * nmemb;
|
||||||
}
|
}
|
||||||
int main(int argc, char **argv)
|
|
||||||
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
|
|
@ -28,12 +28,12 @@ void dump(const char *text,
|
||||||
/* without the hex output, we can fit more on screen */
|
/* without the hex output, we can fit more on screen */
|
||||||
width = 0x40;
|
width = 0x40;
|
||||||
|
|
||||||
fprintf(stream, "%s, %010.10ld bytes (0x%08.8lx)\n",
|
fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n",
|
||||||
text, (long)size, (long)size);
|
text, (long)size, (long)size);
|
||||||
|
|
||||||
for(i=0; i<size; i+= width) {
|
for(i=0; i<size; i+= width) {
|
||||||
|
|
||||||
fprintf(stream, "%04.4lx: ", (long)i);
|
fprintf(stream, "%4.4lx: ", (long)i);
|
||||||
|
|
||||||
if(!nohex) {
|
if(!nohex) {
|
||||||
/* hex not disabled, show it */
|
/* hex not disabled, show it */
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
static size_t throw_away(void *ptr, size_t size, size_t nmemb, void *data)
|
static size_t throw_away(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
{
|
{
|
||||||
|
(void)ptr;
|
||||||
|
(void)data;
|
||||||
/* we are not interested in the headers itself,
|
/* we are not interested in the headers itself,
|
||||||
so we only return the size we would have saved ... */
|
so we only return the size we would have saved ... */
|
||||||
return (size_t)(size * nmemb);
|
return (size_t)(size * nmemb);
|
||||||
|
@ -58,7 +60,7 @@ int main(void)
|
||||||
if((CURLE_OK == res) && filetime)
|
if((CURLE_OK == res) && filetime)
|
||||||
printf("filetime %s: %s", filename, ctime(&filetime));
|
printf("filetime %s: %s", filename, ctime(&filetime));
|
||||||
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize);
|
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize);
|
||||||
if((CURLE_OK == res) && filesize)
|
if((CURLE_OK == res) && (filesize>0))
|
||||||
printf("filesize %s: %0.0f bytes\n", filename, filesize);
|
printf("filesize %s: %0.0f bytes\n", filename, filesize);
|
||||||
} else {
|
} else {
|
||||||
/* we failed */
|
/* we failed */
|
||||||
|
|
|
@ -27,7 +27,7 @@ write_response(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
return fwrite(ptr, size, nmemb, writehere);
|
return fwrite(ptr, size, nmemb, writehere);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
|
|
@ -48,7 +48,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
|
|
@ -43,7 +43,7 @@ WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl_handle;
|
CURL *curl_handle;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
||||||
* you're done with it, you should free() it as a nice application.
|
* you're done with it, you should free() it as a nice application.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printf("%lu bytes retrieved\n", chunk.size);
|
printf("%lu bytes retrieved\n", (long)chunk.size);
|
||||||
|
|
||||||
if(chunk.memory)
|
if(chunk.memory)
|
||||||
free(chunk.memory);
|
free(chunk.memory);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
|
#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
|
||||||
#define FTP_HANDLE 1 /* Index for the FTP transfer */
|
#define FTP_HANDLE 1 /* Index for the FTP transfer */
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *handles[HANDLECOUNT];
|
CURL *handles[HANDLECOUNT];
|
||||||
CURLM *multi_handle;
|
CURLM *multi_handle;
|
||||||
|
|
|
@ -37,12 +37,12 @@ void dump(const char *text,
|
||||||
/* without the hex output, we can fit more on screen */
|
/* without the hex output, we can fit more on screen */
|
||||||
width = 0x40;
|
width = 0x40;
|
||||||
|
|
||||||
fprintf(stream, "%s, %010.10ld bytes (0x%08.8lx)\n",
|
fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n",
|
||||||
text, (long)size, (long)size);
|
text, (long)size, (long)size);
|
||||||
|
|
||||||
for(i=0; i<size; i+= width) {
|
for(i=0; i<size; i+= width) {
|
||||||
|
|
||||||
fprintf(stream, "%04.4lx: ", (long)i);
|
fprintf(stream, "%4.4lx: ", (long)i);
|
||||||
|
|
||||||
if(!nohex) {
|
if(!nohex) {
|
||||||
/* hex not disabled, show it */
|
/* hex not disabled, show it */
|
||||||
|
@ -79,6 +79,7 @@ int my_trace(CURL *handle, curl_infotype type,
|
||||||
{
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
|
|
||||||
|
(void)userp;
|
||||||
(void)handle; /* prevent compiler warning */
|
(void)handle; /* prevent compiler warning */
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -108,7 +109,7 @@ int my_trace(CURL *handle, curl_infotype type,
|
||||||
/*
|
/*
|
||||||
* Simply download a HTTP file.
|
* Simply download a HTTP file.
|
||||||
*/
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *http_handle;
|
CURL *http_handle;
|
||||||
CURLM *multi_handle;
|
CURLM *multi_handle;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
/*
|
/*
|
||||||
* Simply download two HTTP files!
|
* Simply download two HTTP files!
|
||||||
*/
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *http_handle;
|
CURL *http_handle;
|
||||||
CURL *http_handle2;
|
CURL *http_handle2;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
/*
|
/*
|
||||||
* Simply download a HTTP file.
|
* Simply download a HTTP file.
|
||||||
*/
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *http_handle;
|
CURL *http_handle;
|
||||||
CURLM *multi_handle;
|
CURLM *multi_handle;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
|
|
@ -21,7 +21,7 @@ static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl_handle;
|
CURL *curl_handle;
|
||||||
static const char *headerfilename = "head.out";
|
static const char *headerfilename = "head.out";
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
|
@ -47,7 +47,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
const char *pEngine;
|
const char *pEngine;
|
||||||
|
|
||||||
#if USE_ENGINE
|
#ifdef USE_ENGINE
|
||||||
pKeyName = "rsa_test";
|
pKeyName = "rsa_test";
|
||||||
pKeyType = "ENG";
|
pKeyType = "ENG";
|
||||||
pEngine = "chil"; /* for nChiper HSM... */
|
pEngine = "chil"; /* for nChiper HSM... */
|
||||||
|
|
Loading…
Reference in New Issue