← Commit list

2da1bbca96

Viktor Szakats
Viktor Szakats
2026-01-26
SUCCESS Duration: 314s

Subject

tests: rename more `CURLcode` variables to `result`

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

src/tool_writeout.c+3 -2
@@ -163,8 +163,9 @@ static void certinfo(struct per_transfer *per)
{
if(!per->certinfo) {
struct curl_certinfo *certinfo;
- CURLcode res = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO, &certinfo);
- per->certinfo = (!res && certinfo) ? certinfo : NULL;
+ CURLcode result = curl_easy_getinfo(per->curl, CURLINFO_CERTINFO,
+ &certinfo);
+ per->certinfo = (!result && certinfo) ? certinfo : NULL;
}
}
tests/libtest/cli_tls_session_reuse.c+5 -5
@@ -33,13 +33,13 @@ static size_t write_tse_cb(char *ptr, size_t size, size_t nmemb, void *opaque)
(void)ptr;
if(!tse_found_tls_session) {
struct curl_tlssessioninfo *tlssession;
- CURLcode rc;
+ CURLcode result;
- rc = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tlssession);
- if(rc) {
+ result = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tlssession);
+ if(result) {
curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) "
- "failed: %s\n", curl_easy_strerror(rc));
- return rc;
+ "failed: %s\n", curl_easy_strerror(result));
+ return result;
}
if(tlssession->backend == CURLSSLBACKEND_NONE) {
curl_mfprintf(stderr, "curl_easy_getinfo(CURLINFO_TLS_SSL_PTR) "
tests/libtest/cli_ws_data.c+21 -21
@@ -74,7 +74,7 @@ static CURLcode test_ws_data_m2_echo(const char *url,
size_t plen_max)
{
CURL *curl = NULL;
- CURLcode r = CURLE_OK;
+ CURLcode result = CURLE_OK;
const struct curl_ws_frame *frame;
size_t len;
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);
recv_buf = curlx_calloc(1, plen_max + 1);
if(!send_buf || !recv_buf) {
- r = CURLE_OUT_OF_MEMORY;
+ result = CURLE_OUT_OF_MEMORY;
goto out;
}
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();
if(!curl) {
- r = CURLE_OUT_OF_MEMORY;
+ result = CURLE_OUT_OF_MEMORY;
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_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 2L); /* websocket style */
- r = curl_easy_perform(curl);
- curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", r);
- if(r != CURLE_OK)
+ result = curl_easy_perform(curl);
+ curl_mfprintf(stderr, "curl_easy_perform() returned %u\n", result);
+ if(result != CURLE_OK)
goto out;
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) {
sblock = rblock = 1;
if(slen) {
- r = curl_ws_send(curl, sbuf, slen, &nwritten, 0, CURLWS_BINARY);
- sblock = (r == CURLE_AGAIN);
- if(!r || (r == CURLE_AGAIN)) {
+ result = curl_ws_send(curl, sbuf, slen, &nwritten, 0, CURLWS_BINARY);
+ sblock = (result == CURLE_AGAIN);
+ if(!result || (result == CURLE_AGAIN)) {
curl_mfprintf(stderr, "curl_ws_send(len=%zu) -> %d, "
"%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;
slen -= nwritten;
}
@@ -136,15 +136,15 @@ static CURLcode test_ws_data_m2_echo(const char *url,
if(rlen) {
size_t max_recv = (64 * 1024);
- r = curl_ws_recv(curl, rbuf, (rlen > max_recv) ? max_recv : rlen,
- &nread, &frame);
- if(!r || (r == CURLE_AGAIN)) {
- rblock = (r == CURLE_AGAIN);
+ result = curl_ws_recv(curl, rbuf, (rlen > max_recv) ? max_recv : rlen,
+ &nread, &frame);
+ if(!result || (result == CURLE_AGAIN)) {
+ rblock = (result == CURLE_AGAIN);
curl_mfprintf(stderr, "curl_ws_recv(len=%zu) -> %d, %zu (%ld/%zu) "
- "\n", rlen, r, nread, (long)(len - rlen), len);
- if(!r) {
- r = test_ws_data_m2_check_recv(frame, len - rlen, nread, len);
- if(r)
+ "\n", rlen, result, nread, (long)(len - rlen), len);
+ if(!result) {
+ result = test_ws_data_m2_check_recv(frame, len - rlen, nread, len);
+ if(result)
goto out;
}
rbuf += nread;
@@ -171,20 +171,20 @@ static CURLcode test_ws_data_m2_echo(const char *url,
(const unsigned char *)send_buf, len, FALSE);
debug_dump("", "received:", stderr,
(const unsigned char *)recv_buf, len, FALSE);
- r = CURLE_RECV_ERROR;
+ result = CURLE_RECV_ERROR;
goto out;
}
}
out:
if(curl) {
- if(!r)
+ if(!result)
ws_close(curl);
curl_easy_cleanup(curl);
}
curlx_free(send_buf);
curlx_free(recv_buf);
- return r;
+ return result;
}
struct test_ws_m1_ctx {
tests/libtest/lib1156.c+1 -1
@@ -160,7 +160,7 @@ static CURLcode test_lib1156(const char *URL)
curl_global_cleanup();
curl_mprintf("%d\n", status);
- return (CURLcode)status;
+ return status ? TEST_ERR_FAILURE : CURLE_OK;
test_cleanup:
tests/libtest/lib1509.c+2 -2
@@ -63,7 +63,7 @@ static CURLcode test_lib1509(const char *URL)
easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
code = curl_easy_perform(curl);
- if(CURLE_OK != code) {
+ if(code != CURLE_OK) {
curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
"with code %d (%s)\n",
__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);
- if(CURLE_OK != code) {
+ if(code != CURLE_OK) {
curl_mfprintf(stderr, "%s:%d curl_easy_getinfo() failed, "
"with code %d (%s)\n",
__FILE__, __LINE__, code, curl_easy_strerror(code));
tests/libtest/lib1597.c+2 -2
@@ -28,7 +28,7 @@
struct pair {
const char *in;
- CURLcode *exp;
+ CURLcode *result_exp;
};
static CURLcode test_lib1597(const char *URL)
@@ -95,7 +95,7 @@ static CURLcode test_lib1597(const char *URL)
/* Run the tests. */
for(i = 0; prots[i].in; i++) {
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);
break;
}
tests/libtest/lib1939.c+5 -5
@@ -35,16 +35,16 @@ static CURLcode test_lib1939(const char *URL)
if(multi) {
curl = curl_easy_init();
if(curl) {
- CURLcode c;
+ CURLcode result;
CURLMcode mresult;
/* Crash only happens when using HTTPS */
- c = curl_easy_setopt(curl, CURLOPT_URL, URL);
- if(!c)
+ result = curl_easy_setopt(curl, CURLOPT_URL, URL);
+ if(!result)
/* 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,
because we want to stop during the middle. */
tests/libtest/lib2032.c+4 -4
@@ -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;
curl_socket_t sock;
long longdata;
- CURLcode code;
+ CURLcode result;
const size_t failure = (size && nmemb) ? 0 : 1;
(void)ptr;
ntlm_counter[idx] += (int)(size * nmemb);
/* 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, "
"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;
return failure;
}
tests/libtest/lib3026.c+8 -8
@@ -42,7 +42,7 @@ static CURLcode test_lib3026(const char *URL)
CURLcode results[NUM_THREADS];
HANDLE thread_handles[NUM_THREADS];
unsigned tid_count = NUM_THREADS, i;
- CURLcode test_failure = CURLE_OK;
+ CURLcode result = CURLE_OK;
curl_version_info_data *ver;
(void)URL;
@@ -63,7 +63,7 @@ static CURLcode test_lib3026(const char *URL)
"GetLastError 0x%08lx\n",
__FILE__, __LINE__, GetLastError());
tid_count = i;
- test_failure = TEST_ERR_MAJOR_BAD;
+ result = TEST_ERR_MAJOR_BAD;
goto cleanup;
}
thread_handles[i] = th;
@@ -77,11 +77,11 @@ cleanup:
curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
"with code %d (%s)\n", __FILE__, __LINE__,
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)
@@ -103,7 +103,7 @@ static CURLcode test_lib3026(const char *URL)
CURLcode results[NUM_THREADS];
pthread_t tids[NUM_THREADS];
unsigned tid_count = NUM_THREADS, i;
- CURLcode test_failure = CURLE_OK;
+ CURLcode result = CURLE_OK;
curl_version_info_data *ver;
(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",
__FILE__, __LINE__, res);
tid_count = i;
- test_failure = TEST_ERR_MAJOR_BAD;
+ result = TEST_ERR_MAJOR_BAD;
goto cleanup;
}
}
@@ -135,11 +135,11 @@ cleanup:
curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
"with code %d (%s)\n", __FILE__, __LINE__,
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 */
tests/libtest/lib3027.c+7 -7
@@ -25,7 +25,7 @@
static CURLcode test_lib3027(const char *URL)
{
- CURLcode ret = CURLE_OK;
+ CURLcode result = CURLE_OK;
CURL *curl;
start_test_timing();
@@ -35,18 +35,18 @@ static CURLcode test_lib3027(const char *URL)
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
- ret = curl_easy_perform(curl);
- if(CURLE_OK == ret) {
+ result = curl_easy_perform(curl);
+ if(result == CURLE_OK) {
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 */
- if((CURLE_OK == ret) && (filetime != -1)) {
+ if((result == CURLE_OK) && (filetime != -1)) {
/* we just need to return something which is not CURLE_OK */
- ret = CURLE_UNSUPPORTED_PROTOCOL;
+ result = CURLE_UNSUPPORTED_PROTOCOL;
}
}
curl_easy_cleanup(curl);
}
curl_global_cleanup();
- return ret;
+ return result;
}
tests/libtest/lib512.c+7 -7
@@ -28,11 +28,11 @@
static CURLcode test_lib512(const char *URL)
{
- CURLcode code;
+ CURLcode result;
int rc = 99;
- code = curl_global_init(CURL_GLOBAL_ALL);
- if(code == CURLE_OK) {
+ result = curl_global_init(CURL_GLOBAL_ALL);
+ if(result == CURLE_OK) {
CURL *curl = curl_easy_init();
if(curl) {
CURL *curl2;
@@ -43,11 +43,11 @@ static CURLcode test_lib512(const char *URL)
curl2 = curl_easy_duphandle(curl);
if(curl2) {
- code = curl_easy_setopt(curl2, CURLOPT_URL, URL);
- if(code == CURLE_OK) {
+ result = curl_easy_setopt(curl2, CURLOPT_URL, URL);
+ if(result == CURLE_OK) {
- code = curl_easy_perform(curl2);
- if(code == CURLE_OK)
+ result = curl_easy_perform(curl2);
+ if(result == CURLE_OK)
rc = 0;
else
rc = 1;
tests/libtest/lib530.c+16 -16
@@ -389,28 +389,28 @@ test_cleanup:
static CURLcode test_lib530(const char *URL)
{
- CURLcode rc;
+ CURLcode result;
/* rerun the same transfer multiple times and make it fail in different
callback calls */
- rc = testone(URL, 0, 0); /* no callback fails */
- if(rc)
- curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+ result = testone(URL, 0, 0); /* no callback fails */
+ if(result)
+ curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
- rc = testone(URL, 1, 0); /* fail 1st call to timer callback */
- if(!rc)
- curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+ result = testone(URL, 1, 0); /* fail 1st call to timer callback */
+ if(!result)
+ curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
- rc = testone(URL, 2, 0); /* fail 2nd call to timer callback */
- if(!rc)
- curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+ result = testone(URL, 2, 0); /* fail 2nd call to timer callback */
+ if(!result)
+ curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
- rc = testone(URL, 0, 1); /* fail 1st call to socket callback */
- if(!rc)
- curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+ result = testone(URL, 0, 1); /* fail 1st call to socket callback */
+ if(!result)
+ curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
- rc = testone(URL, 0, 2); /* fail 2nd call to socket callback */
- if(!rc)
- curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), rc);
+ result = testone(URL, 0, 2); /* fail 2nd call to socket callback */
+ if(!result)
+ curl_mfprintf(stderr, "%s FAILED: %d\n", t530_tag(), result);
return CURLE_OK;
}
tests/libtest/lib586.c+4 -4
@@ -97,7 +97,7 @@ static void t586_test_unlock(CURL *curl, curl_lock_data data, void *useptr)
/* the dummy thread function */
static void *t586_test_fire(void *ptr)
{
- CURLcode code;
+ CURLcode result;
struct t586_Tdata *tdata = (struct t586_Tdata *)ptr;
CURL *curl;
@@ -114,11 +114,11 @@ static void *t586_test_fire(void *ptr)
curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share);
curl_mprintf("PERFORM\n");
- code = curl_easy_perform(curl);
- if(code != CURLE_OK) {
+ result = curl_easy_perform(curl);
+ if(result != CURLE_OK) {
int i = 0;
curl_mfprintf(stderr, "perform URL '%s' repeat %d failed, curlcode %d\n",
- tdata->url, i, code);
+ tdata->url, i, result);
}
curl_mprintf("CLEANUP\n");
tests/libtest/lib643.c+4 -4
@@ -224,19 +224,19 @@ static CURLcode t643_cyclic_add(void)
CURL *curl = curl_easy_init();
curl_mime *mime = curl_mime_init(curl);
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_mimepart *subpart = curl_mime_addpart(submime);
curl_mime_subparts(part, submime);
- a1 = curl_mime_subparts(subpart, mime);
+ result = curl_mime_subparts(subpart, mime);
}
curl_mime_free(mime);
curl_easy_cleanup(curl);
- if(a1 != CURLE_BAD_FUNCTION_ARGUMENT)
+ if(result != CURLE_BAD_FUNCTION_ARGUMENT)
/* that should have failed */
return TEST_ERR_FAILURE;
tests/libtest/lib678.c+3 -3
@@ -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)
{
- CURLcode code = CURLE_OUT_OF_MEMORY;
+ CURLcode result = CURLE_OUT_OF_MEMORY;
CURL *curl;
struct curl_blob blob;
size_t certsize;
@@ -84,11 +84,11 @@ static CURLcode test_cert_blob(const char *url, const char *cafile)
blob.flags = CURL_BLOB_COPY;
curl_easy_setopt(curl, CURLOPT_CAINFO_BLOB, &blob);
curlx_free(certdata);
- code = curl_easy_perform(curl);
+ result = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
- return code;
+ return result;
}
static CURLcode test_lib678(const char *URL)
tests/libtest/lib758.c+9 -9
@@ -307,15 +307,15 @@ static CURLMcode t758_checkFdSet(CURLM *multi, struct t758_Sockets *sockets,
const char *name)
{
int i;
- CURLMcode result = CURLM_OK;
+ CURLMcode mresult = CURLM_OK;
for(i = 0; i < sockets->count; ++i) {
if(FD_ISSET(sockets->sockets[i], fdset)) {
- result = t758_saction(multi, sockets->sockets[i], evBitmask, name);
- if(result)
+ mresult = t758_saction(multi, sockets->sockets[i], evBitmask, name);
+ if(mresult)
break;
}
}
- return result;
+ return mresult;
}
static CURLcode t758_one(const char *URL, int timer_fail_at,
@@ -485,14 +485,14 @@ test_cleanup:
static CURLcode test_lib758(const char *URL)
{
- CURLcode rc;
+ CURLcode result;
/* rerun the same transfer multiple times and make it fail in different
callback calls */
- rc = t758_one(URL, 0, 0); /* no callback fails */
- if(rc)
- curl_mfprintf(stderr, "%s FAILED: %d\n", t758_tag(), rc);
+ result = t758_one(URL, 0, 0); /* no callback fails */
+ if(result)
+ curl_mfprintf(stderr, "%s FAILED: %d\n", t758_tag(), result);
- return rc;
+ return result;
}
#else /* T578_ENABLED */
tests/server/getpart.c+3 -3
@@ -185,7 +185,7 @@ static int appenddata(char **dst_buf, /* dest buffer */
static int decodedata(char **buf, /* dest buffer */
size_t *len) /* dest buffer data length */
{
- CURLcode error = CURLE_OK;
+ CURLcode result = CURLE_OK;
unsigned char *buf64 = NULL;
size_t src_len = 0;
@@ -193,8 +193,8 @@ static int decodedata(char **buf, /* dest buffer */
return GPE_OK;
/* base64 decode the given buffer */
- error = curlx_base64_decode(*buf, &buf64, &src_len);
- if(error)
+ result = curlx_base64_decode(*buf, &buf64, &src_len);
+ if(result)
return GPE_OUT_OF_MEMORY;
if(!src_len) {
tests/unit/unit1302.c+14 -12
@@ -36,7 +36,7 @@ struct etest {
static CURLcode test_unit1302(const char *arg)
{
UNITTEST_BEGIN_SIMPLE
- CURLcode rc;
+ CURLcode result;
unsigned int i;
/* common base64 encoding */
@@ -132,8 +132,9 @@ static CURLcode test_unit1302(const char *arg)
size_t dlen;
/* first encode */
- rc = curlx_base64_encode((const uint8_t *)e->input, e->ilen, &out, &olen);
- abort_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ result = curlx_base64_encode((const uint8_t *)e->input, e->ilen,
+ &out, &olen);
+ abort_unless(result == CURLE_OK, "return code should be CURLE_OK");
abort_unless(olen == e->olen, "wrong output size");
if(memcmp(out, e->output, e->olen)) {
curl_mfprintf(stderr, "Test %u encoded badly\n", i);
@@ -142,9 +143,10 @@ static CURLcode test_unit1302(const char *arg)
Curl_safefree(out);
/* then verify decode */
- rc = curlx_base64_decode(e->output, &decoded, &dlen);
- if(rc != CURLE_OK) {
- curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i, (int)rc);
+ result = curlx_base64_decode(e->output, &decoded, &dlen);
+ if(result != CURLE_OK) {
+ curl_mfprintf(stderr, "Test %u URL decode returned %d\n", i,
+ (int)result);
unitfail++;
}
if(dlen != e->ilen) {
@@ -165,9 +167,9 @@ static CURLcode test_unit1302(const char *arg)
struct etest *e = &url[i];
char *out;
size_t olen;
- rc = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
- &out, &olen);
- abort_unless(rc == CURLE_OK, "return code should be CURLE_OK");
+ result = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
+ &out, &olen);
+ abort_unless(result == CURLE_OK, "return code should be CURLE_OK");
if(olen != e->olen) {
curl_mfprintf(stderr, "Test %u URL encoded output length %zu "
"instead of %zu\n", i, olen, e->olen);
@@ -186,11 +188,11 @@ static CURLcode test_unit1302(const char *arg)
size_t dlen;
/* then verify decode with illegal inputs */
- rc = curlx_base64_decode(e->output, &decoded, &dlen);
- if(rc != CURLE_BAD_CONTENT_ENCODING) {
+ result = curlx_base64_decode(e->output, &decoded, &dlen);
+ if(result != CURLE_BAD_CONTENT_ENCODING) {
curl_mfprintf(stderr, "Test %u URL bad decoded badly. "
"Returned '%d', expected '%d'\n",
- i, (int)rc, CURLE_BAD_CONTENT_ENCODING);
+ i, (int)result, CURLE_BAD_CONTENT_ENCODING);
unitfail++;
}
}
tests/unit/unit1305.c+2 -2
@@ -106,8 +106,8 @@ static CURLcode test_unit1305(const char *arg)
/* Test 1305 exits without adding anything to the hash */
if(testnum == 1306) {
- CURLcode rc = create_node();
- abort_unless(rc == CURLE_OK, "data node creation failed");
+ CURLcode result = create_node();
+ abort_unless(result == CURLE_OK, "data node creation failed");
key_len = strlen(data_key);
data_node->refcount = 1; /* hash will hold the reference */
tests/unit/unit1608.c+3 -3
@@ -48,14 +48,14 @@ static CURLcode test_unit1608(const char *arg)
UNITTEST_BEGIN(t1608_setup())
int i;
- CURLcode code;
+ CURLcode result;
struct Curl_addrinfo *addrhead = addrs;
struct Curl_easy *easy = curl_easy_init();
abort_unless(easy, "out of memory");
- code = curl_easy_setopt(easy, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
- abort_unless(code == CURLE_OK, "curl_easy_setopt failed");
+ result = curl_easy_setopt(easy, CURLOPT_DNS_SHUFFLE_ADDRESSES, 1L);
+ abort_unless(result == CURLE_OK, "curl_easy_setopt failed");
/* Shuffle repeatedly and make sure that the list changes */
for(i = 0; i < 10; i++) {
tests/unit/unit1620.c+15 -15
@@ -41,9 +41,9 @@ static void t1620_parse(const char *input,
char *userstr = NULL;
char *passwdstr = NULL;
char *options = NULL;
- CURLcode rc = Curl_parse_login_details(input, strlen(input), &userstr,
- &passwdstr, &options);
- fail_unless(rc == CURLE_OK, "Curl_parse_login_details() failed");
+ CURLcode result = Curl_parse_login_details(input, strlen(input), &userstr,
+ &passwdstr, &options);
+ fail_unless(result == CURLE_OK, "Curl_parse_login_details() failed");
fail_unless(!!exp_username == !!userstr, "username 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())
- CURLcode rc;
+ CURLcode result;
struct Curl_easy *empty;
enum dupstring i;
bool async = FALSE;
bool protocol_connect = FALSE;
- rc = Curl_open(&empty);
- if(rc)
+ result = Curl_open(&empty);
+ if(result)
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);
- fail_unless(rc == CURLE_URL_MALFORMAT,
+ result = Curl_connect(empty, &async, &protocol_connect);
+ fail_unless(result == CURLE_URL_MALFORMAT,
"Curl_connect() failed to return CURLE_URL_MALFORMAT");
fail_unless(empty->magic == CURLEASY_MAGIC_NUMBER,
"empty->magic should be equal to CURLEASY_MAGIC_NUMBER");
/* double invoke to ensure no dependency on internal state */
- rc = Curl_connect(empty, &async, &protocol_connect);
- fail_unless(rc == CURLE_URL_MALFORMAT,
+ result = Curl_connect(empty, &async, &protocol_connect);
+ fail_unless(result == CURLE_URL_MALFORMAT,
"Curl_connect() failed to return CURLE_URL_MALFORMAT");
- rc = Curl_init_do(empty, empty->conn);
- fail_unless(rc == CURLE_OK, "Curl_init_do() failed");
+ result = Curl_init_do(empty, empty->conn);
+ fail_unless(result == CURLE_OK, "Curl_init_do() failed");
t1620_parse("hostname", "hostname", NULL, 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");
}
- rc = Curl_close(&empty);
- fail_unless(rc == CURLE_OK, "Curl_close() failed");
+ result = Curl_close(&empty);
+ fail_unless(result == CURLE_OK, "Curl_close() failed");
UNITTEST_END(curl_global_cleanup())
}
tests/unit/unit1651.c+3 -3
@@ -364,7 +364,7 @@ static CURLcode test_unit1651(const char *arg)
0x48, 0x88, 0x61, 0x54, 0x4A, 0x2B, 0xB7, 0x6A, 0x12, 0x08, 0xFB,
};
- CURLcode res;
+ CURLcode result;
const char *beg = (const char *)&cert[0];
const char *end = (const char *)&cert[sizeof(cert)];
struct Curl_easy *data;
@@ -378,9 +378,9 @@ static CURLcode test_unit1651(const char *arg)
data = curl_easy_init();
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
happens */
tests/unit/unit1654.c+61 -61
@@ -33,12 +33,12 @@ static CURLcode test_unit1654(const char *arg)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
char outname[256];
CURL *curl;
- CURLcode res;
+ CURLcode result;
struct altsvcinfo *asi = Curl_altsvc_init();
abort_if(!asi, "Curl_altsvc_i");
- res = Curl_altsvc_load(asi, arg);
- if(res) {
- fail_if(res, "Curl_altsvc_load");
+ result = Curl_altsvc_load(asi, arg);
+ if(result) {
+ fail_if(result, "Curl_altsvc_load");
goto fail;
}
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");
curl_msnprintf(outname, sizeof(outname), "%s-out", arg);
- res = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
- ALPN_h1, "example.org", 8080);
- fail_if(res, "Curl_altsvc_parse() failed!");
+ result = Curl_altsvc_parse(curl, asi, "h2=\"example.com:8080\"\r\n",
+ ALPN_h1, "example.org", 8080);
+ fail_if(result, "Curl_altsvc_parse() failed!");
fail_unless(Curl_llist_count(&asi->list) == 5, "wrong number of entries");
- res = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
- ALPN_h1, "2.example.org", 8080);
- fail_if(res, "Curl_altsvc_parse(2) failed!");
+ result = Curl_altsvc_parse(curl, asi, "h3=\":8080\"\r\n",
+ ALPN_h1, "2.example.org", 8080);
+ fail_if(result, "Curl_altsvc_parse(2) failed!");
fail_unless(Curl_llist_count(&asi->list) == 6, "wrong number of entries");
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"example.com:8080\", "
- "h3=\"yesyes.com:8080\"\r\n",
- ALPN_h1, "3.example.org", 8080);
- fail_if(res, "Curl_altsvc_parse(3) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"example.com:8080\", "
+ "h3=\"yesyes.com:8080\"\r\n",
+ ALPN_h1, "3.example.org", 8080);
+ fail_if(result, "Curl_altsvc_parse(3) failed!");
/* that one should make two entries */
fail_unless(Curl_llist_count(&asi->list) == 8, "wrong number of entries");
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"example.com:443\"; ma = 120;\r\n",
- ALPN_h2, "example.org", 80);
- fail_if(res, "Curl_altsvc_parse(4) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"example.com:443\"; ma = 120;\r\n",
+ ALPN_h2, "example.org", 80);
+ fail_if(result, "Curl_altsvc_parse(4) failed!");
fail_unless(Curl_llist_count(&asi->list) == 9, "wrong number of entries");
/* quoted 'ma' value */
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"example.net:443\"; ma=\"180\";\r\n",
- ALPN_h2, "example.net", 80);
- fail_if(res, "Curl_altsvc_parse(5) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"example.net:443\"; ma=\"180\";\r\n",
+ ALPN_h2, "example.net", 80);
+ fail_if(result, "Curl_altsvc_parse(5) failed!");
fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
- res = Curl_altsvc_parse(curl, asi,
- "h2=\":443\"; ma=180, h3=\":443\"; "
- "persist = \"1\"; ma = 120;\r\n",
- ALPN_h1, "curl.se", 80);
- fail_if(res, "Curl_altsvc_parse(6) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\":443\"; ma=180, h3=\":443\"; "
+ "persist = \"1\"; ma = 120;\r\n",
+ ALPN_h1, "curl.se", 80);
+ fail_if(result, "Curl_altsvc_parse(6) failed!");
fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
/* clear that one again and decrease the counter */
- res = Curl_altsvc_parse(curl, asi, "clear;\r\n",
- ALPN_h1, "curl.se", 80);
- fail_if(res, "Curl_altsvc_parse(7) failed!");
+ result = Curl_altsvc_parse(curl, asi, "clear;\r\n",
+ ALPN_h1, "curl.se", 80);
+ fail_if(result, "Curl_altsvc_parse(7) failed!");
fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
- res = Curl_altsvc_parse(curl, asi,
- "h2=\":443\", h3=\":443\"; "
- "persist = \"1\"; ma = 120;\r\n",
- ALPN_h1, "curl.se", 80);
- fail_if(res, "Curl_altsvc_parse(6) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\":443\", h3=\":443\"; "
+ "persist = \"1\"; ma = 120;\r\n",
+ ALPN_h1, "curl.se", 80);
+ fail_if(result, "Curl_altsvc_parse(6) failed!");
fail_unless(Curl_llist_count(&asi->list) == 12, "wrong number of entries");
/* clear - without semicolon */
- res = Curl_altsvc_parse(curl, asi, "clear\r\n",
- ALPN_h1, "curl.se", 80);
- fail_if(res, "Curl_altsvc_parse(7) failed!");
+ result = Curl_altsvc_parse(curl, asi, "clear\r\n",
+ ALPN_h1, "curl.se", 80);
+ fail_if(result, "Curl_altsvc_parse(7) failed!");
fail_unless(Curl_llist_count(&asi->list) == 10, "wrong number of entries");
/* only a non-existing alpn */
- res = Curl_altsvc_parse(curl, asi,
- "h6=\"example.net:443\"; ma=\"180\";\r\n",
- ALPN_h2, "5.example.net", 80);
- fail_if(res, "Curl_altsvc_parse(8) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h6=\"example.net:443\"; ma=\"180\";\r\n",
+ ALPN_h2, "5.example.net", 80);
+ fail_if(result, "Curl_altsvc_parse(8) failed!");
/* missing quote in alpn host */
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"example.net:443,; ma=\"180\";\r\n",
- ALPN_h2, "6.example.net", 80);
- fail_if(res, "Curl_altsvc_parse(9) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"example.net:443,; ma=\"180\";\r\n",
+ ALPN_h2, "6.example.net", 80);
+ fail_if(result, "Curl_altsvc_parse(9) failed!");
/* missing port in hostname */
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"example.net\"; ma=\"180\";\r\n",
- ALPN_h2, "7.example.net", 80);
- fail_if(res, "Curl_altsvc_parse(10) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"example.net\"; ma=\"180\";\r\n",
+ ALPN_h2, "7.example.net", 80);
+ fail_if(result, "Curl_altsvc_parse(10) failed!");
/* illegal port in hostname */
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"example.net:70000\"; ma=\"180\";\r\n",
- ALPN_h2, "8.example.net", 80);
- fail_if(res, "Curl_altsvc_parse(11) failed!");
-
- res = Curl_altsvc_parse(curl, asi,
- "h2=\"test2.se:443\"; ma=\"180 \" ; unknown=2, "
- "h2=\"test3.se:443\"; ma = 120;\r\n",
- ALPN_h2, "test.se", 443);
- fail_if(res, "Curl_altsvc_parse(12) failed!");
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"example.net:70000\"; ma=\"180\";\r\n",
+ ALPN_h2, "8.example.net", 80);
+ fail_if(result, "Curl_altsvc_parse(11) failed!");
+
+ result = Curl_altsvc_parse(curl, asi,
+ "h2=\"test2.se:443\"; ma=\"180 \" ; unknown=2, "
+ "h2=\"test3.se:443\"; ma = 120;\r\n",
+ ALPN_h2, "test.se", 443);
+ fail_if(result, "Curl_altsvc_parse(12) failed!");
Curl_altsvc_save(curl, asi, outname);
tests/unit/unit1656.c+6 -6
@@ -30,23 +30,23 @@
struct test_spec {
const char *input;
const char *exp_output;
- CURLcode exp_res;
+ CURLcode result_exp;
};
static bool do_test(const struct test_spec *spec, size_t i,
struct dynbuf *dbuf)
{
- CURLcode res;
+ CURLcode result;
const char *in = spec->input;
curlx_dyn_reset(dbuf);
- res = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
- if(res != spec->exp_res) {
+ result = Curl_x509_GTime2str(dbuf, in, in + strlen(in));
+ if(result != spec->result_exp) {
curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
- i, spec->exp_res, res);
+ i, spec->result_exp, result);
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,
"test %zu: input '%s', expected output '%s', got '%s'\n",
i, in, spec->exp_output, curlx_dyn_ptr(dbuf));
tests/unit/unit1657.c+15 -15
@@ -30,26 +30,26 @@
struct test1657_spec {
CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
size_t n;
- CURLcode exp_res;
+ CURLcode result_exp;
};
static CURLcode make1657_nested(const struct test1657_spec *spec,
struct dynbuf *buf)
{
- CURLcode r;
+ CURLcode result;
size_t i;
unsigned char open_undef[] = { 0x32, 0x80 };
unsigned char close_undef[] = { 0x00, 0x00 };
for(i = 0; i < spec->n; ++i) {
- r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
- if(r)
- return r;
+ result = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
+ if(result)
+ return result;
}
for(i = 0; i < spec->n; ++i) {
- r = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
- if(r)
- return r;
+ result = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
+ if(result)
+ return result;
}
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,
struct dynbuf *buf)
{
- CURLcode res;
+ CURLcode result;
struct Curl_asn1Element elem;
const char *in;
memset(&elem, 0, sizeof(elem));
curlx_dyn_reset(buf);
- res = spec->setbuf(spec, buf);
- if(res) {
- curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, res);
+ result = spec->setbuf(spec, buf);
+ if(result) {
+ curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, result);
return FALSE;
}
in = curlx_dyn_ptr(buf);
- res = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
- if(res != spec->exp_res) {
+ result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
+ if(result != spec->result_exp) {
curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
- i, spec->exp_res, res);
+ i, spec->result_exp, result);
return FALSE;
}
return TRUE;
tests/unit/unit1660.c+9 -9
@@ -45,9 +45,9 @@ static CURLcode test_unit1660(const char *arg)
struct testit {
const char *host;
- const char *chost; /* if non-NULL, use to lookup with */
- const char *hdr; /* if NULL, just do the lookup */
- const CURLcode res; /* parse result */
+ const char *chost; /* if non-NULL, use to lookup with */
+ const char *hdr; /* if NULL, just do the lookup */
+ const CURLcode result; /* parse result */
};
static const struct testit headers[] = {
@@ -102,7 +102,7 @@ static CURLcode test_unit1660(const char *arg)
{ NULL, NULL, NULL, CURLE_OK }
};
- CURLcode res;
+ CURLcode result;
struct stsentry *e;
struct hsts *h = Curl_hsts_init();
int i;
@@ -124,16 +124,16 @@ static CURLcode test_unit1660(const char *arg)
for(i = 0; headers[i].host; i++) {
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",
- headers[i].hdr, res);
+ headers[i].hdr, result);
unitfail++;
continue;
}
- else if(res) {
- curl_mprintf("Input %u: error %d\n", i, (int)res);
+ else if(result) {
+ curl_mprintf("Input %u: error %d\n", i, (int)result);
continue;
}
}
tests/unit/unit1663.c+3 -3
@@ -43,13 +43,13 @@ static void t1663_parse(const char *input_data,
const char *exp_dev,
const char *exp_iface,
const char *exp_host,
- CURLcode exp_rc)
+ CURLcode result_exp)
{
char *dev = NULL;
char *iface = NULL;
char *host = NULL;
- CURLcode rc = Curl_parse_interface(input_data, &dev, &iface, &host);
- fail_unless(rc == exp_rc, "Curl_parse_interface() failed");
+ CURLcode result = Curl_parse_interface(input_data, &dev, &iface, &host);
+ fail_unless(result == result_exp, "Curl_parse_interface() failed");
fail_unless(!!exp_dev == !!dev, "dev expectation failed.");
fail_unless(!!exp_iface == !!iface, "iface expectation failed");
tests/unit/unit2600.c+3 -3
@@ -83,7 +83,7 @@ struct test_case {
int exp_cf6_creations;
timediff_t min_duration_ms;
timediff_t max_duration_ms;
- CURLcode exp_res;
+ CURLcode result_exp;
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);
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
* and events are not as sharply timed. */
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);
}
if(tr->cf4.creations != tc->exp_cf4_creations) {
tests/unit/unit2601.c+28 -28
@@ -85,7 +85,7 @@ static void check_bufq(size_t pool_spares,
struct bufq q;
struct bufc_pool pool;
size_t max_len = chunk_size * max_chunks;
- CURLcode res;
+ CURLcode result;
ssize_t i;
size_t n2;
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(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(res == CURLE_OK, "write: wrong result returned");
+ fail_unless(result == CURLE_OK, "write: wrong result returned");
/* write empty bufq full */
nwritten = 0;
Curl_bufq_reset(&q);
while(!Curl_bufq_is_full(&q)) {
- res = Curl_bufq_write(&q, test_data, wsize, &n2);
- if(!res) {
+ result = Curl_bufq_write(&q, test_data, wsize, &n2);
+ if(!result) {
nwritten += n2;
}
- else if(res != CURLE_AGAIN) {
- fail_unless(res == CURLE_AGAIN, "write-loop: unexpected result");
+ else if(result != CURLE_AGAIN) {
+ fail_unless(result == CURLE_AGAIN, "write-loop: unexpected result");
break;
}
}
@@ -132,12 +132,12 @@ static void check_bufq(size_t pool_spares,
/* read full bufq empty */
nread = 0;
while(!Curl_bufq_is_empty(&q)) {
- res = Curl_bufq_read(&q, test_data, rsize, &n2);
- if(!res) {
+ result = Curl_bufq_read(&q, test_data, rsize, &n2);
+ if(!result) {
nread += n2;
}
- else if(res != CURLE_AGAIN) {
- fail_unless(res == CURLE_AGAIN, "read-loop: unexpected result");
+ else if(result != CURLE_AGAIN) {
+ fail_unless(result == CURLE_AGAIN, "read-loop: unexpected result");
break;
}
}
@@ -153,14 +153,14 @@ static void check_bufq(size_t pool_spares,
}
for(i = 0; i < 1000; ++i) {
- res = Curl_bufq_write(&q, test_data, wsize, &n2);
- if(res && res != CURLE_AGAIN) {
- fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected write result");
+ result = Curl_bufq_write(&q, test_data, wsize, &n2);
+ if(result && result != CURLE_AGAIN) {
+ fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected write result");
break;
}
- res = Curl_bufq_read(&q, test_data, rsize, &n2);
- if(res && res != CURLE_AGAIN) {
- fail_unless(res == CURLE_AGAIN, "rw-loop: unexpected read result");
+ result = Curl_bufq_read(&q, test_data, rsize, &n2);
+ if(result && result != CURLE_AGAIN) {
+ fail_unless(result == CURLE_AGAIN, "rw-loop: unexpected read result");
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));
nwritten = 0;
while(!Curl_bufq_is_full(&q)) {
- res = Curl_bufq_write(&q, test_data, wsize, &n2);
- if(res || n2 != wsize) {
- fail_unless(!res && n2 == wsize, "write should be complete");
+ result = Curl_bufq_write(&q, test_data, wsize, &n2);
+ if(result || n2 != wsize) {
+ fail_unless(!result && n2 == wsize, "write should be complete");
break;
}
nwritten += n2;
@@ -184,15 +184,15 @@ static void check_bufq(size_t pool_spares,
fail_if(TRUE, "write: bufq full but nwritten wrong");
}
/* do one more write on a full bufq, should work */
- res = Curl_bufq_write(&q, test_data, wsize, &n2);
- fail_unless(!res && n2 == wsize, "write should be complete");
+ result = Curl_bufq_write(&q, test_data, wsize, &n2);
+ fail_unless(!result && n2 == wsize, "write should be complete");
nwritten += n2;
/* see that we get all out again */
nread = 0;
while(!Curl_bufq_is_empty(&q)) {
- res = Curl_bufq_read(&q, test_data, rsize, &n2);
- if(res) {
- fail_unless(res, "read-loop: unexpected fail");
+ result = Curl_bufq_read(&q, test_data, rsize, &n2);
+ if(result) {
+ fail_unless(result, "read-loop: unexpected fail");
break;
}
nread += n2;
@@ -211,12 +211,12 @@ static CURLcode test_unit2601(const char *arg)
struct bufq q;
size_t n;
- CURLcode res;
+ CURLcode result;
unsigned char buf[16 * 1024];
Curl_bufq_init(&q, 8 * 1024, 12);
- res = Curl_bufq_read(&q, buf, 128, &n);
- fail_unless(res && res == CURLE_AGAIN, "read empty fail");
+ result = Curl_bufq_read(&q, buf, 128, &n);
+ fail_unless(result && result == CURLE_AGAIN, "read empty fail");
Curl_bufq_free(&q);
check_bufq(0, 1024, 4, 128, 128, BUFQ_OPT_NONE);
tests/unit/unit2602.c+6 -6
@@ -33,7 +33,7 @@ static CURLcode test_unit2602(const char *arg)
struct dynhds hds;
struct dynbuf dbuf;
- CURLcode res;
+ CURLcode result;
size_t i;
/* 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");
/* exceed limit on # of entries */
- res = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
- fail_unless(res, "add should have failed");
+ result = Curl_dynhds_add(&hds, "test3", 5, "789", 3);
+ 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, "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_if(Curl_dynhds_ccontains(&hds, "blablabla"), "should not");
- res = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
- fail_unless(res, "add should have failed");
- if(!res) {
+ result = Curl_dynhds_h1_cadd_line(&hds, "blablabla thingies");
+ fail_unless(result, "add should have failed");
+ if(!result) {
fail_unless(Curl_dynhds_ccount_name(&hds, "bLABlaBlA") == 0, "should");
fail_if(Curl_dynhds_cadd(&hds, "Bla-Bla", "thingies"), "add failed");
tests/unit/unit2603.c+5 -5
@@ -65,7 +65,7 @@ static void parse_success(const struct tcase *t)
struct h1_req_parser p;
const uint8_t *buf;
size_t buflen, i, in_len, in_consumed;
- CURLcode err;
+ CURLcode result;
size_t nread;
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];
buflen = strlen(t->input[i]);
in_len += buflen;
- err = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme,
- t->custom_method, 0, &nread);
- if(err) {
- curl_mfprintf(stderr, "got err %d parsing: '%s'\n", err, buf);
+ result = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme,
+ t->custom_method, 0, &nread);
+ if(result) {
+ curl_mfprintf(stderr, "got result %d parsing: '%s'\n", result, buf);
fail("error consuming");
}
in_consumed += (size_t)nread;
tests/unit/unit2605.c+7 -6
@@ -35,7 +35,7 @@ static CURLcode test_unit2605(const char *arg)
curl_off_t filesize;
curl_off_t start;
curl_off_t size;
- CURLcode res;
+ CURLcode result;
};
int i;
@@ -77,15 +77,16 @@ static CURLcode test_unit2605(const char *arg)
for(i = 0; list[i].r; i++) {
curl_off_t start;
curl_off_t size;
- CURLcode res;
+ CURLcode result;
curl_mprintf("%u: '%s' (file size: %" FMT_OFF_T ")\n", i, list[i].r,
list[i].filesize);
- res = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start, &size);
- if(res != list[i].res) {
- curl_mprintf("... returned %d\n", res);
+ result = Curl_ssh_range(curl, list[i].r, list[i].filesize, &start,
+ &size);
+ if(result != list[i].result) {
+ curl_mprintf("... returned %d\n", result);
unitfail++;
}
- if(!res) {
+ if(!result) {
if(start != list[i].start) {
curl_mprintf("... start (%" FMT_OFF_T ") was not %" FMT_OFF_T " \n",
start, list[i].start);
tests/unit/unit3200.c+24 -24
@@ -75,7 +75,7 @@ static CURLcode test_unit3200(const char *arg)
#endif
size_t i;
- CURLcode res = CURLE_OK;
+ CURLcode result = CURLE_OK;
for(i = 0; i < CURL_ARRAYSIZE(filecontents); i++) {
FILE *fp;
struct dynbuf buf;
@@ -95,62 +95,62 @@ static CURLcode test_unit3200(const char *arg)
curl_mfprintf(stderr, "Test %zd...", i);
switch(i) {
case 0:
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
abort_unless(eof, "Missed EOF (1)");
break;
case 1:
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
abort_unless(eof, "Missed EOF (2)");
break;
case 2:
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
fail_unless(!curlx_dyn_len(&buf),
"Did not detect max read on EOF (3)");
break;
case 3:
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
fail_unless(!curlx_dyn_len(&buf),
"Did not ignore partial on EOF (4)");
break;
case 4:
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
fail_unless(!curlx_dyn_len(&buf),
"Did not bail out on too long line");
break;
case 5:
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
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)");
- res = Curl_get_line(&buf, fp, &eof);
+ result = Curl_get_line(&buf, fp, &eof);
abort_unless(eof, "Missed EOF (6)");
break;
default:
@@ -161,7 +161,7 @@ static CURLcode test_unit3200(const char *arg)
curlx_fclose(fp);
curl_mfprintf(stderr, "OK\n");
}
- return res;
+ return result;
#endif