]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: make the unit test result type `CURLcode`
authorViktor Szakats <commit@vsz.me>
Sat, 11 May 2024 19:36:05 +0000 (21:36 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 12 May 2024 16:53:07 +0000 (18:53 +0200)
Before this patch, the result code was a mixture of `int` and
`CURLcode`.

Also adjust casts and fix a couple of minor issues found along the way.

Cherry-picked from #13489
Closes #13600

221 files changed:
tests/libtest/first.c
tests/libtest/lib1156.c
tests/libtest/lib1301.c
tests/libtest/lib1500.c
tests/libtest/lib1501.c
tests/libtest/lib1502.c
tests/libtest/lib1506.c
tests/libtest/lib1507.c
tests/libtest/lib1508.c
tests/libtest/lib1509.c
tests/libtest/lib1510.c
tests/libtest/lib1511.c
tests/libtest/lib1512.c
tests/libtest/lib1513.c
tests/libtest/lib1514.c
tests/libtest/lib1515.c
tests/libtest/lib1517.c
tests/libtest/lib1518.c
tests/libtest/lib1520.c
tests/libtest/lib1522.c
tests/libtest/lib1523.c
tests/libtest/lib1525.c
tests/libtest/lib1526.c
tests/libtest/lib1527.c
tests/libtest/lib1528.c
tests/libtest/lib1529.c
tests/libtest/lib1530.c
tests/libtest/lib1531.c
tests/libtest/lib1532.c
tests/libtest/lib1533.c
tests/libtest/lib1534.c
tests/libtest/lib1535.c
tests/libtest/lib1536.c
tests/libtest/lib1537.c
tests/libtest/lib1538.c
tests/libtest/lib1540.c
tests/libtest/lib1541.c
tests/libtest/lib1542.c
tests/libtest/lib1545.c
tests/libtest/lib1550.c
tests/libtest/lib1551.c
tests/libtest/lib1552.c
tests/libtest/lib1553.c
tests/libtest/lib1554.c
tests/libtest/lib1555.c
tests/libtest/lib1556.c
tests/libtest/lib1557.c
tests/libtest/lib1558.c
tests/libtest/lib1559.c
tests/libtest/lib1560.c
tests/libtest/lib1564.c
tests/libtest/lib1565.c
tests/libtest/lib1567.c
tests/libtest/lib1568.c
tests/libtest/lib1569.c
tests/libtest/lib1591.c
tests/libtest/lib1592.c
tests/libtest/lib1593.c
tests/libtest/lib1594.c
tests/libtest/lib1597.c
tests/libtest/lib1598.c
tests/libtest/lib1662.c
tests/libtest/lib1900.c
tests/libtest/lib1901.c
tests/libtest/lib1903.c
tests/libtest/lib1905.c
tests/libtest/lib1906.c
tests/libtest/lib1907.c
tests/libtest/lib1908.c
tests/libtest/lib1910.c
tests/libtest/lib1911.c
tests/libtest/lib1912.c
tests/libtest/lib1913.c
tests/libtest/lib1915.c
tests/libtest/lib1916.c
tests/libtest/lib1918.c
tests/libtest/lib1919.c
tests/libtest/lib1933.c
tests/libtest/lib1934.c
tests/libtest/lib1935.c
tests/libtest/lib1936.c
tests/libtest/lib1937.c
tests/libtest/lib1938.c
tests/libtest/lib1939.c
tests/libtest/lib1940.c
tests/libtest/lib1945.c
tests/libtest/lib1947.c
tests/libtest/lib1948.c
tests/libtest/lib1955.c
tests/libtest/lib1956.c
tests/libtest/lib1957.c
tests/libtest/lib1958.c
tests/libtest/lib1959.c
tests/libtest/lib1960.c
tests/libtest/lib1964.c
tests/libtest/lib1970.c
tests/libtest/lib1971.c
tests/libtest/lib1972.c
tests/libtest/lib1973.c
tests/libtest/lib1974.c
tests/libtest/lib1975.c
tests/libtest/lib2301.c
tests/libtest/lib2302.c
tests/libtest/lib2304.c
tests/libtest/lib2305.c
tests/libtest/lib2306.c
tests/libtest/lib2402.c
tests/libtest/lib2404.c
tests/libtest/lib2405.c
tests/libtest/lib2502.c
tests/libtest/lib3010.c
tests/libtest/lib3025.c
tests/libtest/lib3026.c
tests/libtest/lib3027.c
tests/libtest/lib3100.c
tests/libtest/lib3101.c
tests/libtest/lib3102.c
tests/libtest/lib3103.c
tests/libtest/lib500.c
tests/libtest/lib501.c
tests/libtest/lib502.c
tests/libtest/lib503.c
tests/libtest/lib504.c
tests/libtest/lib505.c
tests/libtest/lib506.c
tests/libtest/lib507.c
tests/libtest/lib508.c
tests/libtest/lib509.c
tests/libtest/lib510.c
tests/libtest/lib511.c
tests/libtest/lib512.c
tests/libtest/lib513.c
tests/libtest/lib514.c
tests/libtest/lib515.c
tests/libtest/lib516.c
tests/libtest/lib517.c
tests/libtest/lib518.c
tests/libtest/lib519.c
tests/libtest/lib520.c
tests/libtest/lib521.c
tests/libtest/lib523.c
tests/libtest/lib524.c
tests/libtest/lib525.c
tests/libtest/lib526.c
tests/libtest/lib530.c
tests/libtest/lib533.c
tests/libtest/lib536.c
tests/libtest/lib537.c
tests/libtest/lib539.c
tests/libtest/lib540.c
tests/libtest/lib541.c
tests/libtest/lib542.c
tests/libtest/lib543.c
tests/libtest/lib544.c
tests/libtest/lib547.c
tests/libtest/lib549.c
tests/libtest/lib552.c
tests/libtest/lib553.c
tests/libtest/lib554.c
tests/libtest/lib555.c
tests/libtest/lib556.c
tests/libtest/lib557.c
tests/libtest/lib558.c
tests/libtest/lib559.c
tests/libtest/lib560.c
tests/libtest/lib562.c
tests/libtest/lib564.c
tests/libtest/lib566.c
tests/libtest/lib567.c
tests/libtest/lib568.c
tests/libtest/lib569.c
tests/libtest/lib570.c
tests/libtest/lib571.c
tests/libtest/lib572.c
tests/libtest/lib573.c
tests/libtest/lib574.c
tests/libtest/lib575.c
tests/libtest/lib576.c
tests/libtest/lib578.c
tests/libtest/lib579.c
tests/libtest/lib582.c
tests/libtest/lib583.c
tests/libtest/lib586.c
tests/libtest/lib589.c
tests/libtest/lib590.c
tests/libtest/lib591.c
tests/libtest/lib597.c
tests/libtest/lib598.c
tests/libtest/lib599.c
tests/libtest/lib643.c
tests/libtest/lib650.c
tests/libtest/lib651.c
tests/libtest/lib652.c
tests/libtest/lib653.c
tests/libtest/lib654.c
tests/libtest/lib655.c
tests/libtest/lib658.c
tests/libtest/lib659.c
tests/libtest/lib661.c
tests/libtest/lib666.c
tests/libtest/lib667.c
tests/libtest/lib668.c
tests/libtest/lib670.c
tests/libtest/lib674.c
tests/libtest/lib676.c
tests/libtest/lib677.c
tests/libtest/lib678.c
tests/libtest/libauthretry.c
tests/libtest/libntlmconnect.c
tests/libtest/libprereq.c
tests/libtest/mk-lib1521.pl
tests/libtest/test.h
tests/unit/curlcheck.h
tests/unit/unit1303.c
tests/unit/unit1308.c
tests/unit/unit1603.c
tests/unit/unit1620.c
tests/unit/unit1650.c
tests/unit/unit1660.c
tests/unit/unit2604.c
tests/unit/unit3200.c

index 42c53c694102af74f420cc693658e6ca9e7340b9..0c500391ee58f121f23c532a769037f4c41ea396 100644 (file)
@@ -136,7 +136,7 @@ char *hexdump(const unsigned char *buffer, size_t len)
 int main(int argc, char **argv)
 {
   char *URL;
-  int result;
+  CURLcode result;
 
 #ifdef O_BINARY
 #  ifdef __HIGHC__
@@ -185,5 +185,5 @@ int main(int argc, char **argv)
 
   /* Regular program status codes are limited to 0..127 and 126 and 127 have
    * special meanings by the shell, so limit a normal return code to 125 */
-  return result <= 125 ? result : 125;
+  return (int)result <= 125 ? (int)result : 125;
 }
index b512ef67a9bb82fa5d15660c5d476c0b08a28afc..3b1309a8b379db10871d559aada174b7dd4cfaf2 100644 (file)
@@ -131,7 +131,7 @@ test_cleanup:
 /* for debugging: */
 /* #define SINGLETEST 9 */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -162,12 +162,12 @@ int test(char *URL)
 
   curl_global_cleanup();
   printf("%d\n", status);
-  return status;
+  return (CURLcode)status;
 
 test_cleanup:
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index f63b94ccda2291ffa2906f3a306c082a16411685..de3aaeac6a9ea62a8c5038cbfed32268210c0545 100644 (file)
     if(!(expr)) {                                          \
       fprintf(stderr, "%s:%d Assertion '%s' failed: %s\n", \
               __FILE__, __LINE__, #expr, msg);             \
-      return 1;                                            \
+      return (CURLcode)1;                                  \
     }                                                      \
   } while(0)
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   int rc;
   (void)URL;
@@ -58,5 +58,5 @@ int test(char *URL)
   rc = curl_strnequal("ii", "II", 3);
   fail_unless(rc != 0, "return code should be non-zero");
 
-  return 0;
+  return CURLE_OK;
 }
index 3f237a03166062deafd65bea629fab19bc75ee71..9f4ff07eac017008d43b237a2fbf3f980f526e7f 100644 (file)
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
   CURLM *multi = NULL;
   int still_running;
-  int i = TEST_ERR_FAILURE;
-  int res = 0;
+  CURLcode i = TEST_ERR_FAILURE;
+  CURLcode res = CURLE_OK;
   CURLMsg *msg;
 
   start_test_timing();
@@ -56,10 +56,11 @@ int test(char *URL)
   abort_on_test_timeout();
 
   while(still_running) {
+    CURLMcode mres;
     int num;
-    res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
-    if(res != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", res);
+    mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
+    if(mres != CURLM_OK) {
+      printf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index a4816c777c1ce9392cf05b7d505539523f859ffb..ced1d5d987f09b4d27fad47956be285f0f69f5db 100644 (file)
    to allow old and slow machines to run this test too */
 #define MAX_BLOCKED_TIME_MS 500
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *handle = NULL;
   CURLM *mhandle = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int still_running = 0;
 
   start_test_timing();
@@ -96,7 +96,7 @@ int test(char *URL)
     fprintf(stderr, "pong = %ld\n", e);
 
     if(e > MAX_BLOCKED_TIME_MS) {
-      res = 100;
+      res = (CURLcode) 100;
       break;
     }
   }
index 2e2415b72395c1e80d2a830bc8d4aee64b2268fc..d4ebdf50157252a2f57a21daa5b5e6f5436b512d 100644 (file)
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   CURL *dup;
   CURLM *multi = NULL;
   int still_running;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   char redirect[160];
 
index a1a72b2a1fd19622dcfe92ed8c16d68e1d6e9145..2dbda6d0d07060661b0ad17f30834fb6a6592546 100644 (file)
@@ -31,9 +31,9 @@
 
 #define NUM_HANDLES 4
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl[NUM_HANDLES] = {0};
   int running;
   CURLM *m = NULL;
index d23e0b18453dcad96c6c5492dcecf8c49c9e8b91..fc788459cd66a5bf087c0f6e640ef711f42f117e 100644 (file)
@@ -47,9 +47,9 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return CURL_READFUNC_ABORT;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-   int res = 0;
+   CURLcode res = CURLE_OK;
    CURL *curl = NULL;
    CURLM *mcurl = NULL;
    int still_running = 1;
index 9810391371250f21778bd95b422d7bc9e4eed028..bece5fc927446d875ac8234e9b657f7aff83c68d 100644 (file)
@@ -27,9 +27,9 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURLM *m = NULL;
 
   (void)URL;
index 2277e6cee0dadec0ffefb91ad65b3e1014e265d1..d60f2500688ff365dd342fa66c296e4bcee94a90 100644 (file)
@@ -32,12 +32,12 @@ size_t WriteHeader(void *ptr, size_t size, size_t nmemb, void *stream);
 
 static unsigned long realHeaderSize = 0;
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   long headerSize;
   CURLcode code;
   CURL *curl = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
@@ -57,7 +57,7 @@ int test(char *URL)
   if(CURLE_OK != code) {
     fprintf(stderr, "%s:%d curl_easy_perform() failed, "
             "with code %d (%s)\n",
-            __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+            __FILE__, __LINE__, code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -66,7 +66,7 @@ int test(char *URL)
   if(CURLE_OK != code) {
     fprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
             "with code %d (%s)\n",
-            __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+            __FILE__, __LINE__, code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 927927e492bebc0042feacfc45e6c5cf6fa2b334..b3764b8b64ee962760cbd78c3df03a15980a93cd 100644 (file)
@@ -31,9 +31,9 @@
 
 #define NUM_URLS 4
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;
   int i;
   char target_url[256];
index d093a5bd2e54b8bf38f570212df143e0524eedcd..abc1356e5b54860c511f82079a0359c702745663 100644 (file)
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   long unmet;
   CURL *curl = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index 670781982728c84b68e548a7127d36f00eda0e8e..a93bfc029a3018ece53a738f058deb12a5d1ed16 100644 (file)
@@ -34,9 +34,9 @@
 
 #define NUM_HANDLES 2
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl[NUM_HANDLES] = {NULL, NULL};
   char *port = libtest_arg3;
   char *address = libtest_arg2;
index 19c23c06ee7fab29b2b96ee66c4ce576b9df5fdf..392e6c6121f5f76320ded4e8dfb87f0714e9f734 100644 (file)
@@ -47,10 +47,10 @@ static int progressKiller(void *arg,
   return 1;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index 6582b5977addf3a066d64195708cc70bab8f1a54..496fffc8bd776ab930822e1745aed986c9668c51 100644 (file)
@@ -54,11 +54,11 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode result = CURLE_OK;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   struct WriteThis pooh = { data, sizeof(data)-1 };
 
   global_init(CURL_GLOBAL_ALL);
@@ -82,5 +82,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)result;
+  return result;
 }
index d210ed3bed31f832e3cf26ecf4639eef6f3b0382..5d762513d55633fd7f4853c56c005db0f82f6db7 100644 (file)
@@ -49,12 +49,12 @@ static int debug_callback(CURL *curl, curl_infotype info, char *msg,
   return 0;
 }
 
-static int do_one_request(CURLM *m, char *URL, char *resolve)
+static CURLcode do_one_request(CURLM *m, char *URL, char *resolve)
 {
   CURL *curls;
   struct curl_slist *resolve_list = NULL;
   int still_running;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURLMsg *msg;
   int msgs_left;
 
@@ -110,10 +110,10 @@ test_cleanup:
   return res;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *multi = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   char *address = libtest_arg2;
   char *port = libtest_arg3;
   char *path = URL;
@@ -136,8 +136,9 @@ int test(char *URL)
 
     /* second request must succeed like the first one */
     res = do_one_request(multi, target_url, dns_entry);
-    if(res)
+    if(res != CURLE_OK) {
       goto test_cleanup;
+    }
 
     if(i < count)
       sleep(DNS_TIMEOUT + 1);
@@ -148,5 +149,5 @@ test_cleanup:
   curl_multi_cleanup(multi);
   curl_global_cleanup();
 
-  return (int) res;
+  return res;
 }
index 126792017ad1b12a2d4cd962ee0b561f3a08c476..94ebc49d229095a7c6779cd92469f352c17a5509 100644 (file)
@@ -53,7 +53,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return tocopy;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -64,9 +64,9 @@ int test(char *URL)
 #if (defined(_WIN32) || defined(__CYGWIN__))
     printf("Windows TCP does not deliver response data but reports "
            "CONNABORTED\n");
-    return 1; /* skip since test will fail on Windows without workaround */
+    return (CURLcode)1; /* skip since it fails on Windows without workaround */
 #else
-    return 0; /* sure, run this! */
+    return CURLE_OK; /* sure, run this! */
 #endif
   }
 
index aa0de41550cb059f4079fadef429811f680a0d5f..560d79ce23f38025a28620888299f8e78a7fee37 100644 (file)
@@ -37,7 +37,7 @@ static size_t writecb(char *buffer, size_t size, size_t nitems,
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -84,13 +84,13 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
 
   printf("res %d\n"
-         "status %d\n"
-         "redirects %d\n"
+         "status %ld\n"
+         "redirects %ld\n"
          "effectiveurl %s\n"
          "redirecturl %s\n",
-         (int)res,
-         (int)curlResponseCode,
-         (int)curlRedirectCount,
+         res,
+         curlResponseCode,
+         curlRedirectCount,
          effectiveUrl,
          redirectUrl ? redirectUrl : "blank");
 
index 5b6c3dcfb15beeb4e328a3f602e39210aa86470d..8e5f6a9be04f48b096de8be5ed57496aa2ff0fd8 100644 (file)
@@ -71,7 +71,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -111,5 +111,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index f5e87e014f4e84d62a4869c9011c2794ce2c4562..3d171009b75589c29db1e21d7cbcceb63a92506d 100644 (file)
@@ -49,7 +49,7 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
   return CURL_SOCKOPT_OK;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode code = TEST_ERR_MAJOR_BAD;
   CURLcode res;
@@ -97,5 +97,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)code;
+  return code;
 }
index 9aa9e3cb48fc5ef517de48815ef5e44b888afd34..529bbf83dc6374e2f2f2768755ad541e9de0058a 100644 (file)
@@ -55,7 +55,7 @@ static CURLcode run(CURL *hnd, long limit, long time)
   return curl_easy_perform(hnd);
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret;
   CURL *hnd;
@@ -81,5 +81,5 @@ int test(char *URL)
   curl_easy_cleanup(hnd);
   curl_global_cleanup();
 
-  return (int)ret;
+  return ret;
 }
index 591eb413fd9d4864f38494addbb96f3763e4465e..d6c24fcce91fe1927dc49d501a8abac1254b223a 100644 (file)
@@ -46,7 +46,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *stream)
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -96,5 +96,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index c11e536ebb1d189ad7f292893294605e8705552c..344028c1102b9bab12e5c73b3cd6c6dbe384b94a 100644 (file)
@@ -44,7 +44,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *stream)
   return strlen(data);
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -101,5 +101,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index e59870585318c3ca6b004dfba1ac0c67bbf3a6ff..931f2555a65c8b57ef1a1f66dfeb25ff07e6352b 100644 (file)
@@ -45,7 +45,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *stream)
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -98,5 +98,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index ae236041489eb539225637d76b0316cacd1fa8b0..396910a5e923a4d0c5b128262338b2f1e953e2ef 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -71,5 +71,5 @@ test_cleanup:
   curl_slist_free_all(phl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 5b0f990fdb43fac26d6db30cd8cb24ddec26b5c8..8a1f52cd36347e209500551959c3d6e8a337fe70 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -59,5 +59,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index e45949294dbff94d0d8813b85f120ee7383c6508..6b86cdb6fd646cd7609c81b694a48c4c9839f99d 100644 (file)
@@ -37,7 +37,7 @@ static curl_socket_t opensocket(void *clientp,
   return CURL_SOCKET_BAD;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -66,5 +66,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index b64e1660359d062b5c8e0f0b1a8472dd3b091d51..f4814f1222f23b5ec8badd43b832ecdc8be0e3f9 100644 (file)
 static char const testData[] = ".abc\0xyz";
 static off_t const testDataSize = sizeof(testData) - 1;
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy;
   CURLM *multi_handle;
   int still_running; /* keep number of running handles */
   CURLMsg *msg; /* for picking up messages with the transfer status */
   int msgs_left; /* how many messages are left */
-  int res = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   start_test_timing();
 
index a3ac70929d97c7fa091c374fab81c1dd5b15b627..22b1aadaa3ae403f33e03ccde778f069e9cb540e 100644 (file)
@@ -27,7 +27,7 @@
 
 /* Test CURLINFO_RESPONSE_CODE */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   long httpcode;
@@ -78,5 +78,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 0c9f8fa95a1fc508302cc5340743a559c162f81b..e1dd16c9ceb67743a531ccc6290e72dee9b4a6e4 100644 (file)
@@ -106,7 +106,7 @@ static int perform_and_check_connections(CURL *curl, const char *description,
 
   res = curl_easy_perform(curl);
   if(res != CURLE_OK) {
-    fprintf(stderr, "curl_easy_perform() failed with %d\n", (int)res);
+    fprintf(stderr, "curl_easy_perform() failed with %d\n", res);
     return TEST_ERR_MAJOR_BAD;
   }
 
@@ -127,11 +127,12 @@ static int perform_and_check_connections(CURL *curl, const char *description,
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   struct cb_data data;
   CURL *curl = NULL;
-  int res = TEST_ERR_FAILURE;
+  CURLcode res = TEST_ERR_FAILURE;
+  int result;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
@@ -157,17 +158,19 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
   test_setopt(curl, CURLOPT_WRITEDATA, &data);
 
-  res = perform_and_check_connections(curl,
+  result = perform_and_check_connections(curl,
     "First request without CURLOPT_KEEP_SENDING_ON_ERROR", 1);
-  if(res != TEST_ERR_SUCCESS) {
+  if(result != TEST_ERR_SUCCESS) {
+    res = (CURLcode) result;
     goto test_cleanup;
   }
 
   reset_data(&data, curl);
 
-  res = perform_and_check_connections(curl,
+  result = perform_and_check_connections(curl,
     "Second request without CURLOPT_KEEP_SENDING_ON_ERROR", 1);
-  if(res != TEST_ERR_SUCCESS) {
+  if(result != TEST_ERR_SUCCESS) {
+    res = (CURLcode) result;
     goto test_cleanup;
   }
 
@@ -175,17 +178,19 @@ int test(char *URL)
 
   reset_data(&data, curl);
 
-  res = perform_and_check_connections(curl,
+  result = perform_and_check_connections(curl,
     "First request with CURLOPT_KEEP_SENDING_ON_ERROR", 1);
-  if(res != TEST_ERR_SUCCESS) {
+  if(result != TEST_ERR_SUCCESS) {
+    res = (CURLcode) result;
     goto test_cleanup;
   }
 
   reset_data(&data, curl);
 
-  res = perform_and_check_connections(curl,
+  result = perform_and_check_connections(curl,
     "Second request with CURLOPT_KEEP_SENDING_ON_ERROR", 0);
-  if(res != TEST_ERR_SUCCESS) {
+  if(result != TEST_ERR_SUCCESS) {
+    res = (CURLcode) result;
     goto test_cleanup;
   }
 
@@ -197,5 +202,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 620e3833850489874dc63a51742262dc66152d83..a9a7d73d857e7bb008b732d8d69f6e4d2db27791 100644 (file)
@@ -27,7 +27,7 @@
 
 /* Test CURLINFO_FILETIME */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl, *dupe = NULL;
   long filetime;
@@ -127,5 +127,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_easy_cleanup(dupe);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 6edf8873120779cc74317bf46c853cd9717022e0..80589d8938fc810d2c79e0483806249b8c56fd6f 100644 (file)
@@ -27,7 +27,7 @@
 
 /* Test CURLINFO_PROTOCOL */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl, *dupe = NULL;
   long protocol;
@@ -134,5 +134,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_easy_cleanup(dupe);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 85e54b06f9b061f0de24958d08d21f14121cd1dd..7bc9e718b6fed9703538e1322a73aa292664ec11 100644 (file)
@@ -27,7 +27,7 @@
 
 /* Test CURLINFO_SCHEME */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl, *dupe = NULL;
   char *scheme;
@@ -127,5 +127,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_easy_cleanup(dupe);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 21252fb7905d29bcd5b4485bb4cd0ca2a7e7558c..9c991e830c87118d9c44293bb392d06a7e2a08a8 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
                              0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
@@ -87,5 +87,5 @@ test_cleanup:
   curl_free(ptr);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index cd9e3f65c6f4e07d482b9b64ccd95b1f80fdb636..ebc68573f1f066a03b3cfcc0ae08dda49204e299 100644 (file)
@@ -25,9 +25,9 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURLcode easyret;
   CURLMcode multiret;
   CURLSHcode shareret;
@@ -56,5 +56,5 @@ int test(char *URL)
     printf("u%d: %s\n", (int)urlret, curl_url_strerror(urlret));
   }
 
-  return (int)res;
+  return res;
 }
index ea1cb1cd1879eb1ac3fe5d9ba9c73fc7295c766a..4c59ef81b4e4dd4a221dbc114fe6333db0b0aade 100644 (file)
@@ -82,10 +82,10 @@ static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *userp)
   return CURL_WRITEFUNC_PAUSE;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   struct transfer_status st;
 
   start_test_timing();
@@ -114,5 +114,5 @@ test_cleanup:
   curl_easy_cleanup(curls);
   curl_global_cleanup();
 
-  return (int)res; /* return the final return code */
+  return res; /* return the final return code */
 }
index fdb8a04b5794289f021a67b5db6a7d686b6defe5..f326211d46efb9093a5e28a5ff1e61939c87c6b0 100644 (file)
@@ -110,10 +110,10 @@ static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *userp)
   return size * nmemb;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   struct transfer_status st;
 
   start_test_timing();
@@ -148,5 +148,5 @@ test_cleanup:
   curl_easy_cleanup(curls);
   curl_global_cleanup();
 
-  return (int)res; /* return the final return code */
+  return res; /* return the final return code */
 }
index 2570ea3cf61f193cb2b4cbdea853013b6783d640..5a8926585d8e6f8a0fdd093c4684f83687decef7 100644 (file)
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index f31baa0c4d6872388ccf7c9795861b2cca39b16d..c101b3eef2f5728450ac512bc54ae6dcfe30bdc6 100644 (file)
 #endif
 #include "test.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *eh = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   struct curl_httppost *lastptr = NULL;
   struct curl_httppost *m_formpost = NULL;
 
index 4c34be86577f9fa9a187cd6b5fe479da75e1aac4..ddc0c16ab5a8602ceface8770d2f280afb21017f 100644 (file)
 
 #include <curl/multi.h>
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *handle;
-  int res = CURLE_OK;
+  CURLcode res = CURLE_OK;
   static const char * const bl_servers[] =
      {"Microsoft-IIS/6.0", "nginx/0.8.54", NULL};
   static const char * const bl_sites[] =
@@ -44,5 +44,5 @@ int test(char *URL)
   curl_multi_setopt(handle, CURLMOPT_PIPELINING_SITE_BL, bl_sites);
   curl_multi_cleanup(handle);
   curl_global_cleanup();
-  return 0;
+  return CURLE_OK;
 }
index 784113aaf3bb97008edc00c44751269c3fb638f7..20e938ece6aa65ddd4a71d04924b875c2552ee75 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <curl/multi.h>
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -49,5 +49,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index c48d640d623a5ae6dd5c70d6f74ba96a4c9eb743..821fba27a37500f2ad370fe00613322e4f9fafcf 100644 (file)
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
   CURLM *multi = NULL;
   int still_running;
-  int i = 0;
-  int res = 0;
+  CURLcode i = CURLE_OK;
+  CURLcode res = CURLE_OK;
   CURLMsg *msg;
   int counter = 3;
 
@@ -59,10 +59,11 @@ int test(char *URL)
   abort_on_test_timeout();
 
   while(still_running && counter--) {
+    CURLMcode mres;
     int num;
-    res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
-    if(res != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", res);
+    mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
+    if(mres != CURLM_OK) {
+      printf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 8bf15684bd497e5311fe4c104d81922b11e5de1a..97053991a915c4ad1f1c4043485518354ec6aca9 100644 (file)
@@ -42,13 +42,13 @@ static int xferinfo(void *p,
   return 1; /* fail as fast as we can */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
   CURLM *multi = NULL;
   int still_running;
-  int i = 0;
-  int res = 0;
+  CURLcode i = CURLE_OK;
+  CURLcode res = CURLE_OK;
   curl_mimepart *field = NULL;
   curl_mime *mime = NULL;
   int counter = 1;
@@ -81,10 +81,11 @@ int test(char *URL)
   abort_on_test_timeout();
 
   while(still_running && counter--) {
+    CURLMcode mres;
     int num;
-    res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
-    if(res != CURLM_OK) {
-      printf("curl_multi_wait() returned %d\n", res);
+    mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
+    if(mres != CURLM_OK) {
+      printf("curl_multi_wait() returned %d\n", mres);
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 181044d057c86c27c00ae16d7fea8692d00ffa0d..4b4d8e4c8c578b97118079b6685a1116b1880fb5 100644 (file)
@@ -43,7 +43,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr)
 }
 
 /* test function */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURLSH *share = NULL;
@@ -91,5 +91,5 @@ test_cleanup:
   curl_share_cleanup(share);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 1ff6f28d5724f59e335f2268ca59f5a66c8488c3..59db1fbdbe3b883b615e32c697817eb45e0d4783 100644 (file)
@@ -53,9 +53,9 @@ static int progressCallback(void *arg,
   return 1;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index 6f8a214391f433493133446ebd12d232cc5e88e0..5b05ff0ef41085e38a518fbbdc51a41cf93715d9 100644 (file)
@@ -44,11 +44,11 @@ static size_t header(void *ptr, size_t size, size_t nmemb, void *stream)
   return nmemb * size;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode code;
   CURL *curl = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   struct headerinfo info = {0};
 
   global_init(CURL_GLOBAL_ALL);
@@ -64,7 +64,7 @@ int test(char *URL)
   if(CURLE_OK != code) {
     fprintf(stderr, "%s:%d curl_easy_perform() failed, "
             "with code %d (%s)\n",
-            __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+            __FILE__, __LINE__, code, curl_easy_strerror(code));
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 2fa34ada37223781c4278c3a80bdb5432e061480..6f0b99ac50daefc59df2f9552dc5800b1ecfb03d 100644 (file)
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *curlm = NULL;
   CURL *curl1 = NULL;
   CURL *curl2 = NULL;
   int running_handles = 0;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index d64b59801a0380e33a0778cff2042016fa578d4c..e3a648f395a8dda6d7047bfee9b3ae7ab03cc746 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *curl = NULL;
@@ -58,7 +58,7 @@ int test(char *URL)
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return 0;
+  return CURLE_OK;
 
 test_cleanup:
 
index 402fee3d0564edefe26c3d705c6ad51ffebdee9e..37c0b8aace4c24e417158b8bc4a7764d6cf82e7e 100644 (file)
@@ -28,7 +28,7 @@
 #include "memdebug.h"
 
 #define EXCESSIVE 10*1000*1000
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *curl = NULL;
@@ -37,7 +37,7 @@ int test(char *URL)
   (void)URL;
 
   if(!longurl)
-    return 1;
+    return (CURLcode)1;
 
   memset(longurl, 'a', EXCESSIVE);
   longurl[EXCESSIVE-1] = 0;
@@ -47,11 +47,11 @@ int test(char *URL)
 
   res = curl_easy_setopt(curl, CURLOPT_URL, longurl);
   printf("CURLOPT_URL %d bytes URL == %d\n",
-         EXCESSIVE, (int)res);
+         EXCESSIVE, res);
 
   res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, longurl);
   printf("CURLOPT_POSTFIELDS %d bytes data == %d\n",
-         EXCESSIVE, (int)res);
+         EXCESSIVE, res);
 
   u = curl_url();
   if(u) {
index 7e44de940dacae994ebbfd2c7bfe859b942446ea..934fc78fd9e90c1fb018ce9338989cb2e5b3fcb5 100644 (file)
@@ -1847,43 +1847,43 @@ err:
   return 1;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   (void)URL; /* not used */
 
   if(urldup())
-    return 11;
+    return (CURLcode)11;
 
   if(setget_parts())
-    return 10;
+    return (CURLcode)10;
 
   if(get_url())
-    return 3;
+    return (CURLcode)3;
 
   if(huge())
-    return 9;
+    return (CURLcode)9;
 
   if(get_nothing())
-    return 7;
+    return (CURLcode)7;
 
   if(scopeid())
-    return 6;
+    return (CURLcode)6;
 
   if(append())
-    return 5;
+    return (CURLcode)5;
 
   if(set_url())
-    return 1;
+    return (CURLcode)1;
 
   if(set_parts())
-    return 2;
+    return (CURLcode)2;
 
   if(get_parts())
-    return 4;
+    return (CURLcode)4;
 
   if(clear_url())
-    return 8;
+    return (CURLcode)8;
 
   printf("success\n");
-  return 0;
+  return CURLE_OK;
 }
index b10d03441419e40ed41a2b45de9226018c425c72..851d02c403fb6bfafa798e7853b79ac1f316bfa3 100644 (file)
 #define TEST_HANG_TIMEOUT 60 * 1000
 #define WAKEUP_NUM 10
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *multi = NULL;
   int numfds;
   int i;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   struct timeval time_before_wait, time_after_wait;
 
   (void)URL;
index 900395147131229d7ce9a196179d24266ee76cd5..7f833868ad6bba2f3212b2f60952b3b405ee9ff2 100644 (file)
@@ -38,7 +38,7 @@
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 static CURL *pending_handles[CONN_NUM];
 static int pending_num = 0;
-static int test_failure = 0;
+static CURLcode test_failure = CURLE_OK;
 
 static CURLM *multi = NULL;
 static const char *url;
@@ -46,7 +46,7 @@ static const char *url;
 static void *run_thread(void *ptr)
 {
   CURL *easy = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int i;
 
   (void)ptr;
@@ -89,12 +89,13 @@ test_cleanup:
   return NULL;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   int still_running;
   int num;
   int i;
-  int res = 0;
+  int result;
+  CURLcode res = CURLE_OK;
   CURL *started_handles[CONN_NUM];
   int started_num = 0;
   int finished_num = 0;
@@ -110,12 +111,12 @@ int test(char *URL)
 
   url = URL;
 
-  res = pthread_create(&tid, NULL, run_thread, NULL);
-  if(!res)
+  result = pthread_create(&tid, NULL, run_thread, NULL);
+  if(!result)
     tid_valid = true;
   else {
     fprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
-            __FILE__, __LINE__, res);
+            __FILE__, __LINE__, result);
     goto test_cleanup;
   }
 
@@ -201,7 +202,7 @@ test_cleanup:
 }
 
 #else /* without pthread, this test doesn't work */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   (void)URL;
   return 0;
index 26b438dd09e0ac49b35a3880f9f9bc28a2c673e5..fae8cc12e8f72d488f14923e9aa1dbfc4c0943ea 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <curl/multi.h>
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_OK;
@@ -55,5 +55,5 @@ test_cleanup:
   curl_url_cleanup(u);
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 78e7e6b8a5460d78402d7bf9084d3e402c18182b..383d517a47501648219b327c80f47df40d9fccdb 100644 (file)
@@ -26,7 +26,7 @@
 #include "testtrace.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret;
   CURL *hnd;
@@ -48,5 +48,5 @@ int test(char *URL)
   hnd = NULL;
 
   curl_global_cleanup();
-  return (int)ret;
+  return ret;
 }
index e24a387e33d1823b54ce745d41c0debf4727e192..767d8816822bd326503be1bd6d7a3c7f6907102f 100644 (file)
@@ -26,7 +26,7 @@
 #include "testtrace.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *hnd;
@@ -47,5 +47,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(hnd);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 5701e10a9bcbbcda39948cc9e0c564550b25eefa..0a361ada16b692fa04b6713a33167a9248832ec5 100644 (file)
@@ -73,7 +73,7 @@ static int trailers_callback(struct curl_slist **list, void *userdata)
   }
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -116,5 +116,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 974dd256c1bc79b67516f4ea4331a4c4577fda32..ebfcf74b5c132f3fa0819f52359e120cefa75774 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <sys/stat.h>
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   int stillRunning;
   CURLM *multiHandle = NULL;
@@ -103,8 +103,7 @@ int test(char *URL)
   start_test_timing();
   mres = curl_multi_remove_handle(multiHandle, curl);
   if(mres) {
-    fprintf(stderr, "curl_multi_remove_handle() failed, "
-            "with code %d\n", (int)res);
+    fprintf(stderr, "curl_multi_remove_handle() failed, with code %d\n", mres);
     res = TEST_ERR_MULTI;
     goto test_cleanup;
   }
@@ -120,5 +119,5 @@ test_cleanup:
   curl_multi_cleanup(multiHandle);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index b0a91b9fd5e3cf0dd924c0afbe3b53c9742a7ce9..f5239fda4b7a84b6371eef223d3ef632e2c2817c 100644 (file)
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   struct curl_slist *header = NULL;
   long unmet;
   CURL *curl = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index 5346c662a785889fe2d02bae6ffc0c65aec08aa9..bf25ffbeb50a4309034514a4a9656c773d2a0b53 100644 (file)
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   struct curl_slist *header = NULL;
   curl_off_t retry;
   CURL *curl = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_ALL);
 
index 44769f9cfeccecd4195dbb4b175f15b275531cc2..fa09e71d6cb398734ac07324650eee6e20533f20 100644 (file)
@@ -33,10 +33,10 @@ struct pair {
   CURLcode *exp;
 };
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURLcode result = CURLE_OK;
   curl_version_info_data *curlinfo;
   const char *const *proto;
@@ -77,7 +77,7 @@ int test(char *URL)
   curlinfo = curl_version_info(CURLVERSION_NOW);
   if(!curlinfo) {
     fputs("curl_version_info failed\n", stderr);
-    res = (int) TEST_ERR_FAILURE;
+    res = TEST_ERR_FAILURE;
     goto test_cleanup;
   }
 
@@ -85,7 +85,7 @@ int test(char *URL)
   for(proto = curlinfo->protocols; *proto; proto++) {
     if((size_t) n >= sizeof(protolist)) {
       puts("protolist buffer too small\n");
-      res = (int) TEST_ERR_FAILURE;
+      res = TEST_ERR_FAILURE;
       goto test_cleanup;
     }
     n += msnprintf(protolist + n, sizeof(protolist) - n, ",%s", *proto);
@@ -99,17 +99,15 @@ int test(char *URL)
   for(i = 0; prots[i].in; i++) {
     result = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, prots[i].in);
     if(result != *prots[i].exp) {
-      printf("unexpectedly '%s' returned %u\n",
-             prots[i].in, result);
+      printf("unexpectedly '%s' returned %d\n", prots[i].in, result);
       break;
     }
   }
   printf("Tested %u strings\n", i);
-  res = (int)result;
 
 test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)result;
+  return result;
 }
index c099116a86a144b462969360bf7844c1e1b46af7..904ba65b0ed85745fa7e2208dcd5f3dd752275b1 100644 (file)
@@ -54,7 +54,7 @@ static int trailers_callback(struct curl_slist **list, void *userdata)
 
 static const char *post_data = "xxx=yyy&aaa=bbbbb";
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_FAILED_INIT;
@@ -103,5 +103,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 93c0800330a35fd94b0b5b5679f343a9f5485daa..91c02fce0541771b356343d9ca852aee93a2cc58 100644 (file)
@@ -47,7 +47,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *hnd;
@@ -86,5 +86,5 @@ int test(char *URL)
   curl_easy_cleanup(hnd);
   curl_mime_free(mime1);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 92f89c4c484b8e5b121763142dc711632389bfc9..1b26e7b9867842fa66e44148d83c0199d5ce3c35 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *hnd = NULL;
@@ -45,11 +45,11 @@ int test(char *URL)
   curl_easy_cleanup(hnd);
   curl_easy_cleanup(second);
   curl_global_cleanup();
-  return 0;
+  return CURLE_OK;
 
 test_cleanup:
   curl_easy_cleanup(hnd);
   curl_easy_cleanup(second);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 8835c6b869453981fba13b97df57b84534bbdd6e..314f0354d8ffd16169f9b4589961d61c9401efef 100644 (file)
@@ -53,7 +53,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *stream)
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -91,5 +91,5 @@ test_cleanup:
   curl_slist_free_all(chunk);
 
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 3c4ae3073451d4b2ec5b1aa8f19ed87b0022f235..0ffbb14adc2de3cdbb3b716d33cae5f001fbf5ea 100644 (file)
@@ -28,7 +28,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *ch = NULL;
@@ -53,5 +53,5 @@ test_cleanup:
   curl_easy_cleanup(ch);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 62b9c60cde901003baf82da2ce16aec3f37c81ac..bba0400cbbcc45362a64e10d2f724c6305a88392 100644 (file)
@@ -28,7 +28,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLSH *sh = NULL;
   CURL *ch = NULL;
@@ -40,7 +40,7 @@ int test(char *URL)
   cm = curl_multi_init();
   if(!cm) {
     curl_global_cleanup();
-    return 1;
+    return (CURLcode)1;
   }
   sh = curl_share_init();
   if(!sh)
@@ -96,5 +96,5 @@ cleanup:
   curl_multi_cleanup(cm);
   curl_global_cleanup();
 
-  return 0;
+  return CURLE_OK;
 }
index b60587f8fa8b5d56838a991281df8723e063499d..fded3bfb17d072d24d35757299e2070955f88c1b 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   char *url_after = NULL;
@@ -49,7 +49,7 @@ int test(char *URL)
   if(res != CURLE_COULDNT_CONNECT && res != CURLE_OPERATION_TIMEDOUT) {
     fprintf(stderr, "failure expected, "
             "curl_easy_perform returned %d: <%s>, <%s>\n",
-            (int) res, curl_easy_strerror(res), error_buffer);
+            res, curl_easy_strerror(res), error_buffer);
     if(res == CURLE_OK)
       res = TEST_ERR_MAJOR_BAD;  /* force an error return */
     goto test_cleanup;
@@ -68,8 +68,8 @@ int test(char *URL)
   res = curl_easy_perform(curl);
   if(res)
     fprintf(stderr, "success expected, "
-            "curl_easy_perform returned %ld: <%s>, <%s>\n",
-            (long) res, curl_easy_strerror(res), error_buffer);
+            "curl_easy_perform returned %d: <%s>, <%s>\n",
+            res, curl_easy_strerror(res), error_buffer);
 
   /* print url */
   curl_url_get(curlu, CURLUPART_URL, &url_after, 0);
@@ -81,5 +81,5 @@ test_cleanup:
   curl_url_cleanup(curlu);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 41cea379e024d0c5e66d3c11f9495d02d8775d7d..82026f23cd62bf6b352e3a1ddba365b38656c2c4 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   char *url_after;
   CURL *curl;
@@ -52,5 +52,5 @@ int test(char *URL)
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index ff92dafb4b8af3202fb269ef6e7a663819733f12..3c7187c5bc0884469583c65c25c681a917bdca5c 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret = CURLE_OK;
   CURL *hnd;
@@ -60,5 +60,5 @@ int test(char *URL)
     curl_easy_cleanup(hnd);
   }
   curl_global_cleanup();
-  return (int)ret;
+  return ret;
 }
index fed1ca22b36819fa125727173a6681cef7ca5cb9..9d3f1b3ab0ed6dff3939882a138071579b5e67c7 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret = CURLE_OK;
   CURL *hnd;
@@ -45,5 +45,5 @@ int test(char *URL)
     curl_easy_cleanup(hnd);
   }
   curl_global_cleanup();
-  return (int)ret;
+  return ret;
 }
index b7c50fc5eb81e58e9fb220731c9ee3ec7dab944d..625ec262a7511259c9a4e9c09800a4e44aef70c2 100644 (file)
@@ -33,7 +33,7 @@
 
 static char buffer[MAX_INPUT_LENGTH + 2];
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   const struct curl_easyoption *o;
   CURL *easy;
@@ -44,7 +44,7 @@ int test(char *URL)
   easy = curl_easy_init();
   if(!easy) {
     curl_global_cleanup();
-    return 1;
+    return (CURLcode)1;
   }
 
   /* make it a null-terminated C string with just As */
@@ -86,7 +86,7 @@ int test(char *URL)
       default:
         /* all other return codes are unexpected */
         fprintf(stderr, "curl_easy_setopt(%s...) returned %d\n",
-                o->name, (int)result);
+                o->name, result);
         error++;
         break;
       }
@@ -94,5 +94,5 @@ int test(char *URL)
   }
   curl_easy_cleanup(easy);
   curl_global_cleanup();
-  return error;
+  return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
 }
index 13f25bc993dbb44338d701831a3e90d8c504c790..b6667c004146f5e428fb34fa6081abc78096bf6d 100644 (file)
@@ -30,7 +30,7 @@
 #define print_err(name, exp) \
   fprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", name, exp);
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
 /* Only test if GCC typechecking is available */
   int error = 0;
@@ -80,5 +80,5 @@ int test(char *URL)
   }
 #endif
   (void)URL;
-  return error;
+  return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
 }
index a283863683308efc10b7a8188ed8a47d678fe816..84684200574f4d78e91b1e4a296eb0e548151cea 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret = CURLE_OK;
   CURL *hnd;
@@ -46,5 +46,5 @@ int test(char *URL)
     curl_easy_cleanup(hnd);
   }
   curl_global_cleanup();
-  return (int)ret;
+  return ret;
 }
index 0672c70d6462a00f65f354af5ecdd6a2b090c84f..35b4d408690f02ef7a4ba2b68075be611773a6a2 100644 (file)
@@ -96,7 +96,7 @@ static CURLSTScode hstswrite(CURL *easy, struct curl_hstsentry *e,
  * Read/write HSTS cache entries via callback.
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *hnd;
@@ -114,7 +114,7 @@ int test(char *URL)
   res = curl_easy_perform(hnd);
   curl_easy_cleanup(hnd);
   hnd = NULL;
-  printf("First request returned %d\n", (int)res);
+  printf("First request returned %d\n", res);
   res = CURLE_OK;
 
   easy_init(hnd);
@@ -127,10 +127,10 @@ int test(char *URL)
   res = curl_easy_perform(hnd);
   curl_easy_cleanup(hnd);
   hnd = NULL;
-  printf("Second request returned %d\n", (int)res);
+  printf("Second request returned %d\n", res);
 
 test_cleanup:
   curl_easy_cleanup(hnd);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index b97263c2e76286e8c538a8f8fc43324004f5f093..36a938b61d99ef5da41c70c62479e404af8c606a 100644 (file)
@@ -26,7 +26,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -52,5 +52,5 @@ int test(char *URL)
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 34c360889775fb7b65afde861f1ad2cc98e4a149..7eaf41bd4f03c3d314cf9ca70978b203470f53bc 100644 (file)
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   const struct curl_easyoption *o;
-  int error = 0;
   (void)URL;
 
   curl_global_init(CURL_GLOBAL_ALL);
@@ -53,5 +52,5 @@ int test(char *URL)
     }
   }
   curl_global_cleanup();
-  return error;
+  return CURLE_OK;
 }
index 37457c0682d1c6776edc615ee0d6ea37918fa463..68ce7a194bcc808baf6f8526a0b60852e4fb79c0 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *curl;
@@ -52,5 +52,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index cc3af078fc6954fd31b7345e6072a212b555a5b8..554756c3ca4b52c390dca8932fcadc6fa0dbe289 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 36fc8f70337814b745522e35dbb8821dea543dbc..6257759fe33084eb04a5f553fe7b2447568e7c69 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index ee52d44153002d2c340eadab33df2d566cc0ca6f..8800916c8696762911ac440471813bd6eaf99491 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index b86eee7bd64713339ba66265f6c8f5bb269de7da..c136fc0a25d989f5511576235307bc2801e8d6e3 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 74249666e700343e29e1b78a681092fea5864ca8..61f71127b4861837754db8f7e356498c3b22071a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 4b5218bdb87ec002e3caee37c1913f537d09965f..02ab6cc20192ca9df7efca606c66b7bb3d4b3751 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 4adc876693396718d406d043a96a5f7baf458473..c7365e5fec5d7ef9f232d6584f0621eda39f6485 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *multi;
   CURL *easy;
index 05da9de3009e9635eb4b278191e4c509f0ccf1f4..7ee523f1506b41f8230f83f9d12e91b61f61aa0d 100644 (file)
@@ -83,7 +83,7 @@ static size_t write_cb(char *data, size_t n, size_t l, void *userp)
   (void)userp;
   return n*l;
 }
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   CURLcode res = CURLE_OK;
@@ -116,5 +116,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(easy);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 2483402f41f4fd4a2c59caf031f0319f3cf45c1b..8cbb01ec6ce16760dbf2f57699adbb6f274af141 100644 (file)
@@ -49,7 +49,7 @@ static size_t write_cb(char *data, size_t n, size_t l, void *userp)
   (void)userp;
   return n*l;
 }
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy;
   CURLcode res = CURLE_OK;
@@ -70,12 +70,12 @@ int test(char *URL)
   }
   res = curl_easy_perform(easy);
   if(res) {
-    printf("badness: %d\n", (int)res);
+    printf("badness: %d\n", res);
   }
   showem(easy, CURLH_CONNECT|CURLH_HEADER|CURLH_TRAILER|CURLH_1XX);
 
 test_cleanup:
   curl_easy_cleanup(easy);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index c81345f9db2531bf4a9dd5a1b5823275c4dbba8e..cd14e266196888048d09811dcdfcb43618264bd8 100644 (file)
@@ -33,7 +33,7 @@ static size_t writecb(char *data, size_t n, size_t l, void *userp)
   (void)userp;
   return n*l;
 }
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -88,5 +88,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index a30244c27e04ba85669492995bd9f8211e658ae6..45c7f199bfca5149527f0cd0d8bb2ba90848f45d 100644 (file)
@@ -41,7 +41,7 @@ static size_t put_callback(char *ptr, size_t size, size_t nmemb, void *stream)
   return tocopy;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -74,5 +74,5 @@ int test(char *URL)
 test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index 3328d7ef1ab0a9e5529ea0c9b56d8aba03505c6c..39b5754ad133c302aba83418652978e84e4bb281 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 105418dc89fb16a311cc404bc089936f3f0b3316..669e143931dc23209fff8e1a6669f5956b03205a 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 8397d9d24382b65c20f2d8a4fef32867275d6103..7cc35e42b6decb069247f2cd2a03d7576200a492 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 66b8d5dfd9b1ef2e72df743db9fa425257eef0fe..58b4ea79b17d38dbd7e1d2a654829b27a0f1c280 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 5eee4f01239d73b79492962fea1c168bce028afa..1fbf26c0be50db9f696e6547591ce61186e2cac3 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 9b82128e9be5f09d7049726c16957a6564d823a0..020ee4ba69b4c599fc7ee038bf5fdec4fe73eab2 100644 (file)
@@ -68,7 +68,7 @@ static int sockopt_cb(void *clientp,
 }
 
 /* Expected args: URL IP PORT */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = TEST_ERR_MAJOR_BAD;
@@ -78,7 +78,7 @@ int test(char *URL)
   unsigned short port;
 
   if(!strcmp("check", URL))
-    return 0; /* no output makes it not skipped */
+    return CURLE_OK; /* no output makes it not skipped */
 
   port = (unsigned short)atoi(libtest_arg3);
 
@@ -140,10 +140,10 @@ test_cleanup:
   return res;
 }
 #else
-int test(char *URL)
+CURLcode test(char *URL)
 {
   (void)URL;
   printf("lacks inet_pton\n");
-  return 0;
+  return CURLE_OK;
 }
 #endif
index a9881e98dd16aba0de20876ad04e63979b48b0c1..9e17f926c4c208ed48c588f2f1a02acf1f740f2a 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index ff86fdd2c16f2ed13086fc5a9b177125237198d5..c7013ae1d29a4deed7d7bff7f531ec14ae712d90 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 173fc2f12b55d774683ee7069bafb0ce19ef3784..91d0165008067ed70900282ce93561bdfbc2b970 100644 (file)
@@ -35,7 +35,7 @@ static size_t read_callback(char *buffer, size_t size, size_t nitems,
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index c21e8da937a91820b834a7679c3e3741d2599159..2872218bb2131e70097ee378ed0827aba09e9d01 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   curl_mime *mime = NULL;
index d95744fcb5c7b92e4e28c909e23a3744ea46a218..96974115a228195340ded205aac69596c25ec4d3 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 948d44df9d4087865d33f2f5e5e765c8a233eee7..9f1a40023053c846a02798d9873a9d062b988962 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index bca0c763f8dcf967502868e21eaad5035545d3d8..49bd7201d25736bb407560aa7298c4c8e7ebe762 100644 (file)
@@ -35,7 +35,7 @@ static size_t read_callback(char *buffer, size_t size, size_t nitems,
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index e654f8166b00de4ab5b191481f1d7eff16c0c75e..377228ab3a7b6f78b466512153b6f9a086f63f6d 100644 (file)
 #ifdef USE_WEBSOCKETS
 #if 0
 
-static int ping(CURL *curl, const char *send_payload)
+static CURLcode ping(CURL *curl, const char *send_payload)
 {
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, send_payload, strlen(send_payload), &sent, CURLWS_PING);
   fprintf(stderr,
-          "ws: curl_ws_send returned %u, sent %u\n", (int)result, (int)sent);
+          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 
-  return (int)result;
+  return result;
 }
 
-static int recv_pong(CURL *curl, const char *expected_payload)
+static CURLcode recv_pong(CURL *curl, const char *expected_payload)
 {
   size_t rlen;
   unsigned int rflags;
@@ -58,11 +58,11 @@ static int recv_pong(CURL *curl, const char *expected_payload)
       fprintf(stderr, "ws: did NOT get the same payload back\n");
   }
   else {
-    fprintf(stderr, "recv_pong: got %u bytes rflags %x\n", (int)rlen, rflags);
+    fprintf(stderr, "recv_pong: got %d bytes rflags %x\n", (int)rlen, rflags);
   }
-  fprintf(stderr, "ws: curl_ws_recv returned %u, received %u\n", (int)result,
-         rlen);
-  return (int)result;
+  fprintf(stderr, "ws: curl_ws_recv returned %d, received %d\n", result,
+          (int)rlen);
+  return result;
 }
 
 /* just close the connection */
@@ -72,7 +72,7 @@ static void websocket_close(CURL *curl)
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, CURLWS_CLOSE);
   fprintf(stderr,
-          "ws: curl_ws_send returned %u, sent %u\n", (int)result, (int)sent);
+          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 }
 
 static void websocket(CURL *curl)
@@ -101,7 +101,7 @@ static size_t writecb(char *b, size_t size, size_t nitems, void *p)
     0x8a, 0x0
   };
   size_t incoming = nitems;
-  fprintf(stderr, "Called CURLOPT_WRITEFUNCTION with %u bytes: ",
+  fprintf(stderr, "Called CURLOPT_WRITEFUNCTION with %d bytes: ",
           (int)nitems);
   for(i = 0; i < nitems; i++)
     fprintf(stderr, "%02x ", (unsigned char)buffer[i]);
@@ -119,7 +119,7 @@ static size_t writecb(char *b, size_t size, size_t nitems, void *p)
   return nitems;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -137,7 +137,7 @@ int test(char *URL)
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, curl);
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %u\n", (int)res);
+    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
 #if 0
     if(res == CURLE_OK)
       websocket(curl);
@@ -146,7 +146,7 @@ int test(char *URL)
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
 
 #else /* no websockets */
index 9e2b80044196eff45b65ae6659026a88e22a5f44..f3c05965cace9fd163705bc4d96bcb363aab6e06 100644 (file)
@@ -91,7 +91,7 @@ static size_t writecb(char *buffer, size_t size, size_t nitems, void *p)
   return nitems;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -112,13 +112,13 @@ int test(char *URL)
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writecb);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ws_data);
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %u\n", (int)res);
+    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
     /* always cleanup */
     curl_easy_cleanup(curl);
     flush_data(&ws_data);
   }
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
 
 #else
index a8ee87548a201e21217a0bfc629abb2fae4c4065..57329c4c7594925dfd7a7d6cd1d5ab2e2f9b30ef 100644 (file)
 
 #ifdef USE_WEBSOCKETS
 
-static int ping(CURL *curl, const char *send_payload)
+static CURLcode ping(CURL *curl, const char *send_payload)
 {
   size_t sent;
   CURLcode result =
     curl_ws_send(curl, send_payload, strlen(send_payload), &sent, 0,
                  CURLWS_PING);
   fprintf(stderr,
-          "ws: curl_ws_send returned %u, sent %u\n", (int)result, (int)sent);
+          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 
-  return (int)result;
+  return result;
 }
 
-static int recv_pong(CURL *curl, const char *expected_payload)
+static CURLcode recv_pong(CURL *curl, const char *expected_payload)
 {
   size_t rlen;
   const struct curl_ws_frame *meta;
@@ -58,16 +58,16 @@ static int recv_pong(CURL *curl, const char *expected_payload)
         fprintf(stderr, "ws: did NOT get the same payload back\n");
     }
     else {
-      fprintf(stderr, "recv_pong: got %u bytes rflags %x\n", (int)rlen,
+      fprintf(stderr, "recv_pong: got %d bytes rflags %x\n", (int)rlen,
               meta->flags);
     }
   }
-  fprintf(stderr, "ws: curl_ws_recv returned %u, received %u\n", (int)result,
+  fprintf(stderr, "ws: curl_ws_recv returned %d, received %d\n", result,
           (int)rlen);
-  return (int)result;
+  return result;
 }
 
-static int recv_any(CURL *curl)
+static CURLcode recv_any(CURL *curl)
 {
   size_t rlen;
   const struct curl_ws_frame *meta;
@@ -78,7 +78,7 @@ static int recv_any(CURL *curl)
 
   fprintf(stderr, "recv_any: got %u bytes rflags %x\n", (int)rlen,
           meta->flags);
-  return 0;
+  return CURLE_OK;
 }
 
 /* just close the connection */
@@ -88,7 +88,7 @@ static void websocket_close(CURL *curl)
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
   fprintf(stderr,
-          "ws: curl_ws_send returned %u, sent %u\n", (int)result, (int)sent);
+          "ws: curl_ws_send returned %d, sent %u\n", result, (int)sent);
 }
 
 static void websocket(CURL *curl)
@@ -110,7 +110,7 @@ static void websocket(CURL *curl)
   websocket_close(curl);
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -126,7 +126,7 @@ int test(char *URL)
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %u\n", (int)res);
+    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
     if(res == CURLE_OK)
       websocket(curl);
 
@@ -134,7 +134,7 @@ int test(char *URL)
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
 
 #else
index 374423f0fcbc3595ba23df6cfe4c56019693c582..5ccb9bfa6125f0840589672ac67d263a65aea476 100644 (file)
@@ -34,7 +34,7 @@ static void websocket_close(CURL *curl)
   CURLcode result =
     curl_ws_send(curl, "", 0, &sent, 0, CURLWS_CLOSE);
   fprintf(stderr,
-          "ws: curl_ws_send returned %u, sent %u\n", (int)result, (int)sent);
+          "ws: curl_ws_send returned %d, sent %d\n", result, (int)sent);
 }
 
 static void websocket(CURL *curl)
@@ -55,10 +55,10 @@ static void websocket(CURL *curl)
       if(result == CURLE_AGAIN)
         /* crude busy-loop */
         continue;
-      printf("curl_ws_recv returned %d\n", (int)result);
+      printf("curl_ws_recv returned %d\n", result);
       return;
     }
-    printf("%u: nread %zu Age %u Flags %x "
+    printf("%d: nread %zu Age %d Flags %x "
            "Offset %" CURL_FORMAT_CURL_OFF_T " "
            "Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
            (int)i,
@@ -71,7 +71,7 @@ static void websocket(CURL *curl)
   websocket_close(curl);
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -91,7 +91,7 @@ int test(char *URL)
     curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
     res = curl_easy_perform(curl);
-    fprintf(stderr, "curl_easy_perform() returned %u\n", (int)res);
+    fprintf(stderr, "curl_easy_perform() returned %d\n", res);
     if(res == CURLE_OK)
       websocket(curl);
 
@@ -99,7 +99,7 @@ int test(char *URL)
     curl_easy_cleanup(curl);
   }
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
 
 #else
index 839bdcc0a6d43a6c770f6a90ed47893013f3c771..cde75193315892531ed28d5198abec50f41d1f55 100644 (file)
@@ -29,7 +29,7 @@
 
 #define URL2 libtest_arg2
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   /* first a fine GET response, then a bad one */
   CURL *cl;
index ab20f92c031d8dcc7eebe8a3368679951adda96d..c58946bb1bbfad6936e5985bb58adba46a583fd0 100644 (file)
@@ -31,9 +31,9 @@
 
 #define NUM_HANDLES 4
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl[NUM_HANDLES] = {0};
   int running;
   CURLM *m = NULL;
index 1a282ffe2af8c68d3cc6a9ee2157619361b7a579..ed47d42578bcff8a3a2a48dc3dc5995d053453ba 100644 (file)
@@ -31,9 +31,9 @@
 
 #define NUM_HANDLES 4
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl[NUM_HANDLES] = {0};
   int running;
   CURLM *m = NULL;
index a4a7fd3631796986b0485964bea2e8700455c9a1..5b01cd8ce7afd27604ed1a7a7a035c3a353150dc 100644 (file)
@@ -73,9 +73,9 @@ static size_t emptyWriteFunc(void *ptr, size_t size, size_t nmemb,
   return size * nmemb;
 }
 
-static int set_easy(char *URL, CURL *easy, long option)
+static CURLcode set_easy(char *URL, CURL *easy, long option)
 {
-  int res = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   /* First set the URL that is about to receive our POST. */
   easy_setopt(easy, CURLOPT_URL, URL);
@@ -115,7 +115,7 @@ test_cleanup:
   return res;
 }
 
-static int test_run(char *URL, long option, unsigned int *max_fd_count)
+static CURLcode test_run(char *URL, long option, unsigned int *max_fd_count)
 {
   CURLMcode mc = CURLM_OK;
   CURLM *multi = NULL;
@@ -131,7 +131,7 @@ static int test_run(char *URL, long option, unsigned int *max_fd_count)
   int msgs_left; /* how many messages are left */
 
   CURLcode result;
-  int res = CURLE_OK;
+  CURLcode res = CURLE_OK;
 
   struct curl_waitfd ufds[10];
   struct curl_waitfd ufds1[10];
@@ -205,7 +205,7 @@ static int test_run(char *URL, long option, unsigned int *max_fd_count)
       result = msg->data.result;
 
       if(!res)
-        res = (int)result;
+        res = result;
     }
   }
 
@@ -221,10 +221,11 @@ test_cleanup:
 
   if(max_fd_count)
     *max_fd_count = max_count;
+
   return res;
 }
 
-static int empty_multi_test(void)
+static CURLcode empty_multi_test(void)
 {
   CURLMcode mc = CURLM_OK;
   CURLM *multi = NULL;
@@ -232,7 +233,7 @@ static int empty_multi_test(void)
 
   struct curl_waitfd ufds[10];
 
-  int res = CURLE_OK;
+  CURLcode res = CURLE_OK;
   unsigned int fd_count = 0;
 
   multi_init(multi);
@@ -282,9 +283,9 @@ test_cleanup:
   return res;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = CURLE_OK;
+  CURLcode res = CURLE_OK;
   unsigned int fd_count = 0;
 
   global_init(CURL_GLOBAL_ALL);
index e5a7061b084d676ca39cea4f39358cb38be46256..eaaff258adc016d412f8cc9d614c6b947143c99c 100644 (file)
@@ -31,9 +31,9 @@
 
 #define NUM_HANDLES 4
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl[NUM_HANDLES] = {0};
   int running;
   CURLM *m = NULL;
index 598b79fcc9274a3af8fb1dbbc545a130fe1dbdfe..ce0fa30505eef86c90e3a5bd76c501b4073faba2 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret = CURLE_OK;
   CURL *curl = NULL;
index f3e3f920846ba470da34a828c6422246a537af51..80f80eae01e64bfab8af21ea5691eb22b207d304 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -57,5 +57,5 @@ test_cleanup:
   curl_slist_free_all(icy);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 6f31dabdef2ecf8bfb92466eb05cf5ae0ff66e94..7e914010e22a468e8adcc8ad07d8c80a3ac04dbd 100644 (file)
@@ -45,7 +45,7 @@ static unsigned int WINAPI run_thread(void *ptr)
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
 #ifdef _WIN32_WCE
   typedef HANDLE curl_win_thread_handle_t;
@@ -64,7 +64,7 @@ int test(char *URL)
     fprintf(stderr, "%s:%d On Windows but the "
             "CURL_VERSION_THREADSAFE feature flag is not set\n",
             __FILE__, __LINE__);
-    return -1;
+    return (CURLcode)-1;
   }
 
   /* On Windows libcurl global init/cleanup calls LoadLibrary/FreeLibrary for
@@ -105,7 +105,7 @@ cleanup:
     }
   }
 
-  return test_failure;
+  return (CURLcode)test_failure;
 }
 
 #elif defined(HAVE_PTHREAD_H)
@@ -123,12 +123,12 @@ static void *run_thread(void *ptr)
   return NULL;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode results[NUM_THREADS];
   pthread_t tids[NUM_THREADS];
   unsigned tid_count = NUM_THREADS, i;
-  int test_failure = 0;
+  CURLcode test_failure = CURLE_OK;
   curl_version_info_data *ver;
   (void) URL;
 
@@ -137,7 +137,7 @@ int test(char *URL)
     fprintf(stderr, "%s:%d Have pthread but the "
             "CURL_VERSION_THREADSAFE feature flag is not set\n",
             __FILE__, __LINE__);
-    return -1;
+    return (CURLcode)-1;
   }
 
   for(i = 0; i < tid_count; i++) {
@@ -148,7 +148,7 @@ int test(char *URL)
       fprintf(stderr, "%s:%d Couldn't create thread, errno %d\n",
               __FILE__, __LINE__, res);
       tid_count = i;
-      test_failure = -1;
+      test_failure = (CURLcode)-1;
       goto cleanup;
     }
   }
@@ -160,7 +160,7 @@ cleanup:
       fprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
               "with code %d (%s)\n", __FILE__, __LINE__,
               i, (int) results[i], curl_easy_strerror(results[i]));
-      test_failure = -1;
+      test_failure = (CURLcode)-1;
     }
   }
 
@@ -168,7 +168,7 @@ cleanup:
 }
 
 #else /* without pthread or Windows, this test doesn't work */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   curl_version_info_data *ver;
   (void)URL;
@@ -178,8 +178,8 @@ int test(char *URL)
     fprintf(stderr, "%s:%d No pthread but the "
             "CURL_VERSION_THREADSAFE feature flag is set\n",
             __FILE__, __LINE__);
-    return -1;
+    return (CURLcode)-1;
   }
-  return 0;
+  return CURLE_OK;
 }
 #endif
index 6808f29fd0997c9f61b4481f4fd82f4f697b49cc..4ddee1b6b29f155f5000bf1e43a69c625c473c5b 100644 (file)
@@ -27,7 +27,7 @@
 #include "warnless.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode ret = CURLE_OK;
   CURL *hnd;
@@ -52,5 +52,5 @@ int test(char *URL)
     curl_easy_cleanup(hnd);
   }
   curl_global_cleanup();
-  return (int)ret;
+  return ret;
 }
index a508d5c7a7430db571755ebb1675d5316cf629f1..82132b9476d4d04e12087024f5d630e78f475b84 100644 (file)
@@ -24,9 +24,9 @@
 #include "test.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
@@ -54,7 +54,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE);
 
   res = curl_easy_perform(curl);
-  if(res != (int)CURLE_OK) {
+  if(res != CURLE_OK) {
     fprintf(stderr, "Failed to send DESCRIBE: %d\n", res);
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
index dbcf3a6c7565598d634d8290c52ac90c0c86cde6..3f2e97711aa022d33401826d9f3b9a78f43d829b 100644 (file)
@@ -24,9 +24,9 @@
 #include "test.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
@@ -51,7 +51,7 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, "https");
 
   res = curl_easy_perform(curl);
-  if(res != (int)CURLE_OK) {
+  if(res != CURLE_OK) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index abc0a27eab2df59c463a40aa2db438deaeef7085..7f1b0562720f1b335c2e9173a310cfd750ac2bdb 100644 (file)
@@ -88,7 +88,7 @@ static size_t wrfu(void *ptr,  size_t  size,  size_t  nmemb,  void *stream)
   return size * nmemb;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 01d62f6583a97b64c0515414694df21044badacc..8d602849935c0b9404b0a601489faddc0180491d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURLSH *share;
@@ -59,8 +59,8 @@ test_cleanup:
 
   /* always cleanup */
   curl_easy_cleanup(curl);
-    curl_share_cleanup(share);
+  curl_share_cleanup(share);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index f99b244b49d5b75a0176abb0783fee235a44ab8f..b117862903526aa25800ad1604302b65ac000b6f 100644 (file)
@@ -59,7 +59,7 @@ static void setupcallbacks(CURL *curl)
 #endif
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -154,5 +154,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 7ef8501100dec6ed25f13ca20b7feefc8dcdf653..94c9adb482c91ddcabc1efd491e03a952aba1480 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -56,5 +56,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 91f96e6f596d6220d638065041a6aa10c0f1d66d..44ad6f6790210083f5d7dc00c2323fee508882ce 100644 (file)
  * Get a single URL without select().
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *c = NULL;
   CURLM *m = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int running;
 
   start_test_timing();
index c3ea2fc5f898c7c4bb1c206b7f12fe46a7d316ff..cac2a755cbce515cb592a2ebc81041df5e3b04c0 100644 (file)
  * auth info.
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *c = NULL;
   CURLM *m = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int running;
 
   start_test_timing();
index cbe1d57733c63bfabe72f7571ad0bf0c7fe86e9c..984ce279840c131588643afe3f1786d98dfbcb03 100644 (file)
  * Use multi interface to get document over proxy with bad port number.
  * This caused the interface to "hang" in libcurl 7.10.2.
  */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *c = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURLM *m = NULL;
   fd_set rd, wr, exc;
   int running;
index 6c67ed901514fe73737df181b82a8a8041845f08..de383232ca2069f97f6a14e957ca031c05e499ee 100644 (file)
@@ -36,7 +36,7 @@
  * Example based on source code provided by Erick Nuwendam. Thanks!
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 075babec59b57e33acc8af1567274d4062cddca4..9a5e5a2c1e0968e0dc7e04e13bf3841c622bafbc 100644 (file)
@@ -172,9 +172,9 @@ static char *suburl(const char *base, int i)
 
 
 /* test function */
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURLSHcode scode = CURLSHE_OK;
   CURLcode code = CURLE_OK;
   char *url = NULL;
@@ -261,7 +261,7 @@ int test(char *URL)
   curl_easy_cleanup(curl);
 
 
-  res = 0;
+  res = CURLE_OK;
 
   /* start treads */
   for(i = 1; i <= THREADS; i++) {
index be6dd7eeef2d44f24fe20b38bd04f2d27152dc73..a228d08aa4b5f7632867d274763cad6632c5b7b7 100644 (file)
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
   CURLM *multi = NULL;
   int still_running;
-  int i = -1;
-  int res = 0;
+  CURLcode i = (CURLcode)-1;
+  CURLcode res = CURLE_OK;
   CURLMsg *msg;
 
   start_test_timing();
index b793731b34c06170af49534fb8e032e420ed09c1..00bb881d76385c9ed409b1a408cef69703ab83a3 100644 (file)
@@ -49,7 +49,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index cb510ef2144a6676ac3329fc2904802a9805f399..8a03b3b19d679858d48164cc956b1b8e7fb2baba 100644 (file)
@@ -69,7 +69,7 @@ static void custom_free(void *ptr)
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
                        0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
@@ -113,5 +113,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 87a85a55780fe87a207e0b8a57d7aa62cc49bf64..d293112f94ff3c66dbe8fe9063cbfcb489c18445 100644 (file)
@@ -61,7 +61,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index c53224801c9ce7bf3af37d1e0d1b298a81e19412..b357e4d683a53c509f488a4f49a503ca8d953c17 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -54,5 +54,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 706acb2e1a08e926cdb42193d3dc59099df15e30..02e0d487c3e1e7e28131c6e6045b7547d52af3ec 100644 (file)
@@ -28,7 +28,7 @@
 /* Test case code based on source in a bug report filed by James Bursa on
    28 Apr 2004 */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode code;
   int rc = 99;
@@ -72,5 +72,5 @@ int test(char *URL)
   else
     rc = 5;
 
-  return rc;
+  return (CURLcode)rc;
 }
index b381098fb9ed8284a0fa3858707721e824c65894..208245acfa617218c1faab6b33b49e168f15fa83 100644 (file)
@@ -34,7 +34,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return CURL_READFUNC_ABORT;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -81,5 +81,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 0f31c8c4cce4a91b0d7e47b98876254cc6ce8f8b..73877061315edc5f866cf3435ebbb5dc4a5959a1 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -77,5 +77,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 3c744fb953fb6df7006018dcdaf54293a9b217f6..7edfe4e5ed47cdf56359eb14ce4e6976f316050a 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -58,5 +58,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 59abb091aaf09acfb7a6373215706b99f2590748..fc94eaabc0b81d48e9f6dae1571da9dd4b074fc5 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -59,5 +59,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 0d1ea2eb4405c1d7916f6f521c5787a7539aa1d3..e769ae5af5aac84692b4e43078c94631d4d80a90 100644 (file)
@@ -153,7 +153,7 @@ static const struct dcheck dates[] = {
   { NULL, 0 }
 };
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   int i;
   int error = 0;
@@ -169,5 +169,5 @@ int test(char *URL)
     }
   }
 
-  return error;
+  return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
 }
index 28a50b22a31bb348146aab25a688475eba4650e1..ef70e03d687157e4d1c8c917a15b05a4b04ce64b 100644 (file)
@@ -445,7 +445,7 @@ static int rlimit(int keep_open)
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -454,9 +454,9 @@ int test(char *URL)
     /* used by the test script to ask if we can run this test or not */
     if(rlimit(FALSE)) {
       fprintf(stdout, "rlimit problem: %s\n", msgbuff);
-      return 1;
+      return (CURLcode)1;
     }
-    return 0; /* sure, run this! */
+    return CURLE_OK; /* sure, run this! */
   }
 
   if(rlimit(TRUE)) {
@@ -492,12 +492,12 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
 
 #else /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   (void)URL;
   printf("system lacks necessary system function(s)");
index bf950bd456304706775824a15b1a63fb7a5eeee0..fcc8a6a0407dac0ab985eb7ad45df00e0f2bbb71 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -62,5 +62,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 7e5d0abd7eb569a4f5aaf5905aa54e086a7fe680..13257c4706cecbe0ce3ff223a53189865854b11d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -53,5 +53,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index e3611685be5e5d4df51c6407ceb39e5c49ebfe1f..dc884437519efab37b014e7a8d4aa9e4771e89ca 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -54,5 +54,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 86128e6c0b0839aeb87e397c061f34104d675384..5c7338e7c925cf4c33aa40271449514551d98249 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -55,5 +55,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 6b8cc207d02c1f575cbef13d6206ea1c348130b1..ec721bee251152a3bfc5c3b8d24c644c4d4bad4c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -53,5 +53,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 3f8abeef195dd0ffa6548608fd3681c44f540a7c..f64070b56b86a16acd907d982790253bf3823662 100644 (file)
@@ -31,9 +31,9 @@
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;
   FILE *hd_src = NULL;
   int hd;
index 12b65c023fa84db83ef021c7b36579e2feae17a1..5fd81b51eb84189526793b5e60656f3eec4adab7 100644 (file)
@@ -52,9 +52,9 @@
 
 #define NUM_HANDLES 4
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl[NUM_HANDLES];
   int running;
   CURLM *m = NULL;
@@ -163,7 +163,7 @@ test_cleanup:
      cleanup'ed yet, in this case we have to cleanup them or otherwise these
      will be leaked, let's use undocumented cleanup sequence - type UB */
 
-  if(res)
+  if(res != CURLE_OK)
     for(i = 0; i < NUM_HANDLES; i++)
       curl_easy_cleanup(curl[i]);
 
index 0173dd9789e25d6b9f95e3f4af0e90bc831557b6..36a4c8af00d17434c3dbad384857aa6bca5ae214 100644 (file)
@@ -191,7 +191,7 @@ static int checkForCompletion(CURLM *curl, int *success)
     }
     else {
       fprintf(stderr, "Got an unexpected message from curl: %i\n",
-              (int)message->msg);
+              message->msg);
       result = 1;
       *success = 0;
     }
@@ -228,7 +228,7 @@ static void updateFdSet(struct Sockets *sockets, fd_set* fdset,
 }
 
 static int socket_action(CURLM *curl, curl_socket_t s, int evBitmask,
-                               const char *info)
+                         const char *info)
 {
   int numhandles = 0;
   CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
@@ -258,9 +258,9 @@ static int checkFdSet(CURLM *curl,
   return result;
 }
 
-static int testone(char *URL, int timercb, int socketcb)
+static CURLcode testone(char *URL, int timercb, int socketcb)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;  CURLM *m = NULL;
   struct ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
   struct timeval timeout = {-1, 0};
@@ -276,7 +276,7 @@ static int testone(char *URL, int timercb, int socketcb)
   start_test_timing();
 
   res_global_init(CURL_GLOBAL_ALL);
-  if(res)
+  if(res != CURLE_OK)
     return res;
 
   easy_init(curl);
@@ -297,9 +297,10 @@ static int testone(char *URL, int timercb, int socketcb)
 
   multi_add_handle(m, curl);
 
-  res = socket_action(m, CURL_SOCKET_TIMEOUT, 0, "timeout");
-  if(res)
+  if(socket_action(m, CURL_SOCKET_TIMEOUT, 0, "timeout")) {
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
+  }
 
   while(!checkForCompletion(m, &success)) {
     fd_set readSet, writeSet;
@@ -325,18 +326,21 @@ static int testone(char *URL, int timercb, int socketcb)
     select_test((int)maxFd, &readSet, &writeSet, NULL, &tv);
 
     /* Check the sockets for reading / writing */
-    res = checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read");
-    if(res)
+    if(checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read")) {
+      res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
-    res = checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write");
-    if(res)
+    }
+    if(checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write")) {
+      res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
+    }
 
     if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
       /* Curl's timer has elapsed. */
-      res = socket_action(m, CURL_SOCKET_TIMEOUT, 0, "timeout");
-      if(res)
+      if(socket_action(m, CURL_SOCKET_TIMEOUT, 0, "timeout")) {
+        res = TEST_ERR_BAD_TIMEOUT;
         goto test_cleanup;
+      }
     }
 
     abort_on_test_timeout();
@@ -362,9 +366,9 @@ test_cleanup:
   return res;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int rc;
+  CURLcode rc;
   /* rerun the same transfer multiple times and make it fail in different
      callback calls */
   rc = testone(URL, 0, 0);
@@ -387,5 +391,5 @@ int test(char *URL)
   if(!rc)
     fprintf(stderr, "test 0/2 failed: %d\n", rc);
 
-  return 0;
+  return CURLE_OK;
 }
index 0f6a89c2fbfdff820bdb571c9408a73ea8789d2b..dc48bb46255bed94f4d7e5e883e44cae432f297d 100644 (file)
@@ -33,9 +33,9 @@
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;
   int running;
   CURLM *m = NULL;
index 7e53e22555864b142647408ea2400c0bad99e18e..73edf43d4102104347e9663add64898e2e193db3 100644 (file)
@@ -37,7 +37,7 @@ static void proxystat(CURL *curl)
   }
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURL *curl;
@@ -80,5 +80,5 @@ test_cleanup:
   curl_slist_free_all(host);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index c35aea1b46e31fdb77f974dcd98b972fa16cc661..145d3cc91cd1755deeb587398bcdc7a6abba5f37 100644 (file)
@@ -449,7 +449,7 @@ static int rlimit(int keep_open)
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -458,9 +458,9 @@ int test(char *URL)
     /* used by the test script to ask if we can run this test or not */
     if(rlimit(FALSE)) {
       fprintf(stdout, "rlimit problem: %s\n", msgbuff);
-      return 1;
+      return (CURLcode)1;
     }
-    return 0; /* sure, run this! */
+    return CURLE_OK; /* sure, run this! */
   }
 
   if(rlimit(TRUE)) {
@@ -496,16 +496,16 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
 
 #else /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   (void)URL;
   printf("system lacks necessary system function(s)");
-  return 1; /* skip test */
+  return (CURLcode)1; /* skip test */
 }
 
 #endif /* defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) */
index 75f146c00298445574207c24b54a6f44b4f1a50c..ebd6af1209475847a657ac3701736e58cc7655c4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
    CURLcode res;
    CURL *curl;
@@ -89,5 +89,5 @@ test_cleanup:
    curl_easy_cleanup(curl);
    curl_global_cleanup();
 
-   return (int)res;
+   return res;
 }
index ab9fef9b4d89f22527e498403d837a68a4574722..649b4d4283ea51342d4cfd6aaf2905bfe3380bfe 100644 (file)
 
 static CURL *eh[NUM_HANDLES];
 
-static int init(int num, CURLM *cm, const char *url, const char *userpwd,
-                struct curl_slist *headers)
+static CURLcode init(int num, CURLM *cm, const char *url, const char *userpwd,
+                     struct curl_slist *headers)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   res_easy_init(eh[num]);
   if(res)
@@ -89,7 +89,7 @@ static int init(int num, CURLM *cm, const char *url, const char *userpwd,
   if(res)
     goto init_failed;
 
-  return 0; /* success */
+  return CURLE_OK; /* success */
 
 init_failed:
 
@@ -99,15 +99,15 @@ init_failed:
   return res; /* failure */
 }
 
-static int loop(int num, CURLM *cm, const char *url, const char *userpwd,
-                struct curl_slist *headers)
+static CURLcode loop(int num, CURLM *cm, const char *url, const char *userpwd,
+                     struct curl_slist *headers)
 {
   CURLMsg *msg;
   long L;
   int Q, U = -1;
   fd_set R, W, E;
   struct timeval T;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   res = init(num, cm, url, userpwd, headers);
   if(res)
@@ -189,15 +189,15 @@ static int loop(int num, CURLM *cm, const char *url, const char *userpwd,
       return res;
   }
 
-  return 0; /* success */
+  return CURLE_OK;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *cm = NULL;
   struct curl_slist *headers = NULL;
   char buffer[246]; /* naively fixed-size */
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int i;
 
   for(i = 0; i < NUM_HANDLES; i++)
@@ -206,7 +206,7 @@ int test(char *URL)
   start_test_timing();
 
   if(test_argc < 4)
-    return 99;
+    return (CURLcode)99;
 
   msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
 
index 75c74fbff836ad28413ba53bbfc4c75420b31c1e..7dd53195e7e16fc5334076d4176692415a3c268d 100644 (file)
@@ -33,7 +33,7 @@
  * Two FTP uploads, the second with no content sent.
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -51,7 +51,7 @@ int test(char *URL)
     fprintf(stderr, "fopen failed with error: %d %s\n",
             errno, strerror(errno));
     fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
-    return -2; /* if this happens things are major weird */
+    return (CURLcode)-2; /* if this happens things are major weird */
   }
 
   /* get the file size of the local file */
index 27429fd6cfe821b72506f1c21e1a4413dab05d3e..2be67488ed0688c9e86b194ac47f07a92dbf58d9 100644 (file)
@@ -33,7 +33,7 @@
  * FTP get with NOBODY but no HEADER
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 2bec2f1a6c33a9e5b180a31a3d3adab0cb8e3727..077cf16b6d638236813731ee24e77381a21a0787 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   static const unsigned char a[] = {
       0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
@@ -68,5 +68,5 @@ int test(char *URL)
   }
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index a58fa05e3e5fea4a794a5a5d883f017ab96e7a04..6228e7d9f7b2c5322a681fcdf89d42e74e5dbad1 100644 (file)
@@ -31,7 +31,7 @@ static char teststring[] =
     'w', 'i', 't', 'h', ' ', 'a', 'n', ' ',
     'e', 'm', 'b', 'e', 'd', 'd', 'e', 'd', ' ', 'N', 'U', 'L'};
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -80,5 +80,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index e65f33b78b956c0320b34f5e4ae5a230dcd7d123..a84ce999c85fd601c4f139f718e4a9fa3d97e36d 100644 (file)
@@ -72,7 +72,7 @@ static curlioerr ioctlcallback(CURL *handle,
 
 #endif
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -123,5 +123,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 8e91d935678b216ab755c3728c5de301e01c8ce6..aac8cb3958bef9802a93a16c764d72ad7f78d0ab 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -63,5 +63,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 436b86ec0209819bcf51a76c04d33ec54b35bd30..0ecc0d62e301b07febb0330ecf6fc48052e3f323 100644 (file)
@@ -166,7 +166,7 @@ static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
 
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -217,5 +217,5 @@ test_cleanup:
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
-  return (int)res;
+  return res;
 }
index f282c89500c81e70672e2288d1ef0f9df67ec282..a3d947021182ed5dfad6548bbd6b285ac836c751 100644 (file)
@@ -57,7 +57,7 @@ static size_t myreadfunc(char *ptr, size_t size, size_t nmemb, void *stream)
 
 static char buf[SIZE_HEADERS + 100];
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_FAILED_INIT;
@@ -109,5 +109,5 @@ test_cleanup:
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 1d049815cc6c4ac9b3a2859a749734d3182e6ce7..0ec7ea2ef49b7732d792115ef292537935a55412 100644 (file)
@@ -60,7 +60,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
 #endif
 }
 
-static int once(char *URL, bool oldstyle)
+static CURLcode once(char *URL, bool oldstyle)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -189,9 +189,9 @@ test_cleanup:
   return res;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
index 2e595b6863e217f1a8df7cb4f97c76aa061f2b65..7a16e2e2c8c718581f8077976a6dbaf4237aa787 100644 (file)
@@ -76,9 +76,9 @@ static curlioerr ioctlcallback(CURL *handle,
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;
   int counter = 0;
   CURLM *m = NULL;
index ead6529eac1d009a6dab23827b2919b6a8f9f52b..5e5c54ed3486e4fe87083abc3f9c1b1b68698c87 100644 (file)
@@ -37,7 +37,7 @@
   #define STDERR_FILENO 2
 #endif
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -87,7 +87,7 @@ int test(char *URL)
     }
 
     if(iolen)
-      res = (CURLcode)TEST_ERR_FAILURE;
+      res = TEST_ERR_FAILURE;
   }
 
 test_cleanup:
@@ -95,5 +95,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index c157694745f57ed9ccdea7348c8fa5aeed8b18aa..7488ab6017f795db176ddb890d4f3812ddfcfb3e 100644 (file)
@@ -1464,7 +1464,8 @@ static int test_return_codes(void)
 
   return 0;
 }
-int test(char *URL)
+
+CURLcode test(char *URL)
 {
   int errors = 0;
   (void)URL; /* not used */
@@ -1504,5 +1505,5 @@ int test(char *URL)
   if(errors)
     return TEST_ERR_MAJOR_BAD;
   else
-    return 0;
+    return CURLE_OK;
 }
index 1f42aa3b718c486f1ef869e7244dbfe634192f6c..3fdc3b508da748e84c39f28be57b5d58268baf3b 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
                        0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
@@ -50,5 +50,5 @@ int test(char *URL)
 
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 8b06fb451db61479cf97f8f18f4ac578cc96176d..aee660bb4f1851d368004605ba2b7d5a1b396b28 100644 (file)
@@ -26,7 +26,7 @@
 #include "testtrace.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -53,5 +53,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index d643b7e76da0a0706ff3944a42e868bb29e9ddfb..95b62ce784b650d0cb0026a64af8a22dc0eae623 100644 (file)
  * fast/different compared to the real/distant servers we saw the bug happen
  * with.
  */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *http_handle = NULL;
   CURLM *multi_handle = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   int still_running; /* keep number of running handles */
 
index 8b9807e375287d286cb509942f33af9c3a41f7fc..92cfbe962aa87208033f5b8f2964eb2a251c479a 100644 (file)
@@ -37,7 +37,7 @@
 
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 6c785feacce1dbbd2aad5b57003fd19fb4ee9825..7d0cf8d59d0d4d41cdf3e9ff6f62ad75af51e221 100644 (file)
@@ -31,9 +31,9 @@
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;
   int running;
   CURLM *m = NULL;
index 7d695ad5eefa1cedb1817201bc67ac3c9184fb8b..89ad0c40df95272b327c48cee266b1628d222f9b 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -67,5 +67,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index a912b1663acd11d8b762e92bf6a864b344b90b75..21338e03ecd384c273b61991a9f39d7aa1c1ab3a 100644 (file)
@@ -28,7 +28,7 @@
 /*
  * Test a simple OPTIONS request with a custom header
  */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -68,5 +68,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 04452749959ece6c1f792295e8e484d2f291a72b..ae29c06415335cc3688c109f82b41b629a5f1eb8 100644 (file)
@@ -41,9 +41,9 @@ static char *suburl(const char *base, int i)
 /*
  * Test the Client->Server ANNOUNCE functionality (PUT style)
  */
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
   int sdp;
   FILE *sdpf = NULL;
index da95bb9558119f37418af3218d6bdf3cf39521a2..847116a34ab0af218018511e5954264f4053b6ba 100644 (file)
@@ -33,9 +33,9 @@ static char *suburl(const char *base, int i)
 /*
  * Test Session ID capture
  */
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
   char *stream_uri = NULL;
   char *rtsp_session_id;
index 392c398a8fa01f4f02d69237c5a886b77f887a51..3d15e9bcf87cd1b51f7af2e5033aa40f322d8c4f 100644 (file)
@@ -30,9 +30,9 @@ static char *suburl(const char *base, int i)
   return curl_maprintf("%s%.4d", base, i);
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
   int request = 1;
   char *stream_uri = NULL;
@@ -104,11 +104,11 @@ int test(char *URL)
 
   res = curl_easy_perform(curl);
   if(res == CURLE_RTSP_SESSION_ERROR) {
-    res = 0;
+    res = CURLE_OK;
   }
   else {
     fprintf(stderr, "Failed to detect a Session ID mismatch");
-    res = 1;
+    res = (CURLcode)1;
   }
 
 test_cleanup:
index c4ae67d4b1944e8a46bd147273cb93fcecb23ff5..65798899952dbcabdcf84ea5a102f41f0e14a072 100644 (file)
@@ -100,9 +100,9 @@ static char *suburl(const char *base, int i)
   return curl_maprintf("%s%.4d", base, i);
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
   char *stream_uri = NULL;
   int request = 1;
index b199c48956484c0a13c8b741f54c3047cc102ca8..f28b741b0bee9260d48a03cdf88ff93d0715f30a 100644 (file)
@@ -41,9 +41,9 @@ static char *suburl(const char *base, int i)
 /*
  * Test GET_PARAMETER: PUT, HEARTBEAT, and POST
  */
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
   int params;
   FILE *paramsf = NULL;
index af140e2db56e1a438adedd600e506eb65f217c26..04bc9ded77c4a60bf6e47fb9e1a50fc203cc78ca 100644 (file)
  * Get a single URL without select().
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *c = NULL;
   CURLM *m = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int running = 1;
   double connect_time = 0.0;
   double dbl_epsilon;
index 79a9b167e76463b03f9408f049537066d9fe7d0a..3d7ecfc8ba03a38124bb7dd291e1ff3d7d21f158 100644 (file)
@@ -36,9 +36,9 @@ static int new_fnmatch(void *ptr,
   return CURL_FNMATCHFUNC_MATCH;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
   CURL *curl;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
index 1de6e328437ed269723b0b159ed1f204906b247e..d64f70d737d1320531a613307848a9eb3be38f9c 100644 (file)
  * 3. with multi interface
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *handle = NULL;
   CURL *duphandle = NULL;
   CURLM *mhandle = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int still_running = 0;
 
   start_test_timing();
index 7bc4750879414b09a636fd8f26d5475f104d224e..784f22d3f36e782f7a1989b67551a459ebf71a37 100644 (file)
@@ -94,7 +94,7 @@ long chunk_end(void *ptr)
   return CURL_CHUNK_END_FUNC_OK;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *handle = NULL;
   CURLcode res = CURLE_OK;
index 7c6af994572c8c1293445f83810ebc4ebbe2f20b..bc632a17e71e36bd206eab8a48815bb7502dcac6 100644 (file)
@@ -50,7 +50,7 @@ static int progress_callback(void *clientp, double dltotal, double dlnow,
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 5f962179a1c70dd42ced9cc42478dd251938b689..8b46e29d34213ca4f810616003d039ffd9728299 100644 (file)
@@ -85,7 +85,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 8fe6402a49c59187cfddcd585c88cea3b04f3379..5f393d66211834bf48bae29a364821230eaa3fb7 100644 (file)
@@ -220,9 +220,9 @@ static void checkFdSet(CURLM *curl, struct Sockets *sockets, fd_set *fdset,
   }
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   CURL *curl = NULL;
   FILE *hd_src = NULL;
   int hd;
index ba44b5d25ea1264029d5a4b5fd3d5a7bcf0c7975..0ccf5c65a6fe674bdda1a1af92288d5f36d515fe 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   int stillRunning;
   CURLM *multiHandle = NULL;
@@ -87,5 +87,5 @@ test_cleanup:
   curl_multi_cleanup(multiHandle);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 00af3341563bc22f426e11b0ee5834d42d5438fc..8a510a586bf079655f115741ebbe7781a8232ff4 100644 (file)
@@ -129,7 +129,7 @@ static void *fire(void *ptr)
 }
 
 /* test function */
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res = CURLE_OK;
   CURLSHcode scode = CURLSHE_OK;
index 3a17e31c6ba0cf2f2dcd1768fced68d91185abf8..eb800f8574edc1da5661d96fa7af9824b7d91163 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -72,5 +72,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index babcd195283a0c077b99c337cde87b5dcf2a84bc..cda3b029e34701681cda1030f337a7995f5dba15 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -69,5 +69,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 445bb0a9d712c9c8e0c7613f0a10a32ef46bc7ef..742baf2022dd065ad7a39e7b8042b1b0d7d3416b 100644 (file)
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   CURLM *multi = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int running;
   int msgs_left;
   CURLMsg *msg;
index 77ab89413c757d72386b8175b284752198b943fc..71535b041d3c2e17330dcd7e38418fc658414995 100644 (file)
  * with function curl_multi_info_read().
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   CURLM *multi = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   int running;
   int msgs_left;
   CURLMsg *msg;
index 62b36551425986fbf79a7709d2104c40cf32d38c..8c67076b495d1c50e022023803b7d401e97f2763 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -70,5 +70,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 6002e0fb04d123d07dbbc1208436a91b8480c597..391b9f2d54d9bd87d8ccb2f7b2f8f3a3700a9a99 100644 (file)
@@ -41,7 +41,7 @@ static int progress_callback(void *clientp, double dltotal,
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index efd508f8d041ddac359678984b50381688407651..9207caae829c1248fa4d830633de8441daba8286 100644 (file)
@@ -56,7 +56,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-static int once(char *URL, bool oldstyle)
+static CURLcode once(char *URL, bool oldstyle)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -223,7 +223,7 @@ test_cleanup:
   return res;
 }
 
-static int cyclic_add(void)
+static CURLcode cyclic_add(void)
 {
   CURL *easy = curl_easy_init();
   curl_mime *mime = curl_mime_init(easy);
@@ -242,14 +242,14 @@ static int cyclic_add(void)
   curl_easy_cleanup(easy);
   if(a1 != CURLE_BAD_FUNCTION_ARGUMENT)
     /* that should have failed */
-    return 1;
+    return (CURLcode)1;
 
-  return 0;
+  return CURLE_OK;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res;
+  CURLcode res;
 
   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
     fprintf(stderr, "curl_global_init() failed\n");
index 14c79e94bc6e3c10ff20f8da91d1bc5650a13eb1..407641bb026830172a755dea1efdc87eb67e18db 100644 (file)
@@ -47,7 +47,7 @@ static size_t count_chars(void *userp, const char *buf, size_t len)
 }
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = TEST_ERR_MAJOR_BAD;
index 2e45ccc2124c3401b8e2caf509b68fd99bb86566..c4754ee34c603432e6c83bb2620c120eaac281f7 100644 (file)
@@ -28,7 +28,7 @@
 
 static char buffer[17000]; /* more than 16K */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
index 7a100b7319c27a56c4b088c72a9e1015dd2cf648..50c645fffd5ad4c476531c64a4601bb4e673cbb1 100644 (file)
@@ -27,7 +27,7 @@
 
 static char buffer[17000]; /* more than 16K */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_OK;
@@ -50,7 +50,7 @@ int test(char *URL)
   curl = curl_easy_init();
   if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
-    res = (CURLcode) TEST_ERR_MAJOR_BAD;
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
 
@@ -58,13 +58,13 @@ int test(char *URL)
   mime = curl_mime_init(curl);
   if(!mime) {
     fprintf(stderr, "curl_mime_init() failed\n");
-    res = (CURLcode) TEST_ERR_MAJOR_BAD;
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   part = curl_mime_addpart(mime);
   if(!part) {
     fprintf(stderr, "curl_mime_addpart() failed\n");
-    res = (CURLcode) TEST_ERR_MAJOR_BAD;
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   res = curl_mime_filename(part, "myfile.jpg");
index 8a6fff34152e2382f46078f0041fde95354acbc5..a1be0df1606a1f815bbc463b5ed81808dd1f435b 100644 (file)
 #include "memdebug.h"
 
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curls = NULL;
-  int res = 0;
+  CURLcode res = CURLE_OK;
   curl_mimepart *field = NULL;
   curl_mime *mime = NULL;
 
@@ -61,5 +61,5 @@ test_cleanup:
   curl_mime_free(mime);
   curl_easy_cleanup(curls);
   curl_global_cleanup();
-  return (int) res; /* return the final return code */
+  return res; /* return the final return code */
 }
index 96551637dfcc75f4a0ad663ae4522e71ba640f19..b85edcff85e3cc4f5d32da61a7a7ac7487e34fa3 100644 (file)
@@ -62,15 +62,14 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   CURL *easy2 = NULL;
   curl_mime *mime = NULL;
   curl_mimepart *part;
   struct curl_slist *hdrs = NULL;
-  CURLcode result;
-  int res = TEST_ERR_FAILURE;
+  CURLcode res = TEST_ERR_FAILURE;
   struct WriteThis pooh;
 
   /*
@@ -131,19 +130,17 @@ int test(char *URL)
   mime = NULL;  /* Already cleaned up. */
 
   /* Perform on the first handle: should not send any data. */
-  result = curl_easy_perform(easy);
-  if(result) {
+  res = curl_easy_perform(easy);
+  if(res != CURLE_OK) {
     fprintf(stderr, "curl_easy_perform(original) failed\n");
-    res = (int) result;
     goto test_cleanup;
   }
 
   /* Perform on the second handle: if the bound mime structure has not been
      duplicated properly, it should cause a valgrind error. */
-  result = curl_easy_perform(easy2);
-  if(result) {
+  res = curl_easy_perform(easy2);
+  if(res != CURLE_OK) {
     fprintf(stderr, "curl_easy_perform(duplicated) failed\n");
-    res = (int) result;
     goto test_cleanup;
   }
 
index 83525e57dba2cfb6b8748e0f2513417b099639c1..79654cb0784206815be97d27ee32dfd8427a7769 100644 (file)
@@ -58,7 +58,7 @@ resolver_alloc_cb_pass(void *resolver_state, void *reserved, void *userdata)
   return 0;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl;
   CURLcode res = CURLE_OK;
@@ -110,5 +110,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 5be239f6723303391aefd628d4125da5cb58218a..59d947e23744f38364a9f38896583ee39821725f 100644 (file)
@@ -31,7 +31,7 @@
  * Get a single URL without select().
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *handle = NULL;
   CURLcode res = CURLE_OK;
index 97efbec65d739ba875785373aac3d4f96cdb2bf5..bdd879b02b7eecf9b185df423cc3d4a6fadbc1e1 100644 (file)
@@ -31,7 +31,7 @@
  * Get a single URL without select().
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *handle = NULL;
   CURLcode res = CURLE_OK;
index 5145937ac1148811d2a74a649f9f932355fae1e6..10df4988854f64feafae4c6c4431af4b1d4980de 100644 (file)
@@ -24,7 +24,7 @@
 #include "test.h"
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
    CURLcode res;
    CURL *curl = NULL;
@@ -164,5 +164,5 @@ test_cleanup:
    curl_easy_cleanup(curl);
    curl_global_cleanup();
 
-   return (int)res;
+   return res;
 }
index 62590702e06755df6e2f12d408241ded732abf03..e010e27f1831c42a77dba5a084144e1d3ee0cc7e 100644 (file)
@@ -27,7 +27,7 @@
 
 static char buffer[17000]; /* more than 16K */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURLcode res = CURLE_OK;
@@ -52,7 +52,7 @@ int test(char *URL)
   curl = curl_easy_init();
   if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
-    res = (CURLcode) TEST_ERR_MAJOR_BAD;
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
 
@@ -60,13 +60,13 @@ int test(char *URL)
   mime = curl_mime_init(curl);
   if(!mime) {
     fprintf(stderr, "curl_mime_init() failed\n");
-    res = (CURLcode) TEST_ERR_MAJOR_BAD;
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   part = curl_mime_addpart(mime);
   if(!part) {
     fprintf(stderr, "curl_mime_addpart() failed\n");
-    res = (CURLcode) TEST_ERR_MAJOR_BAD;
+    res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
   res = curl_mime_name(part, "upfile");
index 076361add2555132a068e3748f9d59ce2e524894..c54323277cb4d12066dd29663d52c5304dbd20ea 100644 (file)
@@ -54,13 +54,12 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return 0;                         /* no more data left to deliver */
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   curl_mime *mime = NULL;
   curl_mimepart *part;
-  CURLcode result;
-  int res = TEST_ERR_FAILURE;
+  CURLcode res = TEST_ERR_FAILURE;
   struct WriteThis pooh;
 
   /*
@@ -100,10 +99,9 @@ int test(char *URL)
   test_setopt(easy, CURLOPT_MIMEPOST, mime);
 
   /* Send data. */
-  result = curl_easy_perform(easy);
-  if(result) {
+  res = curl_easy_perform(easy);
+  if(res != CURLE_OK) {
     fprintf(stderr, "curl_easy_perform() failed\n");
-    res = (int) result;
   }
 
 test_cleanup:
index 35ab758f381c0af5cb56d7debc9fb5d597c16f2d..2ee0008dfb34808093d6f9bd5fc1f27e6680188e 100644 (file)
@@ -48,13 +48,12 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
   return len;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *easy = NULL;
   curl_mime *mime = NULL;
   curl_mimepart *part;
-  CURLcode result;
-  int res = TEST_ERR_FAILURE;
+  CURLcode res = TEST_ERR_FAILURE;
   struct WriteThis pooh1, pooh2;
 
   /*
@@ -104,10 +103,9 @@ int test(char *URL)
   test_setopt(easy, CURLOPT_MIMEPOST, mime);
 
   /* Send data. */
-  result = curl_easy_perform(easy);
-  if(result) {
+  res = curl_easy_perform(easy);
+  if(res != CURLE_OK) {
     fprintf(stderr, "curl_easy_perform() failed\n");
-    res = (int) result;
   }
 
 test_cleanup:
index b348343c2455c4810102ab6a626e1ccc4228b1bd..ab5c654cabca67a40e824948195b725964629738 100644 (file)
@@ -97,7 +97,7 @@ static int xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
 }
 #endif
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
 #if defined(LIB670) || defined(LIB671)
   curl_mime *mime = NULL;
@@ -116,8 +116,7 @@ int test(char *URL)
 #endif
 
   struct ReadThis pooh;
-  CURLcode result;
-  int res = TEST_ERR_FAILURE;
+  CURLcode res = TEST_ERR_FAILURE;
 
   /*
    * Check proper pausing/unpausing from a mime or form read callback.
@@ -145,11 +144,11 @@ int test(char *URL)
   /* Build the mime tree. */
   mime = curl_mime_init(pooh.easy);
   part = curl_mime_addpart(mime);
-  result = curl_mime_name(part, name);
-  if(result) {
+  res = curl_mime_name(part, name);
+  if(res != CURLE_OK) {
     fprintf(stderr,
             "Something went wrong when building the mime structure: %d\n",
-            (int) result);
+            res);
     goto test_cleanup;
   }
 
@@ -157,7 +156,7 @@ int test(char *URL)
                           NULL, NULL, &pooh);
 
   /* Bind mime data to its easy handle. */
-  if(!res)
+  if(res == CURLE_OK)
     test_setopt(pooh.easy, CURLOPT_MIMEPOST, mime);
 #else
   /* Build the form. */
@@ -233,8 +232,7 @@ int test(char *URL)
       if(!msg)
         break;
       if(msg->msg == CURLMSG_DONE) {
-        result = msg->data.result;
-        res = (int) result;
+        res = msg->data.result;
       }
     }
 
@@ -246,8 +244,7 @@ int test(char *URL)
   test_setopt(pooh.easy, CURLOPT_XFERINFODATA, &pooh);
   test_setopt(pooh.easy, CURLOPT_XFERINFOFUNCTION, xferinfo);
   test_setopt(pooh.easy, CURLOPT_NOPROGRESS, 0L);
-  result = curl_easy_perform(pooh.easy);
-  res = (int) result;
+  res = curl_easy_perform(pooh.easy);
 #endif
 
 
index 1a01d9c1872124a3e0d87a42398d64130912355e..39e16e0f5f3d0f65e2000c700d991842c71a89b8 100644 (file)
@@ -31,7 +31,7 @@
  * Get a single URL without select().
  */
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *handle = NULL;
   CURL *handle2;
index 478d5f3a1e957662def329b14e765407ba939f1a..fc292705a59f12a373ca748a882e9745d851dc59 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "memdebug.h"
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLcode res;
   CURL *curl;
@@ -66,5 +66,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 6dc7e8e1779198a026793474a32b03b2dba2e7ba..68ac75c1c2dbf687d4c91929275a101649713309 100644 (file)
@@ -30,7 +30,7 @@
 static const char cmd[] = "A1 IDLE\r\n";
 static char buf[1024];
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURLM *mcurl;
   CURL *curl = NULL;
@@ -39,7 +39,7 @@ int test(char *URL)
   time_t start = time(NULL);
   int state = 0;
   ssize_t pos = 0;
-  int res = 0;
+  CURLcode res = CURLE_OK;
 
   global_init(CURL_GLOBAL_DEFAULT);
   multi_init(mcurl);
index 942808e2a6c820b686317b51442ab7ca392af39d..9a8ab7670df64c27807822f89e1bef82b3e22f64 100644 (file)
@@ -63,7 +63,7 @@ static int loadfile(const char *filename, void **filedata, size_t *filesize)
   return data ? 1 : 0;
 }
 
-static int test_cert_blob(const char *url, const char *cafile)
+static CURLcode test_cert_blob(const char *url, const char *cafile)
 {
   CURLcode code = CURLE_OUT_OF_MEMORY;
   CURL *curl;
@@ -94,12 +94,12 @@ static int test_cert_blob(const char *url, const char *cafile)
   }
   curl_easy_cleanup(curl);
 
-  return (int)code;
+  return code;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
-  int res = 0;
+  CURLcode res = CURLE_OK;
   curl_global_init(CURL_GLOBAL_DEFAULT);
   if(!strcmp("check", URL)) {
     CURL *e;
@@ -112,7 +112,7 @@ int test(char *URL)
         printf("CURLOPT_CAINFO_BLOB is not supported\n");
       curl_easy_cleanup(e);
     }
-    res = (int)w;
+    res = w;
   }
   else
     res = test_cert_blob(URL, libtest_arg2);
index a71fe20edeccc62c73549dc6d7ee3c2498e907e5..db648f35a16535c6bac3b72ee27e7434790de785 100644 (file)
@@ -60,13 +60,13 @@ test_cleanup:
 static CURLcode send_wrong_password(CURL *curl, const char *url, int seq,
                                     long auth_scheme)
 {
-    return send_request(curl, url, seq, auth_scheme, "testuser:wrongpass");
+  return send_request(curl, url, seq, auth_scheme, "testuser:wrongpass");
 }
 
 static CURLcode send_right_password(CURL *curl, const char *url, int seq,
                                     long auth_scheme)
 {
-    return send_request(curl, url, seq, auth_scheme, "testuser:testpass");
+  return send_request(curl, url, seq, auth_scheme, "testuser:testpass");
 }
 
 static long parse_auth_name(const char *arg)
@@ -82,7 +82,7 @@ static long parse_auth_name(const char *arg)
   return CURLAUTH_NONE;
 }
 
-int test(char *url)
+CURLcode test(char *url)
 {
   CURLcode res;
   CURL *curl = NULL;
@@ -145,5 +145,5 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
index 462b5481c1ea31b9ba5ddab32f2fa70013639f4a..e2e5b64103712031e8107225ef54f1c33614865c 100644 (file)
@@ -36,7 +36,7 @@
 static int counter[MAX_EASY_HANDLES];
 static CURL *easy[MAX_EASY_HANDLES];
 static curl_socket_t sockets[MAX_EASY_HANDLES];
-static int res = 0;
+static CURLcode res = CURLE_OK;
 
 static size_t callback(char *ptr, size_t size, size_t nmemb, void *data)
 {
@@ -89,7 +89,7 @@ enum HandleState {
   NoMoreHandles
 };
 
-int test(char *url)
+CURLcode test(char *url)
 {
   CURLM *multi = NULL;
   int running;
index 92369d838d6448e4471556c5b81f044d3fe15590..3eef5f369084f09dbfefa3d3dc421615b59e45b7 100644 (file)
@@ -51,7 +51,7 @@ static int prereq_callback(void *clientp,
   return prereq_cb->prereq_retcode;
 }
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   PRCS prereq_cb;
   CURLcode ret = CURLE_OK;
index e1418a01333431ebdb3ca12bbf9656dc1f8b0e9f..6fd332240b77392a1163ec9ed43c481b7b6e7076 100755 (executable)
@@ -146,7 +146,7 @@ static curl_hstswrite_callback hstswritecb;
 static curl_resolver_start_callback resolver_start_cb;
 static curl_prereq_callback prereqcb;
 
-int test(char *URL)
+CURLcode test(char *URL)
 {
   CURL *curl = NULL;
   CURL *dep = NULL;
@@ -363,7 +363,7 @@ test_cleanup:
   curl_share_cleanup(share);
   curl_global_cleanup();
 
-  return (int)res;
+  return res;
 }
 FOOTER
     ;
index 7f29db117dae4fa42b7536b81ac431def4fb17a4..2cdb57bfe5a018afab68189e795e829db6df3e09 100644 (file)
@@ -68,8 +68,8 @@ extern int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
 
 extern void wait_ms(int ms); /* wait this many milliseconds */
 
-extern int test(char *URL); /* the actual test function provided by each
-                               individual libXXX.c file */
+extern CURLcode test(char *URL); /* the actual test function provided by each
+                                    individual libXXX.c file */
 
 extern char *hexdump(const unsigned char *buffer, size_t len);
 
@@ -490,11 +490,11 @@ extern int unitfail;
   chk_global_init((A), (__FILE__), (__LINE__))
 
 #define NO_SUPPORT_BUILT_IN                     \
-  int test(char *URL)                           \
+  CURLcode test(char *URL)                      \
   {                                             \
     (void)URL;                                  \
     fprintf(stderr, "Missing support\n");       \
-    return 1;                                   \
+    return (CURLcode)1;                         \
   }
 
 /* ---------------------------------------------------------------- */
index 928964422714d77ef2ad2a92e363c5cbe4f913fd..c0faf5069b28285c1e679421ccb972a66dd95687 100644 (file)
@@ -94,7 +94,7 @@
 
 
 #define UNITTEST_START                          \
-  int test(char *arg)                           \
+  CURLcode test(char *arg)                      \
   {                                             \
     (void)arg;                                  \
     if(unit_setup()) {                          \
 unit_test_abort:                                \
     unit_stop();                                \
   }                                             \
-  return unitfail;                              \
+  return (CURLcode)unitfail;                    \
   }
index c022496c3d846991c24740d1fb93fcc4fa145750..65bba3bf4a051594cd833ab0bef80e6fdb47e3f3 100644 (file)
@@ -69,8 +69,8 @@ static void unit_stop(void)
 struct timetest {
   int now_s;
   int now_us;
-  int timeout_ms;
-  int connecttimeout_ms;
+  unsigned int timeout_ms;
+  unsigned int connecttimeout_ms;
   bool connecting;
   timediff_t result;
   const char *comment;
index a6e5004878b8f8c3743a6d8adb984361f632c19e..a782d5178aa63ee3113c9fe95a279043d2bd2a27 100644 (file)
@@ -44,7 +44,8 @@ static size_t print_httppost_callback(void *arg, const char *buf, size_t len)
 }
 
 UNITTEST_START
-  int rc;
+  CURLFORMcode rc;
+  int res;
   struct curl_httppost *post = NULL;
   struct curl_httppost *last = NULL;
   size_t total_size = 0;
@@ -70,9 +71,9 @@ UNITTEST_START
 
   fail_unless(rc == 0, "curl_formadd returned error");
 
-  rc = curl_formget(post, &total_size, print_httppost_callback);
+  res = curl_formget(post, &total_size, print_httppost_callback);
 
-  fail_unless(rc == 0, "curl_formget returned error");
+  fail_unless(res == 0, "curl_formget returned error");
 
   fail_unless(total_size == 518, "curl_formget got wrong size back");
 
@@ -89,8 +90,8 @@ UNITTEST_START
 
   fail_unless(rc == 0, "curl_formadd returned error");
 
-  rc = curl_formget(post, &total_size, print_httppost_callback);
-  fail_unless(rc == 0, "curl_formget returned error");
+  res = curl_formget(post, &total_size, print_httppost_callback);
+  fail_unless(res == 0, "curl_formget returned error");
   fail_unless(total_size == 899, "curl_formget got wrong size back");
 
   curl_formfree(post);
index 004fdbccbaa2c1284ef8bde0929a5da435defba7..850ad8569ed56c0b0846d722ad7daec3e4dd041d 100644 (file)
@@ -31,7 +31,7 @@
 #include "memdebug.h" /* LAST include file */
 
 static struct Curl_hash hash_static;
-static const int slots = 3;
+static const size_t slots = 3;
 
 static void mydtor(void *p)
 {
index fecb92321b5228d843e6c2647a368365c919d17c..4a457ff0e12bb002588920067567c6859c8d6eb8 100644 (file)
@@ -42,7 +42,7 @@ static void unit_stop(void)
 
 UNITTEST_START
 {
-  int rc;
+  CURLcode rc;
   struct Curl_easy *empty;
   const char *hostname = "hostname";
   enum dupstring i;
index 1993616bf112dd3af2543257ba81941be7ef3d77..58f8be51ab546ca3c22ead86689a5d31a1bdf3fd 100644 (file)
@@ -57,13 +57,13 @@ struct dohrequest {
   /* output */
   const char *packet;
   size_t size;
-  int rc;
+  DOHcode rc;
 };
 
 
 static const struct dohrequest req[] = {
-  {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, 0 },
-  {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, 0 },
+  {"test.host.name", DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
+  {"test.host.name", DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
   {"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
    ".host.name",
    DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
@@ -76,7 +76,7 @@ struct dohresp {
   DNStype type;
 
   /* output */
-  int rc;
+  DOHcode rc;
   const char *out;
 };
 
@@ -161,8 +161,8 @@ UNITTEST_START
   unsigned char *p;
 
   for(i = 0; i < sizeof(req) / sizeof(req[0]); i++) {
-    int rc = doh_encode(req[i].name, req[i].type,
-                        buffer, sizeof(buffer), &size);
+    DOHcode rc = doh_encode(req[i].name, req[i].type,
+                            buffer, sizeof(buffer), &size);
     if(rc != req[i].rc) {
       fprintf(stderr, "req %zu: Expected return code %d got %d\n", i,
               req[i].rc, rc);
@@ -185,7 +185,7 @@ UNITTEST_START
 
   for(i = 0; i < sizeof(resp) / sizeof(resp[0]); i++) {
     struct dohentry d;
-    int rc;
+    DOHcode rc;
     char *ptr;
     size_t len;
     int u;
@@ -243,7 +243,7 @@ UNITTEST_START
   /* pass all sizes into the decoder until full */
   for(i = 0; i < sizeof(full49)-1; i++) {
     struct dohentry d;
-    int rc;
+    DOHcode rc;
     memset(&d, 0, sizeof(d));
     rc = doh_decode((const unsigned char *)full49, i, DNS_TYPE_A, &d);
     if(!rc) {
@@ -256,7 +256,7 @@ UNITTEST_START
   /* and try all pieces from the other end of the packet */
   for(i = 1; i < sizeof(full49); i++) {
     struct dohentry d;
-    int rc;
+    DOHcode rc;
     memset(&d, 0, sizeof(d));
     rc = doh_decode((const unsigned char *)&full49[i], sizeof(full49)-i-1,
                     DNS_TYPE_A, &d);
@@ -268,7 +268,7 @@ UNITTEST_START
   }
 
   {
-    int rc;
+    DOHcode rc;
     struct dohentry d;
     struct dohaddr *a;
     memset(&d, 0, sizeof(d));
index 938d1a185f7a6fbcb3d931e0d5c81b06e6850da2..5a126fbc5a12d09563ae9b251c80908ddf736dd9 100644 (file)
@@ -41,7 +41,7 @@ unit_stop(void)
 #if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_HSTS)
 UNITTEST_START
 {
-  return 0; /* nothing to do when HTTP or HSTS are disabled */
+  return CURLE_OK; /* nothing to do when HTTP or HSTS are disabled */
 }
 UNITTEST_STOP
 #else
index 433e42727d7d74bbb6fc33b5cdd8f87cd224de78..82b7e563662b2571aa54ae8763abc60d6e715dca 100644 (file)
@@ -104,7 +104,7 @@ UNITTEST_START
   }
 
   free((void *)list[0].cp);
-  return error;
+  return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
 }
 #endif
 
index 6f508ce070238b26a3c985e7e20d83102830fd0d..223078dda65a3fd70899965f6d4cd79511e0d6af 100644 (file)
@@ -88,7 +88,7 @@ UNITTEST_START
   for(i = 0; i < NUMTESTS; i++) {
     FILE *fp;
     struct dynbuf buf;
-    int len = 4096;
+    size_t len = 4096;
     char *line;
     Curl_dyn_init(&buf, len);
 
@@ -169,7 +169,7 @@ UNITTEST_START
     fclose(fp);
     fprintf(stderr, "OK\n");
   }
-  return rc;
+  return (CURLcode)rc;
 UNITTEST_STOP
 
 #ifdef __GNUC__