examples: fix compiler warnings

This commit is contained in:
Daniel Stenberg 2010-12-17 23:34:26 +01:00
parent 8219bc9e19
commit 9583b4af90
14 changed files with 25 additions and 19 deletions

View File

@ -9,9 +9,12 @@
static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream)
{
(void)stream;
(void)ptr;
return size * nmemb;
}
int main(int argc, char **argv)
int main(void)
{
CURL *curl;
CURLcode res;

View File

@ -28,12 +28,12 @@ void dump(const char *text,
/* without the hex output, we can fit more on screen */
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);
for(i=0; i<size; i+= width) {
fprintf(stream, "%04.4lx: ", (long)i);
fprintf(stream, "%4.4lx: ", (long)i);
if(!nohex) {
/* hex not disabled, show it */

View File

@ -21,6 +21,8 @@
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,
so we only return the size we would have saved ... */
return (size_t)(size * nmemb);
@ -58,7 +60,7 @@ int main(void)
if((CURLE_OK == res) && filetime)
printf("filetime %s: %s", filename, ctime(&filetime));
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);
} else {
/* we failed */

View File

@ -27,7 +27,7 @@ write_response(void *ptr, size_t size, size_t nmemb, void *data)
return fwrite(ptr, size, nmemb, writehere);
}
int main(int argc, char **argv)
int main(void)
{
CURL *curl;
CURLcode res;

View File

@ -48,7 +48,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
return retcode;
}
int main(int argc, char **argv)
int main(void)
{
CURL *curl;
CURLcode res;

View File

@ -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;
@ -87,7 +87,7 @@ int main(int argc, char **argv)
* 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)
free(chunk.memory);

View File

@ -27,7 +27,7 @@
#define HTTP_HANDLE 0 /* Index for the HTTP transfer */
#define FTP_HANDLE 1 /* Index for the FTP transfer */
int main(int argc, char **argv)
int main(void)
{
CURL *handles[HANDLECOUNT];
CURLM *multi_handle;

View File

@ -37,12 +37,12 @@ void dump(const char *text,
/* without the hex output, we can fit more on screen */
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);
for(i=0; i<size; i+= width) {
fprintf(stream, "%04.4lx: ", (long)i);
fprintf(stream, "%4.4lx: ", (long)i);
if(!nohex) {
/* hex not disabled, show it */
@ -79,6 +79,7 @@ int my_trace(CURL *handle, curl_infotype type,
{
const char *text;
(void)userp;
(void)handle; /* prevent compiler warning */
switch (type) {
@ -108,7 +109,7 @@ int my_trace(CURL *handle, curl_infotype type,
/*
* Simply download a HTTP file.
*/
int main(int argc, char **argv)
int main(void)
{
CURL *http_handle;
CURLM *multi_handle;

View File

@ -22,7 +22,7 @@
/*
* Simply download two HTTP files!
*/
int main(int argc, char **argv)
int main(void)
{
CURL *http_handle;
CURL *http_handle2;

View File

@ -15,7 +15,7 @@
#include <curl/curl.h>
int main(int argc, char *argv[])
int main(void)
{
CURL *curl;

View File

@ -22,7 +22,7 @@
/*
* Simply download a HTTP file.
*/
int main(int argc, char **argv)
int main(void)
{
CURL *http_handle;
CURLM *multi_handle;

View File

@ -11,7 +11,7 @@
#include <unistd.h>
#include <curl/curl.h>
int main(int argc, char **argv)
int main(void)
{
CURL *curl;
CURLcode res;

View File

@ -21,7 +21,7 @@ static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
return written;
}
int main(int argc, char **argv)
int main(void)
{
CURL *curl_handle;
static const char *headerfilename = "head.out";

View File

@ -32,7 +32,7 @@
*/
int main(int argc, char **argv)
int main(void)
{
CURL *curl;
CURLcode res;
@ -47,7 +47,7 @@ int main(int argc, char **argv)
const char *pEngine;
#if USE_ENGINE
#ifdef USE_ENGINE
pKeyName = "rsa_test";
pKeyType = "ENG";
pEngine = "chil"; /* for nChiper HSM... */