]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples: fix compiler warnings
authorDaniel Stenberg <daniel@haxx.se>
Fri, 17 Dec 2010 22:34:26 +0000 (23:34 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 17 Dec 2010 22:34:26 +0000 (23:34 +0100)
14 files changed:
docs/examples/certinfo.c
docs/examples/debug.c
docs/examples/ftpgetinfo.c
docs/examples/ftpgetresp.c
docs/examples/ftpupload.c
docs/examples/getinmemory.c
docs/examples/multi-app.c
docs/examples/multi-debugcallback.c
docs/examples/multi-double.c
docs/examples/multi-post.c
docs/examples/multi-single.c
docs/examples/persistant.c
docs/examples/sepheaders.c
docs/examples/simplessl.c

index ceb0ac2b0eb6c03da7c38d99cdcb0652d4be706a..2e331a4151e995bfb99981fb7bfc5fb673b61370 100644 (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;
index cc684817806392a25fd934b221640d106b0f0a05..1e04acb515798560270be503ce483672cf340968 100644 (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 */
index c4e234f184fdb4ff66734f0d41e326855c83e658..95c6f8ac8f9584104177515e7c0568664809d6fa 100644 (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 */
index 2122c4f68be156f05f0667ee02b3bd927db58877..c78832f3c59d634ab9f9f245c89268377a626115 100644 (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;
index f1f66c0a1398606ffd09821cc19d43e4710e31a0..bee62494ce149d4394ef0d8bb3097a9112bcbcf4 100644 (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;
index 635a936bab18a63855d47930533dac09e749aa73..85b049483b11de7658103b0ee65b8b1a8e996597 100644 (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);
index 6ba131830dcfdbc7b463f06fa62c53cfb8b4a9c9..29b07aba1199bcc4dc23bd454d586a1909ad57e5 100644 (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;
index 529c3d9bb86ac5c22942c74d9b4396fa7059cd11..773faec67ea938591231813932119b44ecfdb912 100644 (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;
index 3ea106bf79013c21755af100d70c40323145efad..990fec36a80d7c0ae6c750cbe18463ad92b1390a 100644 (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;
index 8b4f03e9e335ead0fd3ee9ca6b8dfa9c445a5094..13cfe6ff40ce674a8503d365e23c9de376ed3782 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <curl/curl.h>
 
-int main(int argc, char *argv[])
+int main(void)
 {
   CURL *curl;
 
index f248afe7668bcf26e6c63d245a8ebc2b9d1a6a1a..ca632e08c9a68f3a33fd60d9aa4926b40bcdd6f3 100644 (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;
index 177ada359008928c92e0c4c076d79289a0a6a029..53710cde438cf29d7b8cfe3de1e3364cce1a8c23 100644 (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;
index e0c4cbbb76f7dd30394c9e006ed0399de31be34a..3fb9045e105e6a5b77860ea9e25fc1fe1b87de2d 100644 (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";
index db3accaaa9b25fef443472b23de33ac1ca63199a..a02c2ae3213c26733a64a118d1cbe479f7b7c143 100644 (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... */