int main(int argc, char **argv)
{
char *URL;
- int result;
+ CURLcode result;
#ifdef O_BINARY
# ifdef __HIGHC__
/* 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;
}
/* for debugging: */
/* #define SINGLETEST 9 */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
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;
}
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;
rc = curl_strnequal("ii", "II", 3);
fail_unless(rc != 0, "return code should be non-zero");
- return 0;
+ return CURLE_OK;
}
#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();
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;
}
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();
fprintf(stderr, "pong = %ld\n", e);
if(e > MAX_BLOCKED_TIME_MS) {
- res = 100;
+ res = (CURLcode) 100;
break;
}
}
#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];
#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;
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;
#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;
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);
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;
}
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;
}
#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];
#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);
#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;
return 1;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
- int res = 0;
+ CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
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);
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)result;
+ return result;
}
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;
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;
/* 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);
curl_multi_cleanup(multi);
curl_global_cleanup();
- return (int) res;
+ return res;
}
return tocopy;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#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
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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");
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return CURL_SOCKOPT_OK;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode code = TEST_ERR_MAJOR_BAD;
CURLcode res;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)code;
+ return code;
}
return curl_easy_perform(hnd);
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret;
CURL *hnd;
curl_easy_cleanup(hnd);
curl_global_cleanup();
- return (int)ret;
+ return ret;
}
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_global_cleanup();
- return (int)res;
+ return res;
}
return strlen(data);
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_global_cleanup();
- return (int)res;
+ return res;
}
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_slist_free_all(phl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return CURL_SOCKET_BAD;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
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();
/* Test CURLINFO_RESPONSE_CODE */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
long httpcode;
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
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;
}
}
-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");
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;
}
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;
}
curl_global_cleanup();
- return (int)res;
+ return res;
}
/* Test CURLINFO_FILETIME */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl, *dupe = NULL;
long filetime;
curl_easy_cleanup(curl);
curl_easy_cleanup(dupe);
curl_global_cleanup();
- return (int)res;
+ return res;
}
/* Test CURLINFO_PROTOCOL */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl, *dupe = NULL;
long protocol;
curl_easy_cleanup(curl);
curl_easy_cleanup(dupe);
curl_global_cleanup();
- return (int)res;
+ return res;
}
/* Test CURLINFO_SCHEME */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl, *dupe = NULL;
char *scheme;
curl_easy_cleanup(curl);
curl_easy_cleanup(dupe);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#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};
curl_free(ptr);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
- int res = 0;
+ CURLcode res = CURLE_OK;
CURLcode easyret;
CURLMcode multiret;
CURLSHcode shareret;
printf("u%d: %s\n", (int)urlret, curl_url_strerror(urlret));
}
- return (int)res;
+ return res;
}
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();
curl_easy_cleanup(curls);
curl_global_cleanup();
- return (int)res; /* return the final return code */
+ return res; /* return the final return code */
}
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();
curl_easy_cleanup(curls);
curl_global_cleanup();
- return (int)res; /* return the final return code */
+ return res; /* return the final return code */
}
#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);
#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;
#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[] =
curl_multi_setopt(handle, CURLMOPT_PIPELINING_SITE_BL, bl_sites);
curl_multi_cleanup(handle);
curl_global_cleanup();
- return 0;
+ return CURLE_OK;
}
#include <curl/multi.h>
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#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;
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;
}
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;
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;
}
}
/* test function */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURLSH *share = NULL;
curl_share_cleanup(share);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return 1;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
- int res = 0;
+ CURLcode res = CURLE_OK;
global_init(CURL_GLOBAL_ALL);
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);
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;
}
#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);
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return 0;
+ return CURLE_OK;
test_cleanup:
#include "memdebug.h"
#define EXCESSIVE 10*1000*1000
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl = NULL;
(void)URL;
if(!longurl)
- return 1;
+ return (CURLcode)1;
memset(longurl, 'a', EXCESSIVE);
longurl[EXCESSIVE-1] = 0;
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) {
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;
}
#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;
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;
static void *run_thread(void *ptr)
{
CURL *easy = NULL;
- int res = 0;
+ CURLcode res = CURLE_OK;
int i;
(void)ptr;
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;
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;
}
}
#else /* without pthread, this test doesn't work */
-int test(char *URL)
+CURLcode test(char *URL)
{
(void)URL;
return 0;
#include <curl/multi.h>
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_OK;
curl_url_cleanup(u);
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "testtrace.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret;
CURL *hnd;
hnd = NULL;
curl_global_cleanup();
- return (int)ret;
+ return ret;
}
#include "testtrace.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd;
test_cleanup:
curl_easy_cleanup(hnd);
curl_global_cleanup();
- return (int)res;
+ return res;
}
}
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include <sys/stat.h>
-int test(char *URL)
+CURLcode test(char *URL)
{
int stillRunning;
CURLM *multiHandle = NULL;
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;
}
curl_multi_cleanup(multiHandle);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#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);
#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);
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;
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;
}
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);
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;
}
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;
curl_global_cleanup();
- return (int)res;
+ return res;
}
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd;
curl_easy_cleanup(hnd);
curl_mime_free(mime1);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd = NULL;
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;
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_slist_free_all(chunk);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *ch = NULL;
curl_easy_cleanup(ch);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLSH *sh = NULL;
CURL *ch = NULL;
cm = curl_multi_init();
if(!cm) {
curl_global_cleanup();
- return 1;
+ return (CURLcode)1;
}
sh = curl_share_init();
if(!sh)
curl_multi_cleanup(cm);
curl_global_cleanup();
- return 0;
+ return CURLE_OK;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
char *url_after = NULL;
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;
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);
curl_url_cleanup(curlu);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
char *url_after;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
curl_easy_cleanup(hnd);
}
curl_global_cleanup();
- return (int)ret;
+ return ret;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
curl_easy_cleanup(hnd);
}
curl_global_cleanup();
- return (int)ret;
+ return ret;
}
static char buffer[MAX_INPUT_LENGTH + 2];
-int test(char *URL)
+CURLcode test(char *URL)
{
const struct curl_easyoption *o;
CURL *easy;
easy = curl_easy_init();
if(!easy) {
curl_global_cleanup();
- return 1;
+ return (CURLcode)1;
}
/* make it a null-terminated C string with just As */
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;
}
}
curl_easy_cleanup(easy);
curl_global_cleanup();
- return error;
+ return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
}
#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;
}
#endif
(void)URL;
- return error;
+ return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
curl_easy_cleanup(hnd);
}
curl_global_cleanup();
- return (int)ret;
+ return ret;
}
* Read/write HSTS cache entries via callback.
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *hnd;
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);
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;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
}
curl_global_cleanup();
- return (int)res;
+ return res;
}
#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);
}
}
curl_global_cleanup();
- return error;
+ return CURLE_OK;
}
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl;
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLM *multi;
CURL *easy;
(void)userp;
return n*l;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *easy = NULL;
CURLcode res = CURLE_OK;
test_cleanup:
curl_easy_cleanup(easy);
curl_global_cleanup();
- return (int)res;
+ return res;
}
(void)userp;
return n*l;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *easy;
CURLcode res = CURLE_OK;
}
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;
}
(void)userp;
return n*l;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return tocopy;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
}
/* Expected args: URL IP PORT */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = TEST_ERR_MAJOR_BAD;
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);
return res;
}
#else
-int test(char *URL)
+CURLcode test(char *URL)
{
(void)URL;
printf("lacks inet_pton\n");
- return 0;
+ return CURLE_OK;
}
#endif
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
curl_mime *mime = NULL;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = TEST_ERR_MAJOR_BAD;
#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;
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 */
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)
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]);
return nitems;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
- return (int)res;
+ return res;
}
#else /* no websockets */
return nitems;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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
#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;
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;
fprintf(stderr, "recv_any: got %u bytes rflags %x\n", (int)rlen,
meta->flags);
- return 0;
+ return CURLE_OK;
}
/* just close the connection */
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)
websocket_close(curl);
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
- return (int)res;
+ return res;
}
#else
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)
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,
websocket_close(curl);
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
- return (int)res;
+ return res;
}
#else
#define URL2 libtest_arg2
-int test(char *URL)
+CURLcode test(char *URL)
{
/* first a fine GET response, then a bad one */
CURL *cl;
#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;
#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;
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);
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;
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];
result = msg->data.result;
if(!res)
- res = (int)result;
+ res = result;
}
}
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;
struct curl_waitfd ufds[10];
- int res = CURLE_OK;
+ CURLcode res = CURLE_OK;
unsigned int fd_count = 0;
multi_init(multi);
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);
#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;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *curl = NULL;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_slist_free_all(icy);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
#ifdef _WIN32_WCE
typedef HANDLE curl_win_thread_handle_t;
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
}
}
- return test_failure;
+ return (CURLcode)test_failure;
}
#elif defined(HAVE_PTHREAD_H)
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;
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++) {
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;
}
}
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;
}
}
}
#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;
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
#include "warnless.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode ret = CURLE_OK;
CURL *hnd;
curl_easy_cleanup(hnd);
}
curl_global_cleanup();
- return (int)ret;
+ return ret;
}
#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) {
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;
#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) {
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;
}
return size * nmemb;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURLSH *share;
/* always cleanup */
curl_easy_cleanup(curl);
- curl_share_cleanup(share);
+ curl_share_cleanup(share);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#endif
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
* 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();
* 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();
* 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;
* Example based on source code provided by Erick Nuwendam. Thanks!
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
/* 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;
curl_easy_cleanup(curl);
- res = 0;
+ res = CURLE_OK;
/* start treads */
for(i = 1; i <= THREADS; i++) {
#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();
return 0; /* no more data left to deliver */
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
}
-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};
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return 0; /* no more data left to deliver */
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
/* 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;
else
rc = 5;
- return rc;
+ return (CURLcode)rc;
}
return CURL_READFUNC_ABORT;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
{ NULL, 0 }
};
-int test(char *URL)
+CURLcode test(char *URL)
{
int i;
int error = 0;
}
}
- return error;
+ return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
/* 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)) {
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)");
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#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;
#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;
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]);
}
else {
fprintf(stderr, "Got an unexpected message from curl: %i\n",
- (int)message->msg);
+ message->msg);
result = 1;
*success = 0;
}
}
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);
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};
start_test_timing();
res_global_init(CURL_GLOBAL_ALL);
- if(res)
+ if(res != CURLE_OK)
return res;
easy_init(curl);
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;
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();
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);
if(!rc)
fprintf(stderr, "test 0/2 failed: %d\n", rc);
- return 0;
+ return CURLE_OK;
}
#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;
}
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURL *curl;
curl_slist_free_all(host);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
/* 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)) {
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) */
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
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)
if(res)
goto init_failed;
- return 0; /* success */
+ return CURLE_OK; /* success */
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)
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++)
start_test_timing();
if(test_argc < 4)
- return 99;
+ return (CURLcode)99;
msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
* Two FTP uploads, the second with no content sent.
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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 */
* FTP get with NOBODY but no HEADER
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
static const unsigned char a[] = {
0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
}
curl_global_cleanup();
- return (int)res;
+ return res;
}
'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;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#endif
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
static char buf[SIZE_HEADERS + 100];
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_FAILED_INIT;
curl_global_cleanup();
- return (int)res;
+ return res;
}
#endif
}
-static int once(char *URL, bool oldstyle)
+static CURLcode once(char *URL, bool oldstyle)
{
CURL *curl;
CURLcode res = CURLE_OK;
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");
}
-int test(char *URL)
+CURLcode test(char *URL)
{
- int res = 0;
+ CURLcode res = CURLE_OK;
CURL *curl = NULL;
int counter = 0;
CURLM *m = NULL;
#define STDERR_FILENO 2
#endif
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
}
if(iolen)
- res = (CURLcode)TEST_ERR_FAILURE;
+ res = TEST_ERR_FAILURE;
}
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return 0;
}
-int test(char *URL)
+
+CURLcode test(char *URL)
{
int errors = 0;
(void)URL; /* not used */
if(errors)
return TEST_ERR_MAJOR_BAD;
else
- return 0;
+ return CURLE_OK;
}
#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};
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "testtrace.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
* 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 */
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
#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;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
/*
* Test a simple OPTIONS request with a custom header
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
/*
* 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;
/*
* 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;
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;
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:
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;
/*
* 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;
* 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;
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) {
* 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();
return CURL_CHUNK_END_FUNC_OK;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *handle = NULL;
CURLcode res = CURLE_OK;
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
return 0; /* no more data left to deliver */
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
}
}
-int test(char *URL)
+CURLcode test(char *URL)
{
- int res = 0;
+ CURLcode res = CURLE_OK;
CURL *curl = NULL;
FILE *hd_src = NULL;
int hd;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
int stillRunning;
CURLM *multiHandle = NULL;
curl_multi_cleanup(multiHandle);
curl_global_cleanup();
- return (int)res;
+ return res;
}
}
/* test function */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
CURLSHcode scode = CURLSHE_OK;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
#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;
* 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;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
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;
return res;
}
-static int cyclic_add(void)
+static CURLcode cyclic_add(void)
{
CURL *easy = curl_easy_init();
curl_mime *mime = curl_mime_init(easy);
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");
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = TEST_ERR_MAJOR_BAD;
static char buffer[17000]; /* more than 16K */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
static char buffer[17000]; /* more than 16K */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_OK;
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;
}
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");
#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;
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 */
}
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;
/*
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;
}
return 0;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
* Get a single URL without select().
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *handle = NULL;
CURLcode res = CURLE_OK;
* Get a single URL without select().
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *handle = NULL;
CURLcode res = CURLE_OK;
#include "test.h"
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl = NULL;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
static char buffer[17000]; /* more than 16K */
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *curl = NULL;
CURLcode res = CURLE_OK;
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;
}
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");
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;
/*
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:
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;
/*
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:
}
#endif
-int test(char *URL)
+CURLcode test(char *URL)
{
#if defined(LIB670) || defined(LIB671)
curl_mime *mime = NULL;
#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.
/* 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;
}
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. */
if(!msg)
break;
if(msg->msg == CURLMSG_DONE) {
- result = msg->data.result;
- res = (int) result;
+ res = msg->data.result;
}
}
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
* Get a single URL without select().
*/
-int test(char *URL)
+CURLcode test(char *URL)
{
CURL *handle = NULL;
CURL *handle2;
#include "memdebug.h"
-int test(char *URL)
+CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
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;
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);
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;
}
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;
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);
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)
return CURLAUTH_NONE;
}
-int test(char *url)
+CURLcode test(char *url)
{
CURLcode res;
CURL *curl = NULL;
curl_easy_cleanup(curl);
curl_global_cleanup();
- return (int)res;
+ return res;
}
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)
{
NoMoreHandles
};
-int test(char *url)
+CURLcode test(char *url)
{
CURLM *multi = NULL;
int running;
return prereq_cb->prereq_retcode;
}
-int test(char *URL)
+CURLcode test(char *URL)
{
PRCS prereq_cb;
CURLcode ret = CURLE_OK;
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;
curl_share_cleanup(share);
curl_global_cleanup();
- return (int)res;
+ return res;
}
FOOTER
;
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);
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; \
}
/* ---------------------------------------------------------------- */
#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; \
}
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;
}
UNITTEST_START
- int rc;
+ CURLFORMcode rc;
+ int res;
struct curl_httppost *post = NULL;
struct curl_httppost *last = NULL;
size_t total_size = 0;
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");
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);
#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)
{
UNITTEST_START
{
- int rc;
+ CURLcode rc;
struct Curl_easy *empty;
const char *hostname = "hostname";
enum dupstring i;
/* 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 }
DNStype type;
/* output */
- int rc;
+ DOHcode rc;
const char *out;
};
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);
for(i = 0; i < sizeof(resp) / sizeof(resp[0]); i++) {
struct dohentry d;
- int rc;
+ DOHcode rc;
char *ptr;
size_t len;
int u;
/* 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) {
/* 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);
}
{
- int rc;
+ DOHcode rc;
struct dohentry d;
struct dohaddr *a;
memset(&d, 0, sizeof(d));
#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
}
free((void *)list[0].cp);
- return error;
+ return error == 0 ? CURLE_OK : TEST_ERR_FAILURE;
}
#endif
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);
fclose(fp);
fprintf(stderr, "OK\n");
}
- return rc;
+ return (CURLcode)rc;
UNITTEST_STOP
#ifdef __GNUC__