tests: rename more CURLcode variables to result

For consistency.

Also:
- one remaining in `src/tool_writeout.c`.
- replace casting an `int` to `CURLcode`.
- lib758: rename `CURLMcode` `result` to `mresult`.
- move literals to the right side of if expressions.

Follow-up to d0dc6e2ec0 #20426
Follow-up to 56f600ec23

Closes #20432
This commit is contained in:
Viktor Szakats 2026-01-25 18:12:40 +01:00
parent 26c39d8df1
commit 2da1bbca96
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
33 changed files with 307 additions and 303 deletions

View file

@ -163,8 +163,9 @@ static void certinfo(struct per_transfer *per)
{ {
if(!per->certinfo) { if(!per->certinfo) {
struct curl_certinfo *certinfo; struct curl_certinfo *certinfo;
CURLcode res = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO, &certinfo); CURLcode result = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO,
per->certinfo = (!res && certinfo) ? certinfo : NULL; &certinfo);
per->certinfo = (!result && certinfo) ? certinfo : NULL;
} }
} }

View file

@ -33,13 +33,13 @@ static size_t write_tse_cb(char *ptr, size_t size, size_t nmemb, void *opaque)
(void)ptr; (void)ptr;
if(!tse_found_tls_session) { if(!tse_found_tls_session) {
struct curl_tlssessioninfo *tlssession; struct curl_tlssessioninfo *tlssession;
CURLcode rc; CURLcode result;
rc = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tlssession); result = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tlssession);
if(rc) { if(result) {
curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) " curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) "
"failed: %s\n", curl_easy_strerror(rc)); "failed: %s\n", curl_easy_strerror(result));
return rc; return result;
} }
if(tlssession->backend == CURLSSLBACKEND_NONE) { if(tlssession->backend == CURLSSLBACKEND_NONE) {
curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) " curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) "

View file

@ -74,7 +74,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
size_t plen_max) size_t plen_max)
{ {
CURL *curl = NULL; CURL *curl = NULL;
CURLcode r = CURLE_OK; CURLcode result = CURLE_OK;
const struct curl_ws_frame *frame; const struct curl_ws_frame *frame;
size_t len; size_t len;
char *send_buf = NULL, *recv_buf = NULL; char *send_buf = NULL, *recv_buf = NULL;
@ -84,7 +84,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
send_buf = curlx_calloc(1, plen_max + 1); send_buf = curlx_calloc(1, plen_max + 1);
recv_buf = curlx_calloc(1, plen_max + 1); recv_buf = curlx_calloc(1, plen_max + 1);
if(!send_buf || !recv_buf) { if(!send_buf || !recv_buf) {
r = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto out; goto out;
} }
for(i = 0; i < plen_max; ++i) { for(i = 0; i < plen_max; ++i) {
@ -93,7 +93,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
curl = curl_easy_init(); curl = curl_easy_init();
if(!curl) { if(!curl) {
r = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto out; goto out;
} }
@ -103,9 +103,9 @@ static CURLcode test_ws_data_m2_echo(const char *url,
curl_easy_setopt(curl, CURLOPT_USERAGENT, "ws-data"); curl_easy_setopt(curl, CURLOPT_USERAGENT, "ws-data");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
r = curl_easy_perform(curl); result = curl_easy_perform(curl);
curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", r); curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", result);
if(r != CURLE_OK) if(result != CURLE_OK)
goto out; goto out;
for(len = plen_min; len <= plen_max; ++len) { for(len = plen_min; len <= plen_max; ++len) {
@ -116,12 +116,12 @@ static CURLcode test_ws_data_m2_echo(const char *url,
while(slen || rlen || scount || rcount) { while(slen || rlen || scount || rcount) {
sblock = rblock = 1; sblock = rblock = 1;
if(slen) { if(slen) {
r = curl_ws_send(curl, sbuf, slen, &nwritten, 0, CURLWS_BINARY); result = curl_ws_send(curl, sbuf, slen, &nwritten, 0, CURLWS_BINARY);
sblock = (r == CURLE_AGAIN); sblock = (result == CURLE_AGAIN);
if(!r || (r == CURLE_AGAIN)) { if(!result || (result == CURLE_AGAIN)) {
curl_mfprintf(stderr, "curl_ws_send(len=%zu) -> %d, " curl_mfprintf(stderr, "curl_ws_send(len=%zu) -> %d, "
"%zu (%" CURL_FORMAT_CURL_OFF_T "/%zu)\n", "%zu (%" CURL_FORMAT_CURL_OFF_T "/%zu)\n",
slen, r, nwritten, (curl_off_t)(len - slen), len); slen, result, nwritten, (curl_off_t)(len - slen), len);
sbuf += nwritten; sbuf += nwritten;
slen -= nwritten; slen -= nwritten;
} }
@ -136,15 +136,15 @@ static CURLcode test_ws_data_m2_echo(const char *url,
if(rlen) { if(rlen) {
size_t max_recv = (64 * 1024); size_t max_recv = (64 * 1024);
r = curl_ws_recv(curl, rbuf, (rlen > max_recv) ? max_recv : rlen, result = curl_ws_recv(curl, rbuf, (rlen > max_recv) ? max_recv : rlen,
&nread, &frame); &nread, &frame);
if(!r || (r == CURLE_AGAIN)) { if(!result || (result == CURLE_AGAIN)) {
rblock = (r == CURLE_AGAIN); rblock = (result == CURLE_AGAIN);
curl_mfprintf(stderr, "curl_ws_recv(len=%zu) -> %d, %zu (%ld/%zu) " curl_mfprintf(stderr, "curl_ws_recv(len=%zu) -> %d, %zu (%ld/%zu) "
"\n", rlen, r, nread, (long)(len - rlen), len); "\n", rlen, result, nread, (long)(len - rlen), len);
if(!r) { if(!result) {
r = test_ws_data_m2_check_recv(frame, len - rlen, nread, len); result = test_ws_data_m2_check_recv(frame, len - rlen, nread, len);
if(r) if(result)
goto out; goto out;
} }
rbuf += nread; rbuf += nread;
@ -171,20 +171,20 @@ static CURLcode test_ws_data_m2_echo(const char *url,
(const unsigned char *)send_buf, len, FALSE); (const unsigned char *)send_buf, len, FALSE);
debug_dump("", "received:", stderr, debug_dump("", "received:", stderr,
(const unsigned char *)recv_buf, len, FALSE); (const unsigned char *)recv_buf, len, FALSE);
r = CURLE_RECV_ERROR; result = CURLE_RECV_ERROR;
goto out; goto out;
} }
} }
out: out:
if(curl) { if(curl) {
if(!r) if(!result)
ws_close(curl); ws_close(curl);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} }
curlx_free(send_buf); curlx_free(send_buf);
curlx_free(recv_buf); curlx_free(recv_buf);
return r; return result;
} }
struct test_ws_m1_ctx { struct test_ws_m1_ctx {

View file

@ -160,7 +160,7 @@ static CURLcode test_lib1156(const char *URL)
curl_global_cleanup(); curl_global_cleanup();
curl_mprintf("%d\n", status); curl_mprintf("%d\n", status);
return (CURLcode)status; return status ? TEST_ERR_FAILURE : CURLE_OK;
test_cleanup: test_cleanup:

View file

@ -63,7 +63,7 @@ static CURLcode test_lib1509(const char *URL)
easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L); easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
code = curl_easy_perform(curl); code = curl_easy_perform(curl);
if(CURLE_OK != code) { if(code != CURLE_OK) {
curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, " curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
"with code %d (%s)\n", "with code %d (%s)\n",
__FILE__, __LINE__, code, curl_easy_strerror(code)); __FILE__, __LINE__, code, curl_easy_strerror(code));
@ -72,7 +72,7 @@ static CURLcode test_lib1509(const char *URL)
} }
code = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize); code = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &headerSize);
if(CURLE_OK != code) { if(code != CURLE_OK) {
curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, " curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
"with code %d (%s)\n", "with code %d (%s)\n",
__FILE__, __LINE__, code, curl_easy_strerror(code)); __FILE__, __LINE__, code, curl_easy_strerror(code));

View file

@ -28,7 +28,7 @@
struct pair { struct pair {
const char *in; const char *in;
CURLcode *exp; CURLcode *result_exp;
}; };
static CURLcode test_lib1597(const char *URL) static CURLcode test_lib1597(const char *URL)
@ -95,7 +95,7 @@ static CURLcode test_lib1597(const char *URL)
/* Run the tests. */ /* Run the tests. */
for(i = 0; prots[i].in; i++) { for(i = 0; prots[i].in; i++) {
result = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, prots[i].in); result = curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, prots[i].in);
if(result != *prots[i].exp) { if(result != *prots[i].result_exp) {
curl_mprintf("unexpectedly '%s' returned %d\n", prots[i].in, result); curl_mprintf("unexpectedly '%s' returned %d\n", prots[i].in, result);
break; break;
} }

View file

@ -35,16 +35,16 @@ static CURLcode test_lib1939(const char *URL)
if(multi) { if(multi) {
curl = curl_easy_init(); curl = curl_easy_init();
if(curl) { if(curl) {
CURLcode c; CURLcode result;
CURLMcode mresult; CURLMcode mresult;
/* Crash only happens when using HTTPS */ /* Crash only happens when using HTTPS */
c = curl_easy_setopt(curl, CURLOPT_URL, URL); result = curl_easy_setopt(curl, CURLOPT_URL, URL);
if(!c) if(!result)
/* Any old HTTP tunneling proxy will do here */ /* Any old HTTP tunneling proxy will do here */
c = curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); result = curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
if(!c) { if(!result) {
/* We are going to drive the transfer using multi interface here, /* We are going to drive the transfer using multi interface here,
because we want to stop during the middle. */ because we want to stop during the middle. */

View file

@ -35,19 +35,19 @@ static size_t callback(char *ptr, size_t size, size_t nmemb, void *data)
ssize_t idx = ((CURL **)data) - ntlm_curls; ssize_t idx = ((CURL **)data) - ntlm_curls;
curl_socket_t sock; curl_socket_t sock;
long longdata; long longdata;
CURLcode code; CURLcode result;
const size_t failure = (size && nmemb) ? 0 : 1; const size_t failure = (size && nmemb) ? 0 : 1;
(void)ptr; (void)ptr;
ntlm_counter[idx] += (int)(size * nmemb); ntlm_counter[idx] += (int)(size * nmemb);
/* Get socket being used for this easy handle, otherwise CURL_SOCKET_BAD */ /* Get socket being used for this easy handle, otherwise CURL_SOCKET_BAD */
code = curl_easy_getinfo(ntlm_curls[idx], CURLINFO_LASTSOCKET, &longdata); result = curl_easy_getinfo(ntlm_curls[idx], CURLINFO_LASTSOCKET, &longdata);
if(CURLE_OK != code) { if(result != CURLE_OK) {
curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, " curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
"with code %d (%s)\n", "with code %d (%s)\n",
__FILE__, __LINE__, code, curl_easy_strerror(code)); __FILE__, __LINE__, result, curl_easy_strerror(result));
ntlmcb_res = TEST_ERR_MAJOR_BAD; ntlmcb_res = TEST_ERR_MAJOR_BAD;
return failure; return failure;
} }

View file

@ -42,7 +42,7 @@ static CURLcode test_lib3026(const char *URL)
CURLcode results[NUM_THREADS]; CURLcode results[NUM_THREADS];
HANDLE thread_handles[NUM_THREADS]; HANDLE thread_handles[NUM_THREADS];
unsigned tid_count = NUM_THREADS, i; unsigned tid_count = NUM_THREADS, i;
CURLcode test_failure = CURLE_OK; CURLcode result = CURLE_OK;
curl_version_info_data *ver; curl_version_info_data *ver;
(void)URL; (void)URL;
@ -63,7 +63,7 @@ static CURLcode test_lib3026(const char *URL)
"GetLastError 0x%08lx\n", "GetLastError 0x%08lx\n",
__FILE__, __LINE__, GetLastError()); __FILE__, __LINE__, GetLastError());
tid_count = i; tid_count = i;
test_failure = TEST_ERR_MAJOR_BAD; result = TEST_ERR_MAJOR_BAD;
goto cleanup; goto cleanup;
} }
thread_handles[i] = th; thread_handles[i] = th;
@ -77,11 +77,11 @@ cleanup:
curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed," curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
"with code %d (%s)\n", __FILE__, __LINE__, "with code %d (%s)\n", __FILE__, __LINE__,
i, results[i], curl_easy_strerror(results[i])); i, results[i], curl_easy_strerror(results[i]));
test_failure = TEST_ERR_MAJOR_BAD; result = TEST_ERR_MAJOR_BAD;
} }
} }
return test_failure; return result;
} }
#elif defined(HAVE_PTHREAD_H) #elif defined(HAVE_PTHREAD_H)
@ -103,7 +103,7 @@ static CURLcode test_lib3026(const char *URL)
CURLcode results[NUM_THREADS]; CURLcode results[NUM_THREADS];
pthread_t tids[NUM_THREADS]; pthread_t tids[NUM_THREADS];
unsigned tid_count = NUM_THREADS, i; unsigned tid_count = NUM_THREADS, i;
CURLcode test_failure = CURLE_OK; CURLcode result = CURLE_OK;
curl_version_info_data *ver; curl_version_info_data *ver;
(void)URL; (void)URL;
@ -123,7 +123,7 @@ static CURLcode test_lib3026(const char *URL)
curl_mfprintf(stderr, "%s:%d Could not create thread, errno %d\n", curl_mfprintf(stderr, "%s:%d Could not create thread, errno %d\n",
__FILE__, __LINE__, res); __FILE__, __LINE__, res);
tid_count = i; tid_count = i;
test_failure = TEST_ERR_MAJOR_BAD; result = TEST_ERR_MAJOR_BAD;
goto cleanup; goto cleanup;
} }
} }
@ -135,11 +135,11 @@ cleanup:
curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed," curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
"with code %d (%s)\n", __FILE__, __LINE__, "with code %d (%s)\n", __FILE__, __LINE__,
i, results[i], curl_easy_strerror(results[i])); i, results[i], curl_easy_strerror(results[i]));
test_failure = TEST_ERR_MAJOR_BAD; result = TEST_ERR_MAJOR_BAD;
} }
} }
return test_failure; return result;
} }
#else /* without pthread or Windows, this test does not work */ #else /* without pthread or Windows, this test does not work */

View file

@ -25,7 +25,7 @@
static CURLcode test_lib3027(const char *URL) static CURLcode test_lib3027(const char *URL)
{ {
CURLcode ret = CURLE_OK; CURLcode result = CURLE_OK;
CURL *curl; CURL *curl;
start_test_timing(); start_test_timing();
@ -35,18 +35,18 @@ static CURLcode test_lib3027(const char *URL)
if(curl) { if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
ret = curl_easy_perform(curl); result = curl_easy_perform(curl);
if(CURLE_OK == ret) { if(result == CURLE_OK) {
long filetime; long filetime;
ret = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
/* MTDM fails with 550, so filetime should be -1 */ /* MTDM fails with 550, so filetime should be -1 */
if((CURLE_OK == ret) && (filetime != -1)) { if((result == CURLE_OK) && (filetime != -1)) {
/* we just need to return something which is not CURLE_OK */ /* we just need to return something which is not CURLE_OK */
ret = CURLE_UNSUPPORTED_PROTOCOL; result = CURLE_UNSUPPORTED_PROTOCOL;
} }
} }
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} }
curl_global_cleanup(); curl_global_cleanup();
return ret; return result;
} }

View file

@ -28,11 +28,11 @@
static CURLcode test_lib512(const char *URL) static CURLcode test_lib512(const char *URL)
{ {
CURLcode code; CURLcode result;
int rc = 99; int rc = 99;
code = curl_global_init(CURL_GLOBAL_ALL); result = curl_global_init(CURL_GLOBAL_ALL);
if(code == CURLE_OK) { if(result == CURLE_OK) {
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
if(curl) { if(curl) {
CURL *curl2; CURL *curl2;
@ -43,11 +43,11 @@ static CURLcode test_lib512(const char *URL)
curl2 = curl_easy_duphandle(curl); curl2 = curl_easy_duphandle(curl);
if(curl2) { if(curl2) {
code = curl_easy_setopt(curl2, CURLOPT_URL, URL); result = curl_easy_setopt(curl2, CURLOPT_URL, URL);
if(code == CURLE_OK) { if(result == CURLE_OK) {
code = curl_easy_perform(curl2); result = curl_easy_perform(curl2);
if(code == CURLE_OK) if(result == CURLE_OK)
rc = 0; rc = 0;
else else
rc = 1; rc = 1;

View file

@ -389,28 +389,28 @@ test_cleanup:
static CURLcode test_lib530(const char *URL) static CURLcode test_lib530(const char *URL)
{ {
CURLcode rc; CURLcode result;
/* rerun the same transfer multiple times and make it fail in different /* rerun the same transfer multiple times and make it fail in different
callback calls */ callback calls */
rc = testone(URL, 0, 0); /* no callback fails */ result = testone(URL, 0, 0); /* no callback fails */
if(rc) if(result)
curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc); curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
rc = testone(URL, 1, 0); /* fail 1st call to timer callback */ result = testone(URL, 1, 0); /* fail 1st call to timer callback */
if(!rc) if(!result)
curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc); curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
rc = testone(URL, 2, 0); /* fail 2nd call to timer callback */ result = testone(URL, 2, 0); /* fail 2nd call to timer callback */
if(!rc) if(!result)
curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc); curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
rc = testone(URL, 0, 1); /* fail 1st call to socket callback */ result = testone(URL, 0, 1); /* fail 1st call to socket callback */
if(!rc) if(!result)
curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc); curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
rc = testone(URL, 0, 2); /* fail 2nd call to socket callback */ result = testone(URL, 0, 2); /* fail 2nd call to socket callback */
if(!rc) if(!result)
curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc); curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
return CURLE_OK; return CURLE_OK;
} }

View file

@ -97,7 +97,7 @@ static void t586_test_unlock(CURL *curl, curl_lock_data data, void *useptr)
/* the dummy thread function */ /* the dummy thread function */
static void *t586_test_fire(void *ptr) static void *t586_test_fire(void *ptr)
{ {
CURLcode code; CURLcode result;
struct t586_Tdata *tdata = (struct t586_Tdata *)ptr; struct t586_Tdata *tdata = (struct t586_Tdata *)ptr;
CURL *curl; CURL *curl;
@ -114,11 +114,11 @@ static void *t586_test_fire(void *ptr)
curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share); curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share);
curl_mprintf("PERFORM\n"); curl_mprintf("PERFORM\n");
code = curl_easy_perform(curl); result = curl_easy_perform(curl);
if(code != CURLE_OK) { if(result != CURLE_OK) {
int i = 0; int i = 0;
curl_mfprintf(stderr, "perform URL '%s' repeat %d failed, curlcode %d\n", curl_mfprintf(stderr, "perform URL '%s' repeat %d failed, curlcode %d\n",
tdata->url, i, code); tdata->url, i, result);
} }
curl_mprintf("CLEANUP\n"); curl_mprintf("CLEANUP\n");

View file

@ -224,19 +224,19 @@ static CURLcode t643_cyclic_add(void)
CURL *curl = curl_easy_init(); CURL *curl = curl_easy_init();
curl_mime *mime = curl_mime_init(curl); curl_mime *mime = curl_mime_init(curl);
curl_mimepart *part = curl_mime_addpart(mime); curl_mimepart *part = curl_mime_addpart(mime);
CURLcode a1 = curl_mime_subparts(part, mime); CURLcode result = curl_mime_subparts(part, mime);
if(a1 == CURLE_BAD_FUNCTION_ARGUMENT) { if(result == CURLE_BAD_FUNCTION_ARGUMENT) {
curl_mime *submime = curl_mime_init(curl); curl_mime *submime = curl_mime_init(curl);
curl_mimepart *subpart = curl_mime_addpart(submime); curl_mimepart *subpart = curl_mime_addpart(submime);
curl_mime_subparts(part, submime); curl_mime_subparts(part, submime);
a1 = curl_mime_subparts(subpart, mime); result = curl_mime_subparts(subpart, mime);
} }
curl_mime_free(mime); curl_mime_free(mime);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
if(a1 != CURLE_BAD_FUNCTION_ARGUMENT) if(result != CURLE_BAD_FUNCTION_ARGUMENT)
/* that should have failed */ /* that should have failed */
return TEST_ERR_FAILURE; return TEST_ERR_FAILURE;

View file

@ -60,7 +60,7 @@ static int loadfile(const char *filename, void **filedata, size_t *filesize)
static CURLcode 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; CURLcode result = CURLE_OUT_OF_MEMORY;
CURL *curl; CURL *curl;
struct curl_blob blob; struct curl_blob blob;
size_t certsize; size_t certsize;
@ -84,11 +84,11 @@ static CURLcode test_cert_blob(const char *url, const char *cafile)
blob.flags = CURL_BLOB_COPY; blob.flags = CURL_BLOB_COPY;
curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob); curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob);
curlx_free(certdata); curlx_free(certdata);
code = curl_easy_perform(curl); result = curl_easy_perform(curl);
} }
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
return code; return result;
} }
static CURLcode test_lib678(const char *URL) static CURLcode test_lib678(const char *URL)

View file

@ -307,15 +307,15 @@ static CURLMcode t758_checkFdSet(CURLM *multi, struct t758_Sockets *sockets,
const char *name) const char *name)
{ {
int i; int i;
CURLMcode result = CURLM_OK; CURLMcode mresult = CURLM_OK;
for(i = 0; i < sockets->count; ++i) { for(i = 0; i < sockets->count; ++i) {
if(FD_ISSET(sockets->sockets[i], fdset)) { if(FD_ISSET(sockets->sockets[i], fdset)) {
result = t758_saction(multi, sockets->sockets[i], evBitmask, name); mresult = t758_saction(multi, sockets->sockets[i], evBitmask, name);
if(result) if(mresult)
break; break;
} }
} }
return result; return mresult;
} }
static CURLcode t758_one(const char *URL, int timer_fail_at, static CURLcode t758_one(const char *URL, int timer_fail_at,
@ -485,14 +485,14 @@ test_cleanup:
static CURLcode test_lib758(const char *URL) static CURLcode test_lib758(const char *URL)
{ {
CURLcode rc; CURLcode result;
/* rerun the same transfer multiple times and make it fail in different /* rerun the same transfer multiple times and make it fail in different
callback calls */ callback calls */
rc = t758_one(URL, 0, 0); /* no callback fails */ result = t758_one(URL, 0, 0); /* no callback fails */
if(rc) if(result)
curl_mfprintf(stderr, "%s FAILED: %d\n", t758_tag(), rc); curl_mfprintf(stderr, "%s FAILED: %d\n", t758_tag(), result);
return rc; return result;
} }
#else /* T578_ENABLED */ #else /* T578_ENABLED */

View file

@ -185,7 +185,7 @@ static int appenddata(char **dst_buf, /* dest buffer */
static int decodedata(char **buf, /* dest buffer */ static int decodedata(char **buf, /* dest buffer */
size_t *len) /* dest buffer data length */ size_t *len) /* dest buffer data length */
{ {
CURLcode error = CURLE_OK; CURLcode result = CURLE_OK;
unsigned char *buf64 = NULL; unsigned char *buf64 = NULL;
size_t src_len = 0; size_t src_len = 0;
@ -193,8 +193,8 @@ static int decodedata(char **buf, /* dest buffer */
return GPE_OK; return GPE_OK;
/* base64 decode the given buffer */ /* base64 decode the given buffer */
error = curlx_base64_decode(*buf, &buf64, &src_len); result = curlx_base64_decode(*buf, &buf64, &src_len);
if(error) if(result)
return GPE_OUT_OF_MEMORY; return GPE_OUT_OF_MEMORY;
if(!src_len) { if(!src_len) {

View file

@ -36,7 +36,7 @@ struct etest {
static CURLcode test_unit1302(const char *arg) static CURLcode test_unit1302(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE UNITTEST_BEGIN_SIMPLE
CURLcode rc; CURLcode result;
unsigned int i; unsigned int i;
/* common base64 encoding */ /* common base64 encoding */
@ -132,8 +132,9 @@ static CURLcode test_unit1302(const char *arg)
size_t dlen; size_t dlen;
/* first encode */ /* first encode */
rc = curlx_base64_encode((const uint8_t *)e->input, e->ilen, &out, &olen); result = curlx_base64_encode((const uint8_t *)e->input, e->ilen,
abort_unless(rc == CURLE_OK, "return code should be CURLE_OK"); &out, &olen);
abort_unless(result == CURLE_OK, "return code should be CURLE_OK");
abort_unless(olen == e->olen, "wrong output size"); abort_unless(olen == e->olen, "wrong output size");
if(memcmp(out, e->output, e->olen)) { if(memcmp(out, e->output, e->olen)) {
curl_mfprintf(stderr, "Test %u encoded badly\n", i); curl_mfprintf(stderr, "Test %u encoded badly\n", i);
@ -142,9 +143,10 @@ static CURLcode test_unit1302(const char *arg)
Curl_safefree(out); Curl_safefree(out);
/* then verify decode */ /* then verify decode */
rc = curlx_base64_decode(e->output, &decoded, &dlen); result = curlx_base64_decode(e->output, &decoded, &dlen);
if(rc != CURLE_OK) { if(result != CURLE_OK) {
curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i, (int)rc); curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i,
(int)result);
unitfail++; unitfail++;
} }
if(dlen != e->ilen) { if(dlen != e->ilen) {
@ -165,9 +167,9 @@ static CURLcode test_unit1302(const char *arg)
struct etest *e = &url[i]; struct etest *e = &url[i];
char *out; char *out;
size_t olen; size_t olen;
rc = curlx_base64url_encode((const uint8_t *)e->input, e->ilen, result = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
&out, &olen); &out, &olen);
abort_unless(rc == CURLE_OK, "return code should be CURLE_OK"); abort_unless(result == CURLE_OK, "return code should be CURLE_OK");
if(olen != e->olen) { if(olen != e->olen) {
curl_mfprintf(stderr, "Test %u URL encoded output length %zu " curl_mfprintf(stderr, "Test %u URL encoded output length %zu "
"instead of %zu\n", i, olen, e->olen); "instead of %zu\n", i, olen, e->olen);
@ -186,11 +188,11 @@ static CURLcode test_unit1302(const char *arg)
size_t dlen; size_t dlen;
/* then verify decode with illegal inputs */ /* then verify decode with illegal inputs */
rc = curlx_base64_decode(e->output, &decoded, &dlen); result = curlx_base64_decode(e->output, &decoded, &dlen);
if(rc != CURLE_BAD_CONTENT_ENCODING) { if(result != CURLE_BAD_CONTENT_ENCODING) {
curl_mfprintf(stderr, "Test %u URL bad decoded badly. " curl_mfprintf(stderr, "Test %u URL bad decoded badly. "
"Returned '%d', expected '%d'\n", "Returned '%d', expected '%d'\n",
i, (int)rc, CURLE_BAD_CONTENT_ENCODING); i, (int)result, CURLE_BAD_CONTENT_ENCODING);
unitfail++; unitfail++;
} }
} }

View file

@ -106,8 +106,8 @@ static CURLcode test_unit1305(const char *arg)
/* Test 1305 exits without adding anything to the hash */ /* Test 1305 exits without adding anything to the hash */
if(testnum == 1306) { if(testnum == 1306) {
CURLcode rc = create_node(); CURLcode result = create_node();
abort_unless(rc == CURLE_OK, "data node creation failed"); abort_unless(result == CURLE_OK, "data node creation failed");
key_len = strlen(data_key); key_len = strlen(data_key);
data_node->refcount = 1; /* hash will hold the reference */ data_node->refcount = 1; /* hash will hold the reference */

View file

@ -48,14 +48,14 @@ static CURLcode test_unit1608(const char *arg)
UNITTEST_BEGIN(t1608_setup()) UNITTEST_BEGIN(t1608_setup())
int i; int i;
CURLcode code; CURLcode result;
struct Curl_addrinfo *addrhead = addrs; struct Curl_addrinfo *addrhead = addrs;
struct Curl_easy *easy = curl_easy_init(); struct Curl_easy *easy = curl_easy_init();
abort_unless(easy, "out of memory"); abort_unless(easy, "out of memory");
code = curl_easy_setopt(easy, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L); result = curl_easy_setopt(easy, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
abort_unless(code == CURLE_OK, "curl_easy_setopt failed"); abort_unless(result == CURLE_OK, "curl_easy_setopt failed");
/* Shuffle repeatedly and make sure that the list changes */ /* Shuffle repeatedly and make sure that the list changes */
for(i = 0; i < 10; i++) { for(i = 0; i < 10; i++) {

View file

@ -41,9 +41,9 @@ static void t1620_parse(const char *input,
char *userstr = NULL; char *userstr = NULL;
char *passwdstr = NULL; char *passwdstr = NULL;
char *options = NULL; char *options = NULL;
CURLcode rc = Curl_parse_login_details(input, strlen(input), &userstr, CURLcode result = Curl_parse_login_details(input, strlen(input), &userstr,
&passwdstr, &options); &passwdstr, &options);
fail_unless(rc == CURLE_OK, "Curl_parse_login_details() failed"); fail_unless(result == CURLE_OK, "Curl_parse_login_details() failed");
fail_unless(!!exp_username == !!userstr, "username expectation failed"); fail_unless(!!exp_username == !!userstr, "username expectation failed");
fail_unless(!!exp_password == !!passwdstr, "password expectation failed"); fail_unless(!!exp_password == !!passwdstr, "password expectation failed");
@ -70,32 +70,32 @@ static CURLcode test_unit1620(const char *arg)
{ {
UNITTEST_BEGIN(t1620_setup()) UNITTEST_BEGIN(t1620_setup())
CURLcode rc; CURLcode result;
struct Curl_easy *empty; struct Curl_easy *empty;
enum dupstring i; enum dupstring i;
bool async = FALSE; bool async = FALSE;
bool protocol_connect = FALSE; bool protocol_connect = FALSE;
rc = Curl_open(&empty); result = Curl_open(&empty);
if(rc) if(result)
goto unit_test_abort; goto unit_test_abort;
fail_unless(rc == CURLE_OK, "Curl_open() failed"); fail_unless(result == CURLE_OK, "Curl_open() failed");
rc = Curl_connect(empty, &async, &protocol_connect); result = Curl_connect(empty, &async, &protocol_connect);
fail_unless(rc == CURLE_URL_MALFORMAT, fail_unless(result == CURLE_URL_MALFORMAT,
"Curl_connect() failed to return CURLE_URL_MALFORMAT"); "Curl_connect() failed to return CURLE_URL_MALFORMAT");
fail_unless(empty->magic == CURLEASY_MAGIC_NUMBER, fail_unless(empty->magic == CURLEASY_MAGIC_NUMBER,
"empty->magic should be equal to CURLEASY_MAGIC_NUMBER"); "empty->magic should be equal to CURLEASY_MAGIC_NUMBER");
/* double invoke to ensure no dependency on internal state */ /* double invoke to ensure no dependency on internal state */
rc = Curl_connect(empty, &async, &protocol_connect); result = Curl_connect(empty, &async, &protocol_connect);
fail_unless(rc == CURLE_URL_MALFORMAT, fail_unless(result == CURLE_URL_MALFORMAT,
"Curl_connect() failed to return CURLE_URL_MALFORMAT"); "Curl_connect() failed to return CURLE_URL_MALFORMAT");
rc = Curl_init_do(empty, empty->conn); result = Curl_init_do(empty, empty->conn);
fail_unless(rc == CURLE_OK, "Curl_init_do() failed"); fail_unless(result == CURLE_OK, "Curl_init_do() failed");
t1620_parse("hostname", "hostname", NULL, NULL); t1620_parse("hostname", "hostname", NULL, NULL);
t1620_parse("user:password", "user", "password", NULL); t1620_parse("user:password", "user", "password", NULL);
@ -118,8 +118,8 @@ static CURLcode test_unit1620(const char *arg)
fail_unless(empty->set.str[i] == NULL, "Curl_free() did not set to NULL"); fail_unless(empty->set.str[i] == NULL, "Curl_free() did not set to NULL");
} }
rc = Curl_close(&empty); result = Curl_close(&empty);
fail_unless(rc == CURLE_OK, "Curl_close() failed"); fail_unless(result == CURLE_OK, "Curl_close() failed");
UNITTEST_END(curl_global_cleanup()) UNITTEST_END(curl_global_cleanup())
} }

View file

@ -364,7 +364,7 @@ static CURLcode test_unit1651(const char *arg)
0x48, 0x88, 0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB, 0x48, 0x88, 0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB,
}; };
CURLcode res; CURLcode result;
const char *beg = (const char *)&cert[0]; const char *beg = (const char *)&cert[0];
const char *end = (const char *)&cert[sizeof(cert)]; const char *end = (const char *)&cert[sizeof(cert)];
struct Curl_easy *data; struct Curl_easy *data;
@ -378,9 +378,9 @@ static CURLcode test_unit1651(const char *arg)
data = curl_easy_init(); data = curl_easy_init();
if(data) { if(data) {
res = Curl_extract_certinfo(data, 0, beg, end); result = Curl_extract_certinfo(data, 0, beg, end);
fail_unless(res == CURLE_OK, "Curl_extract_certinfo returned error"); fail_unless(result == CURLE_OK, "Curl_extract_certinfo returned error");
/* a poor man's fuzzing of some initial data to make sure nothing bad /* a poor man's fuzzing of some initial data to make sure nothing bad
happens */ happens */

View file

@ -33,12 +33,12 @@ static CURLcode test_unit1654(const char *arg)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC) #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
char outname[256]; char outname[256];
CURL *curl; CURL *curl;
CURLcode res; CURLcode result;
struct altsvcinfo *asi = Curl_altsvc_init(); struct altsvcinfo *asi = Curl_altsvc_init();
abort_if(!asi, "Curl_altsvc_i"); abort_if(!asi, "Curl_altsvc_i");
res = Curl_altsvc_load(asi, arg); result = Curl_altsvc_load(asi, arg);
if(res) { if(result) {
fail_if(res, "Curl_altsvc_load"); fail_if(result, "Curl_altsvc_load");
goto fail; goto fail;
} }
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
@ -50,92 +50,92 @@ static CURLcode test_unit1654(const char *arg)
fail_unless(Curl_llist_count(&asi->list) == 4, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 4, "wrong number of entries");
curl_msnprintf(outname, sizeof(outname), "%s-out", arg); curl_msnprintf(outname, sizeof(outname), "%s-out", arg);
res = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n", result = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
ALPN_h1, "example.org", 8080); ALPN_h1, "example.org", 8080);
fail_if(res, "Curl_altsvc_parse() failed!"); fail_if(result, "Curl_altsvc_parse() failed!");
fail_unless(Curl_llist_count(&asi->list) == 5, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 5, "wrong number of entries");
res = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n", result = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
ALPN_h1, "2.example.org", 8080); ALPN_h1, "2.example.org", 8080);
fail_if(res, "Curl_altsvc_parse(2) failed!"); fail_if(result, "Curl_altsvc_parse(2) failed!");
fail_unless(Curl_llist_count(&asi->list) == 6, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 6, "wrong number of entries");
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"example.com:8080\", " "h2=\"example.com:8080\", "
"h3=\"yesyes.com:8080\"\r\n", "h3=\"yesyes.com:8080\"\r\n",
ALPN_h1, "3.example.org", 8080); ALPN_h1, "3.example.org", 8080);
fail_if(res, "Curl_altsvc_parse(3) failed!"); fail_if(result, "Curl_altsvc_parse(3) failed!");
/* that one should make two entries */ /* that one should make two entries */
fail_unless(Curl_llist_count(&asi->list) == 8, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 8, "wrong number of entries");
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"example.com:443\"; ma = 120;\r\n", "h2=\"example.com:443\"; ma = 120;\r\n",
ALPN_h2, "example.org", 80); ALPN_h2, "example.org", 80);
fail_if(res, "Curl_altsvc_parse(4) failed!"); fail_if(result, "Curl_altsvc_parse(4) failed!");
fail_unless(Curl_llist_count(&asi->list) == 9, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 9, "wrong number of entries");
/* quoted 'ma' value */ /* quoted 'ma' value */
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"example.net:443\"; ma=\"180\";\r\n", "h2=\"example.net:443\"; ma=\"180\";\r\n",
ALPN_h2, "example.net", 80); ALPN_h2, "example.net", 80);
fail_if(res, "Curl_altsvc_parse(5) failed!"); fail_if(result, "Curl_altsvc_parse(5) failed!");
fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\":443\"; ma=180, h3=\":443\"; " "h2=\":443\"; ma=180, h3=\":443\"; "
"persist = \"1\"; ma = 120;\r\n", "persist = \"1\"; ma = 120;\r\n",
ALPN_h1, "curl.se", 80); ALPN_h1, "curl.se", 80);
fail_if(res, "Curl_altsvc_parse(6) failed!"); fail_if(result, "Curl_altsvc_parse(6) failed!");
fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
/* clear that one again and decrease the counter */ /* clear that one again and decrease the counter */
res = Curl_altsvc_parse(curl, asi, "clear;\r\n", result = Curl_altsvc_parse(curl, asi, "clear;\r\n",
ALPN_h1, "curl.se", 80); ALPN_h1, "curl.se", 80);
fail_if(res, "Curl_altsvc_parse(7) failed!"); fail_if(result, "Curl_altsvc_parse(7) failed!");
fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\":443\", h3=\":443\"; " "h2=\":443\", h3=\":443\"; "
"persist = \"1\"; ma = 120;\r\n", "persist = \"1\"; ma = 120;\r\n",
ALPN_h1, "curl.se", 80); ALPN_h1, "curl.se", 80);
fail_if(res, "Curl_altsvc_parse(6) failed!"); fail_if(result, "Curl_altsvc_parse(6) failed!");
fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
/* clear - without semicolon */ /* clear - without semicolon */
res = Curl_altsvc_parse(curl, asi, "clear\r\n", result = Curl_altsvc_parse(curl, asi, "clear\r\n",
ALPN_h1, "curl.se", 80); ALPN_h1, "curl.se", 80);
fail_if(res, "Curl_altsvc_parse(7) failed!"); fail_if(result, "Curl_altsvc_parse(7) failed!");
fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries"); fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
/* only a non-existing alpn */ /* only a non-existing alpn */
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h6=\"example.net:443\"; ma=\"180\";\r\n", "h6=\"example.net:443\"; ma=\"180\";\r\n",
ALPN_h2, "5.example.net", 80); ALPN_h2, "5.example.net", 80);
fail_if(res, "Curl_altsvc_parse(8) failed!"); fail_if(result, "Curl_altsvc_parse(8) failed!");
/* missing quote in alpn host */ /* missing quote in alpn host */
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"example.net:443,; ma=\"180\";\r\n", "h2=\"example.net:443,; ma=\"180\";\r\n",
ALPN_h2, "6.example.net", 80); ALPN_h2, "6.example.net", 80);
fail_if(res, "Curl_altsvc_parse(9) failed!"); fail_if(result, "Curl_altsvc_parse(9) failed!");
/* missing port in hostname */ /* missing port in hostname */
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"example.net\"; ma=\"180\";\r\n", "h2=\"example.net\"; ma=\"180\";\r\n",
ALPN_h2, "7.example.net", 80); ALPN_h2, "7.example.net", 80);
fail_if(res, "Curl_altsvc_parse(10) failed!"); fail_if(result, "Curl_altsvc_parse(10) failed!");
/* illegal port in hostname */ /* illegal port in hostname */
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"example.net:70000\"; ma=\"180\";\r\n", "h2=\"example.net:70000\"; ma=\"180\";\r\n",
ALPN_h2, "8.example.net", 80); ALPN_h2, "8.example.net", 80);
fail_if(res, "Curl_altsvc_parse(11) failed!"); fail_if(result, "Curl_altsvc_parse(11) failed!");
res = Curl_altsvc_parse(curl, asi, result = Curl_altsvc_parse(curl, asi,
"h2=\"test2.se:443\"; ma=\"180 \" ; unknown=2, " "h2=\"test2.se:443\"; ma=\"180 \" ; unknown=2, "
"h2=\"test3.se:443\"; ma = 120;\r\n", "h2=\"test3.se:443\"; ma = 120;\r\n",
ALPN_h2, "test.se", 443); ALPN_h2, "test.se", 443);
fail_if(res, "Curl_altsvc_parse(12) failed!"); fail_if(result, "Curl_altsvc_parse(12) failed!");
Curl_altsvc_save(curl, asi, outname); Curl_altsvc_save(curl, asi, outname);

View file

@ -30,23 +30,23 @@
struct test_spec { struct test_spec {
const char *input; const char *input;
const char *exp_output; const char *exp_output;
CURLcode exp_res; CURLcode result_exp;
}; };
static bool do_test(const struct test_spec *spec, size_t i, static bool do_test(const struct test_spec *spec, size_t i,
struct dynbuf *dbuf) struct dynbuf *dbuf)
{ {
CURLcode res; CURLcode result;
const char *in = spec->input; const char *in = spec->input;
curlx_dyn_reset(dbuf); curlx_dyn_reset(dbuf);
res = Curl_x509_GTime2str(dbuf, in, in + strlen(in)); result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
if(res != spec->exp_res) { if(result != spec->result_exp) {
curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n", curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
i, spec->exp_res, res); i, spec->result_exp, result);
return FALSE; return FALSE;
} }
else if(!res && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) { else if(!result && strcmp(spec->exp_output, curlx_dyn_ptr(dbuf))) {
curl_mfprintf(stderr, curl_mfprintf(stderr,
"test %zu: input '%s', expected output '%s', got '%s'\n", "test %zu: input '%s', expected output '%s', got '%s'\n",
i, in, spec->exp_output, curlx_dyn_ptr(dbuf)); i, in, spec->exp_output, curlx_dyn_ptr(dbuf));

View file

@ -30,26 +30,26 @@
struct test1657_spec { struct test1657_spec {
CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf); CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
size_t n; size_t n;
CURLcode exp_res; CURLcode result_exp;
}; };
static CURLcode make1657_nested(const struct test1657_spec *spec, static CURLcode make1657_nested(const struct test1657_spec *spec,
struct dynbuf *buf) struct dynbuf *buf)
{ {
CURLcode r; CURLcode result;
size_t i; size_t i;
unsigned char open_undef[] = { 0x32, 0x80 }; unsigned char open_undef[] = { 0x32, 0x80 };
unsigned char close_undef[] = { 0x00, 0x00 }; unsigned char close_undef[] = { 0x00, 0x00 };
for(i = 0; i < spec->n; ++i) { for(i = 0; i < spec->n; ++i) {
r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef)); result = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
if(r) if(result)
return r; return result;
} }
for(i = 0; i < spec->n; ++i) { for(i = 0; i < spec->n; ++i) {
r = curlx_dyn_addn(buf, close_undef, sizeof(close_undef)); result = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
if(r) if(result)
return r; return result;
} }
return CURLE_OK; return CURLE_OK;
} }
@ -64,22 +64,22 @@ static const struct test1657_spec test1657_specs[] = {
static bool do_test1657(const struct test1657_spec *spec, size_t i, static bool do_test1657(const struct test1657_spec *spec, size_t i,
struct dynbuf *buf) struct dynbuf *buf)
{ {
CURLcode res; CURLcode result;
struct Curl_asn1Element elem; struct Curl_asn1Element elem;
const char *in; const char *in;
memset(&elem, 0, sizeof(elem)); memset(&elem, 0, sizeof(elem));
curlx_dyn_reset(buf); curlx_dyn_reset(buf);
res = spec->setbuf(spec, buf); result = spec->setbuf(spec, buf);
if(res) { if(result) {
curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, res); curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, result);
return FALSE; return FALSE;
} }
in = curlx_dyn_ptr(buf); in = curlx_dyn_ptr(buf);
res = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf)); result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
if(res != spec->exp_res) { if(result != spec->result_exp) {
curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n", curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
i, spec->exp_res, res); i, spec->result_exp, result);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;

View file

@ -45,9 +45,9 @@ static CURLcode test_unit1660(const char *arg)
struct testit { struct testit {
const char *host; const char *host;
const char *chost; /* if non-NULL, use to lookup with */ const char *chost; /* if non-NULL, use to lookup with */
const char *hdr; /* if NULL, just do the lookup */ const char *hdr; /* if NULL, just do the lookup */
const CURLcode res; /* parse result */ const CURLcode result; /* parse result */
}; };
static const struct testit headers[] = { static const struct testit headers[] = {
@ -102,7 +102,7 @@ static CURLcode test_unit1660(const char *arg)
{ NULL, NULL, NULL, CURLE_OK } { NULL, NULL, NULL, CURLE_OK }
}; };
CURLcode res; CURLcode result;
struct stsentry *e; struct stsentry *e;
struct hsts *h = Curl_hsts_init(); struct hsts *h = Curl_hsts_init();
int i; int i;
@ -124,16 +124,16 @@ static CURLcode test_unit1660(const char *arg)
for(i = 0; headers[i].host; i++) { for(i = 0; headers[i].host; i++) {
if(headers[i].hdr) { if(headers[i].hdr) {
res = Curl_hsts_parse(h, headers[i].host, headers[i].hdr); result = Curl_hsts_parse(h, headers[i].host, headers[i].hdr);
if(res != headers[i].res) { if(result != headers[i].result) {
curl_mfprintf(stderr, "Curl_hsts_parse(%s) failed: %d\n", curl_mfprintf(stderr, "Curl_hsts_parse(%s) failed: %d\n",
headers[i].hdr, res); headers[i].hdr, result);
unitfail++; unitfail++;
continue; continue;
} }
else if(res) { else if(result) {
curl_mprintf("Input %u: error %d\n", i, (int)res); curl_mprintf("Input %u: error %d\n", i, (int)result);
continue; continue;
} }
} }

View file

@ -43,13 +43,13 @@ static void t1663_parse(const char *input_data,
const char *exp_dev, const char *exp_dev,
const char *exp_iface, const char *exp_iface,
const char *exp_host, const char *exp_host,
CURLcode exp_rc) CURLcode result_exp)
{ {
char *dev = NULL; char *dev = NULL;
char *iface = NULL; char *iface = NULL;
char *host = NULL; char *host = NULL;
CURLcode rc = Curl_parse_interface(input_data, &dev, &iface, &host); CURLcode result = Curl_parse_interface(input_data, &dev, &iface, &host);
fail_unless(rc == exp_rc, "Curl_parse_interface() failed"); fail_unless(result == result_exp, "Curl_parse_interface() failed");
fail_unless(!!exp_dev == !!dev, "dev expectation failed."); fail_unless(!!exp_dev == !!dev, "dev expectation failed.");
fail_unless(!!exp_iface == !!iface, "iface expectation failed"); fail_unless(!!exp_iface == !!iface, "iface expectation failed");

View file

@ -83,7 +83,7 @@ struct test_case {
int exp_cf6_creations; int exp_cf6_creations;
timediff_t min_duration_ms; timediff_t min_duration_ms;
timediff_t max_duration_ms; timediff_t max_duration_ms;
CURLcode exp_res; CURLcode result_exp;
const char *pref_family; const char *pref_family;
}; };
@ -242,11 +242,11 @@ static void check_result(const struct test_case *tc, struct test_result *tr)
duration_ms = curlx_timediff_ms(tr->ended, tr->started); duration_ms = curlx_timediff_ms(tr->ended, tr->started);
curl_mfprintf(stderr, "%d: test case took %dms\n", tc->id, (int)duration_ms); curl_mfprintf(stderr, "%d: test case took %dms\n", tc->id, (int)duration_ms);
if(tr->result != tc->exp_res && CURLE_OPERATION_TIMEDOUT != tr->result) { if(tr->result != tc->result_exp && CURLE_OPERATION_TIMEDOUT != tr->result) {
/* on CI we encounter the TIMEOUT result, since images get less CPU /* on CI we encounter the TIMEOUT result, since images get less CPU
* and events are not as sharply timed. */ * and events are not as sharply timed. */
curl_msprintf(msg, "%d: expected result %d but got %d", curl_msprintf(msg, "%d: expected result %d but got %d",
tc->id, tc->exp_res, tr->result); tc->id, tc->result_exp, tr->result);
fail(msg); fail(msg);
} }
if(tr->cf4.creations != tc->exp_cf4_creations) { if(tr->cf4.creations != tc->exp_cf4_creations) {

View file

@ -85,7 +85,7 @@ static void check_bufq(size_t pool_spares,
struct bufq q; struct bufq q;
struct bufc_pool pool; struct bufc_pool pool;
size_t max_len = chunk_size * max_chunks; size_t max_len = chunk_size * max_chunks;
CURLcode res; CURLcode result;
ssize_t i; ssize_t i;
size_t n2; size_t n2;
size_t nwritten, nread; size_t nwritten, nread;
@ -105,20 +105,20 @@ static void check_bufq(size_t pool_spares,
fail_unless(q.spare == NULL, "init: spare not NULL"); fail_unless(q.spare == NULL, "init: spare not NULL");
fail_unless(Curl_bufq_len(&q) == 0, "init: bufq length != 0"); fail_unless(Curl_bufq_len(&q) == 0, "init: bufq length != 0");
res = Curl_bufq_write(&q, test_data, wsize, &n2); result = Curl_bufq_write(&q, test_data, wsize, &n2);
fail_unless(n2 <= wsize, "write: wrong size returned"); fail_unless(n2 <= wsize, "write: wrong size returned");
fail_unless(res == CURLE_OK, "write: wrong result returned"); fail_unless(result == CURLE_OK, "write: wrong result returned");
/* write empty bufq full */ /* write empty bufq full */
nwritten = 0; nwritten = 0;
Curl_bufq_reset(&q); Curl_bufq_reset(&q);
while(!Curl_bufq_is_full(&q)) { while(!Curl_bufq_is_full(&q)) {
res = Curl_bufq_write(&q, test_data, wsize, &n2); result = Curl_bufq_write(&q, test_data, wsize, &n2);
if(!res) { if(!result) {
nwritten += n2; nwritten += n2;
} }
else if(res != CURLE_AGAIN) { else if(result != CURLE_AGAIN) {
fail_unless(res == CURLE_AGAIN, "write-loop: unexpected result"); fail_unless(result == CURLE_AGAIN, "write-loop: unexpected result");
break; break;
} }
} }
@ -132,12 +132,12 @@ static void check_bufq(size_t pool_spares,
/* read full bufq empty */ /* read full bufq empty */
nread = 0; nread = 0;
while(!Curl_bufq_is_empty(&q)) { while(!Curl_bufq_is_empty(&q)) {
res = Curl_bufq_read(&q, test_data, rsize, &n2); result = Curl_bufq_read(&q, test_data, rsize, &n2);
if(!res) { if(!result) {
nread += n2; nread += n2;
} }
else if(res != CURLE_AGAIN) { else if(result != CURLE_AGAIN) {
fail_unless(res == CURLE_AGAIN, "read-loop: unexpected result"); fail_unless(result == CURLE_AGAIN, "read-loop: unexpected result");
break; break;
} }
} }
@ -153,14 +153,14 @@ static void check_bufq(size_t pool_spares,
} }
for(i = 0; i < 1000; ++i) { for(i = 0; i < 1000; ++i) {
res = Curl_bufq_write(&q, test_data, wsize, &n2); result = Curl_bufq_write(&q, test_data, wsize, &n2);
if(res && res != CURLE_AGAIN) { if(result && result != CURLE_AGAIN) {
fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected write result"); fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected write result");
break; break;
} }
res = Curl_bufq_read(&q, test_data, rsize, &n2); result = Curl_bufq_read(&q, test_data, rsize, &n2);
if(res && res != CURLE_AGAIN) { if(result && result != CURLE_AGAIN) {
fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected read result"); fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected read result");
break; break;
} }
} }
@ -170,9 +170,9 @@ static void check_bufq(size_t pool_spares,
Curl_bufq_init2(&q, chunk_size, max_chunks, (opts | BUFQ_OPT_SOFT_LIMIT)); Curl_bufq_init2(&q, chunk_size, max_chunks, (opts | BUFQ_OPT_SOFT_LIMIT));
nwritten = 0; nwritten = 0;
while(!Curl_bufq_is_full(&q)) { while(!Curl_bufq_is_full(&q)) {
res = Curl_bufq_write(&q, test_data, wsize, &n2); result = Curl_bufq_write(&q, test_data, wsize, &n2);
if(res || n2 != wsize) { if(result || n2 != wsize) {
fail_unless(!res && n2 == wsize, "write should be complete"); fail_unless(!result && n2 == wsize, "write should be complete");
break; break;
} }
nwritten += n2; nwritten += n2;
@ -184,15 +184,15 @@ static void check_bufq(size_t pool_spares,
fail_if(TRUE, "write: bufq full but nwritten wrong"); fail_if(TRUE, "write: bufq full but nwritten wrong");
} }
/* do one more write on a full bufq, should work */ /* do one more write on a full bufq, should work */
res = Curl_bufq_write(&q, test_data, wsize, &n2); result = Curl_bufq_write(&q, test_data, wsize, &n2);
fail_unless(!res && n2 == wsize, "write should be complete"); fail_unless(!result && n2 == wsize, "write should be complete");
nwritten += n2; nwritten += n2;
/* see that we get all out again */ /* see that we get all out again */
nread = 0; nread = 0;
while(!Curl_bufq_is_empty(&q)) { while(!Curl_bufq_is_empty(&q)) {
res = Curl_bufq_read(&q, test_data, rsize, &n2); result = Curl_bufq_read(&q, test_data, rsize, &n2);
if(res) { if(result) {
fail_unless(res, "read-loop: unexpected fail"); fail_unless(result, "read-loop: unexpected fail");
break; break;
} }
nread += n2; nread += n2;
@ -211,12 +211,12 @@ static CURLcode test_unit2601(const char *arg)
struct bufq q; struct bufq q;
size_t n; size_t n;
CURLcode res; CURLcode result;
unsigned char buf[16 * 1024]; unsigned char buf[16 * 1024];
Curl_bufq_init(&q, 8 * 1024, 12); Curl_bufq_init(&q, 8 * 1024, 12);
res = Curl_bufq_read(&q, buf, 128, &n); result = Curl_bufq_read(&q, buf, 128, &n);
fail_unless(res && res == CURLE_AGAIN, "read empty fail"); fail_unless(result && result == CURLE_AGAIN, "read empty fail");
Curl_bufq_free(&q); Curl_bufq_free(&q);
check_bufq(0, 1024, 4, 128, 128, BUFQ_OPT_NONE); check_bufq(0, 1024, 4, 128, 128, BUFQ_OPT_NONE);

View file

@ -33,7 +33,7 @@ static CURLcode test_unit2602(const char *arg)
struct dynhds hds; struct dynhds hds;
struct dynbuf dbuf; struct dynbuf dbuf;
CURLcode res; CURLcode result;
size_t i; size_t i;
/* add 1 more header than allowed */ /* add 1 more header than allowed */
@ -62,8 +62,8 @@ static CURLcode test_unit2602(const char *arg)
} }
fail_unless(Curl_dynhds_count(&hds) == 2, "should hold 2"); fail_unless(Curl_dynhds_count(&hds) == 2, "should hold 2");
/* exceed limit on # of entries */ /* exceed limit on # of entries */
res = Curl_dynhds_add(&hds, "test3", 5, "789", 3); result = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
fail_unless(res, "add should have failed"); fail_unless(result, "add should have failed");
fail_unless(Curl_dynhds_count_name(&hds, "test", 4) == 0, "false positive"); fail_unless(Curl_dynhds_count_name(&hds, "test", 4) == 0, "false positive");
fail_unless(Curl_dynhds_count_name(&hds, "test1", 4) == 0, "false positive"); fail_unless(Curl_dynhds_count_name(&hds, "test1", 4) == 0, "false positive");
@ -94,9 +94,9 @@ static CURLcode test_unit2602(const char *arg)
fail_unless(Curl_dynhds_cremove(&hds, "blablabla") == 2, "should"); fail_unless(Curl_dynhds_cremove(&hds, "blablabla") == 2, "should");
fail_if(Curl_dynhds_ccontains(&hds, "blablabla"), "should not"); fail_if(Curl_dynhds_ccontains(&hds, "blablabla"), "should not");
res = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies"); result = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
fail_unless(res, "add should have failed"); fail_unless(result, "add should have failed");
if(!res) { if(!result) {
fail_unless(Curl_dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should"); fail_unless(Curl_dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should");
fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed"); fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed");

View file

@ -65,7 +65,7 @@ static void parse_success(const struct tcase *t)
struct h1_req_parser p; struct h1_req_parser p;
const uint8_t *buf; const uint8_t *buf;
size_t buflen, i, in_len, in_consumed; size_t buflen, i, in_len, in_consumed;
CURLcode err; CURLcode result;
size_t nread; size_t nread;
Curl_h1_req_parse_init(&p, 1024); Curl_h1_req_parse_init(&p, 1024);
@ -74,10 +74,10 @@ static void parse_success(const struct tcase *t)
buf = (const uint8_t *)t->input[i]; buf = (const uint8_t *)t->input[i];
buflen = strlen(t->input[i]); buflen = strlen(t->input[i]);
in_len += buflen; in_len += buflen;
err = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme, result = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme,
t->custom_method, 0, &nread); t->custom_method, 0, &nread);
if(err) { if(result) {
curl_mfprintf(stderr, "got err %d parsing: '%s'\n", err, buf); curl_mfprintf(stderr, "got result %d parsing: '%s'\n", result, buf);
fail("error consuming"); fail("error consuming");
} }
in_consumed += (size_t)nread; in_consumed += (size_t)nread;

View file

@ -35,7 +35,7 @@ static CURLcode test_unit2605(const char *arg)
curl_off_t filesize; curl_off_t filesize;
curl_off_t start; curl_off_t start;
curl_off_t size; curl_off_t size;
CURLcode res; CURLcode result;
}; };
int i; int i;
@ -77,15 +77,16 @@ static CURLcode test_unit2605(const char *arg)
for(i = 0; list[i].r; i++) { for(i = 0; list[i].r; i++) {
curl_off_t start; curl_off_t start;
curl_off_t size; curl_off_t size;
CURLcode res; CURLcode result;
curl_mprintf("%u: '%s' (file size: %" FMT_OFF_T ")\n", i, list[i].r, curl_mprintf("%u: '%s' (file size: %" FMT_OFF_T ")\n", i, list[i].r,
list[i].filesize); list[i].filesize);
res = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start, &size); result = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start,
if(res != list[i].res) { &size);
curl_mprintf("... returned %d\n", res); if(result != list[i].result) {
curl_mprintf("... returned %d\n", result);
unitfail++; unitfail++;
} }
if(!res) { if(!result) {
if(start != list[i].start) { if(start != list[i].start) {
curl_mprintf("... start (%" FMT_OFF_T ") was not %" FMT_OFF_T " \n", curl_mprintf("... start (%" FMT_OFF_T ") was not %" FMT_OFF_T " \n",
start, list[i].start); start, list[i].start);

View file

@ -75,7 +75,7 @@ static CURLcode test_unit3200(const char *arg)
#endif #endif
size_t i; size_t i;
CURLcode res = CURLE_OK; CURLcode result = CURLE_OK;
for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) { for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
FILE *fp; FILE *fp;
struct dynbuf buf; struct dynbuf buf;
@ -95,62 +95,62 @@ static CURLcode test_unit3200(const char *arg)
curl_mfprintf(stderr, "Test %zd...", i); curl_mfprintf(stderr, "Test %zd...", i);
switch(i) { switch(i) {
case 0: case 0:
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE1\n", line), fail_unless(!result && line && !strcmp("LINE1\n", line),
"First line failed (1)"); "First line failed (1)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE2 NEWLINE\n", line), fail_unless(!result && line && !strcmp("LINE2 NEWLINE\n", line),
"Second line failed (1)"); "Second line failed (1)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
abort_unless(eof, "Missed EOF (1)"); abort_unless(eof, "Missed EOF (1)");
break; break;
case 1: case 1:
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE1\n", line), fail_unless(!result && line && !strcmp("LINE1\n", line),
"First line failed (2)"); "First line failed (2)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE2 NONEWLINE\n", line), fail_unless(!result && line && !strcmp("LINE2 NONEWLINE\n", line),
"Second line failed (2)"); "Second line failed (2)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
abort_unless(eof, "Missed EOF (2)"); abort_unless(eof, "Missed EOF (2)");
break; break;
case 2: case 2:
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE1\n", line), fail_unless(!result && line && !strcmp("LINE1\n", line),
"First line failed (3)"); "First line failed (3)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
fail_unless(!curlx_dyn_len(&buf), fail_unless(!curlx_dyn_len(&buf),
"Did not detect max read on EOF (3)"); "Did not detect max read on EOF (3)");
break; break;
case 3: case 3:
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE1\n", line), fail_unless(!result && line && !strcmp("LINE1\n", line),
"First line failed (4)"); "First line failed (4)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
fail_unless(!curlx_dyn_len(&buf), fail_unless(!curlx_dyn_len(&buf),
"Did not ignore partial on EOF (4)"); "Did not ignore partial on EOF (4)");
break; break;
case 4: case 4:
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE1\n", line), fail_unless(!result && line && !strcmp("LINE1\n", line),
"First line failed (5)"); "First line failed (5)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
fail_unless(!curlx_dyn_len(&buf), fail_unless(!curlx_dyn_len(&buf),
"Did not bail out on too long line"); "Did not bail out on too long line");
break; break;
case 5: case 5:
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
line = curlx_dyn_ptr(&buf); line = curlx_dyn_ptr(&buf);
fail_unless(!res && line && !strcmp("LINE1\x1aTEST\n", line), fail_unless(!result && line && !strcmp("LINE1\x1aTEST\n", line),
"Missed/Misinterpreted ^Z (6)"); "Missed/Misinterpreted ^Z (6)");
res = Curl_get_line(&buf, fp, &eof); result = Curl_get_line(&buf, fp, &eof);
abort_unless(eof, "Missed EOF (6)"); abort_unless(eof, "Missed EOF (6)");
break; break;
default: default:
@ -161,7 +161,7 @@ static CURLcode test_unit3200(const char *arg)
curlx_fclose(fp); curlx_fclose(fp);
curl_mfprintf(stderr, "OK\n"); curl_mfprintf(stderr, "OK\n");
} }
return res; return result;
#endif #endif