From f31365d6e924d3bbf2993b3a40826f72d5e2f5d6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 8 Mar 2026 20:44:55 +0100 Subject: [PATCH] fixes --- tests/unit/unit1650.c | 11 ++++++----- tests/unit/unit1652.c | 2 +- tests/unit/unit1660.c | 2 +- tests/unit/unit1664.c | 32 ++++++++++++++++---------------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c index f634cb4af2..4c58d8330c 100644 --- a/tests/unit/unit1650.c +++ b/tests/unit/unit1650.c @@ -155,7 +155,7 @@ static CURLcode test_unit1650(const char *arg) buffer, sizeof(buffer), &size); if(rc != req[i].rc) { curl_mfprintf(stderr, "req %zu: Expected return code %d got %d\n", i, - req[i].rc, rc); + (int)req[i].rc, (int)rc); abort_if(rc != req[i].rc, "return code"); } if(size != req[i].size) { @@ -184,7 +184,7 @@ static CURLcode test_unit1650(const char *arg) resp[i].type, &d); if(rc != resp[i].rc) { curl_mfprintf(stderr, "resp %zu: Expected return code %d got %d\n", i, - resp[i].rc, rc); + (int)resp[i].rc, (int)rc); abort_if(rc != resp[i].rc, "return code"); } len = sizeof(buffer); @@ -240,7 +240,7 @@ static CURLcode test_unit1650(const char *arg) i, CURL_DNS_TYPE_A, &d); if(!rc) { /* none of them should work */ - curl_mfprintf(stderr, "%zu: %d\n", i, rc); + curl_mfprintf(stderr, "%zu: %d\n", i, (int)rc); abort_if(!rc, "error rc"); } } @@ -254,7 +254,7 @@ static CURLcode test_unit1650(const char *arg) sizeof(full49) - i - 1, CURL_DNS_TYPE_A, &d); if(!rc) { /* none of them should work */ - curl_mfprintf(stderr, "2 %zu: %d\n", i, rc); + curl_mfprintf(stderr, "2 %zu: %d\n", i, (int)rc); abort_if(!rc, "error rc"); } } @@ -272,7 +272,8 @@ static CURLcode test_unit1650(const char *arg) curl_msnprintf((char *)buffer, sizeof(buffer), "%u.%u.%u.%u", p[0], p[1], p[2], p[3]); if(rc || strcmp((const char *)buffer, "127.0.0.1")) { - curl_mfprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc); + curl_mfprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, + (int)rc); abort_if(rc || strcmp((const char *)buffer, "127.0.0.1"), "bad address"); } fail_if(d.numcname, "bad cname counter"); diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c index 13c1b0175a..7d940df055 100644 --- a/tests/unit/unit1652.c +++ b/tests/unit/unit1652.c @@ -102,7 +102,7 @@ static CURLcode test_unit1652(const char *arg) fail_unless(verify(output, input) == 0, "Simple string test"); /* Injecting a few different variables with a format */ - Curl_infof(easy, "%s %u testing %lu", input, 42, 43L); + Curl_infof(easy, "%s %d testing %ld", input, 42, 43L); fail_unless(verify(output, "Simple Test 42 testing 43\n") == 0, "Format string"); diff --git a/tests/unit/unit1660.c b/tests/unit/unit1660.c index 23a4b8bf1a..6b4f69880d 100644 --- a/tests/unit/unit1660.c +++ b/tests/unit/unit1660.c @@ -132,7 +132,7 @@ static CURLcode test_unit1660(const char *arg) continue; } else if(result) { - curl_mprintf("Input %u: error %d\n", i, result); + curl_mprintf("Input %d: error %d\n", i, result); continue; } } diff --git a/tests/unit/unit1664.c b/tests/unit/unit1664.c index 4a94b6975e..b2f1f07b40 100644 --- a/tests/unit/unit1664.c +++ b/tests/unit/unit1664.c @@ -61,7 +61,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = wordparse[i]; const char *orgline = line; int rc = curlx_str_word(&line, &out, 7); - curl_mprintf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n", + curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n", i, orgline, rc, (int)out.len, out.str, (int)out.len, (int)(line - orgline)); } @@ -72,7 +72,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = wordparse[i]; const char *orgline = line; int rc = curlx_str_until(&line, &out, 7, 'd'); - curl_mprintf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n", + curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n", i, orgline, rc, (int)out.len, out.str, (int)out.len, (int)(line - orgline)); } @@ -105,7 +105,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = qwords[i]; const char *orgline = line; int rc = curlx_str_quotedword(&line, &out, 7); - curl_mprintf("%u: (\"%s\") %d, \"%.*s\" [%d], line %d\n", + curl_mprintf("%d: (\"%s\") %d, \"%.*s\" [%d], line %d\n", i, orgline, rc, (int)out.len, out.str, (int)out.len, (int)(line - orgline)); } @@ -127,7 +127,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = single[i]; const char *orgline = line; int rc = curlx_str_single(&line, 'a'); - curl_mprintf("%u: (\"%s\") %d, line %d\n", + curl_mprintf("%d: (\"%s\") %d, line %d\n", i, orgline, rc, (int)(line - orgline)); } } @@ -150,7 +150,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = single[i]; const char *orgline = line; int rc = curlx_str_singlespace(&line); - curl_mprintf("%u: (\"%s\") %d, line %d\n", + curl_mprintf("%d: (\"%s\") %d, line %d\n", i, orgline, rc, (int)(line - orgline)); } } @@ -171,7 +171,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = single[i]; const char *orgline = line; int rc = curlx_str_single(&line, 'a'); - curl_mprintf("%u: (\"%s\") %d, line %d\n", + curl_mprintf("%d: (\"%s\") %d, line %d\n", i, orgline, rc, (int)(line - orgline)); } } @@ -198,7 +198,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_number(&line, &num, 1235); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -230,7 +230,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i].str; const char *orgline = line; int rc = curlx_str_number(&line, &num, nums[i].max); - curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T + curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n", i, orgline, nums[i].max, rc, num); } @@ -270,7 +270,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i].str; const char *orgline = line; int rc = curlx_str_hex(&line, &num, nums[i].max); - curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T + curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n", i, orgline, nums[i].max, rc, num); } @@ -305,7 +305,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i].str; const char *orgline = line; int rc = curlx_str_octal(&line, &num, nums[i].max); - curl_mprintf("%u: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T + curl_mprintf("%d: (\"%s\") max %" CURL_FORMAT_CURL_OFF_T " == %d, [%" CURL_FORMAT_CURL_OFF_T "]\n", i, orgline, nums[i].max, rc, num); } @@ -341,7 +341,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_number(&line, &num, CURL_OFF_T_MAX); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -366,7 +366,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = newl[i]; const char *orgline = line; int rc = curlx_str_newline(&line); - curl_mprintf("%u: (%%%02x) %d, line %d\n", + curl_mprintf("%d: (%%%02x) %d, line %d\n", i, *orgline, rc, (int)(line - orgline)); } } @@ -393,7 +393,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_hex(&line, &num, 0x1235); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -420,7 +420,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_octal(&line, &num, 01235); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -444,7 +444,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_octal(&line, &num, CURL_OFF_T_MAX); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } } @@ -480,7 +480,7 @@ static CURLcode test_unit1664(const char *arg) const char *line = nums[i]; const char *orgline = line; int rc = curlx_str_hex(&line, &num, CURL_OFF_T_MAX); - curl_mprintf("%u: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", + curl_mprintf("%d: (\"%s\") %d, [%" CURL_FORMAT_CURL_OFF_T "] line %d\n", i, orgline, rc, num, (int)(line - orgline)); } }