mirror of
https://github.com/curl/curl.git
synced 2025-09-15 08:32:41 +03:00
tests: fix bad printf format flags in test code
This commit is contained in:
parent
4f3d06ec39
commit
51118ba84c
|
@ -103,7 +103,7 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
|
||||||
hasbody = 0;
|
hasbody = 0;
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
if(res != p->result) {
|
if(res != p->result) {
|
||||||
printf("%d: bad error code (%d): resume=%s, fail=%s, http416=%s, "
|
printf("%zd: bad error code (%d): resume=%s, fail=%s, http416=%s, "
|
||||||
"content-range=%s, expected=%d\n", num, res,
|
"content-range=%s, expected=%d\n", num, res,
|
||||||
(p->flags & F_RESUME)? "yes": "no",
|
(p->flags & F_RESUME)? "yes": "no",
|
||||||
(p->flags & F_FAIL)? "yes": "no",
|
(p->flags & F_FAIL)? "yes": "no",
|
||||||
|
|
|
@ -68,7 +68,6 @@ int test(char *URL)
|
||||||
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 0L);
|
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 0L);
|
||||||
curl_easy_setopt(hnd, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);
|
curl_easy_setopt(hnd, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);
|
||||||
|
|
||||||
printf("Start: %d\n", time(NULL));
|
|
||||||
ret = run(hnd, 1, 2);
|
ret = run(hnd, 1, 2);
|
||||||
if(ret)
|
if(ret)
|
||||||
fprintf(stderr, "error %d: %s\n", ret, buffer);
|
fprintf(stderr, "error %d: %s\n", ret, buffer);
|
||||||
|
@ -79,7 +78,6 @@ int test(char *URL)
|
||||||
else
|
else
|
||||||
ret = CURLE_OK;
|
ret = CURLE_OK;
|
||||||
|
|
||||||
printf("End: %d\n", time(NULL));
|
|
||||||
curl_easy_cleanup(hnd);
|
curl_easy_cleanup(hnd);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ static int recv_pong(CURL *curl, const char *exected_payload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr, "ws: curl_ws_recv returned %u, received %u\n", (int)result,
|
fprintf(stderr, "ws: curl_ws_recv returned %u, received %u\n", (int)result,
|
||||||
rlen);
|
(int)rlen);
|
||||||
return (int)result;
|
return (int)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void websocket(CURL *curl)
|
||||||
printf("curl_ws_recv returned %d\n", (int)result);
|
printf("curl_ws_recv returned %d\n", (int)result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("%u: nread %u Age %u Flags %x "
|
printf("%u: nread %zu Age %u Flags %x "
|
||||||
"Offset %" CURL_FORMAT_CURL_OFF_T " "
|
"Offset %" CURL_FORMAT_CURL_OFF_T " "
|
||||||
"Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
|
"Bytesleft %" CURL_FORMAT_CURL_OFF_T "\n",
|
||||||
(int)i,
|
(int)i,
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
* curl_m*printf formatting capabilities and handling of some data types.
|
* curl_m*printf formatting capabilities and handling of some data types.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CURL_NO_FMT_CHECKS /* disable compiler *printf format checks */
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
|
@ -54,13 +54,13 @@ UNITTEST_START
|
||||||
for(i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
|
for(i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
|
||||||
timediff_t result = Curl_timediff(tests[i].first, tests[i].second);
|
timediff_t result = Curl_timediff(tests[i].first, tests[i].second);
|
||||||
if(result != tests[i].result) {
|
if(result != tests[i].result) {
|
||||||
printf("%d.%06u to %d.%06u got %d, but expected %d\n",
|
printf("%ld.%06u to %ld.%06u got %d, but expected %ld\n",
|
||||||
tests[i].first.tv_sec,
|
(long)tests[i].first.tv_sec,
|
||||||
tests[i].first.tv_usec,
|
tests[i].first.tv_usec,
|
||||||
tests[i].second.tv_sec,
|
(long)tests[i].second.tv_sec,
|
||||||
tests[i].second.tv_usec,
|
tests[i].second.tv_usec,
|
||||||
result,
|
(int)result,
|
||||||
tests[i].result);
|
(long)tests[i].result);
|
||||||
fail("unexpected result!");
|
fail("unexpected result!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
* SPDX-License-Identifier: curl
|
* SPDX-License-Identifier: curl
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#define CURL_NO_FMT_CHECKS
|
||||||
|
|
||||||
#include "curlcheck.h"
|
#include "curlcheck.h"
|
||||||
|
|
||||||
#include "curl/mprintf.h"
|
#include "curl/mprintf.h"
|
||||||
|
|
|
@ -190,7 +190,7 @@ UNITTEST_START
|
||||||
|
|
||||||
if(port != tests[i].port) {
|
if(port != tests[i].port) {
|
||||||
fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
|
fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
|
||||||
"for tests[%d].address[%d] is %ld but tests[%d].port is %d.\n",
|
"for tests[%d].address[%d] is %d but tests[%d].port is %d.\n",
|
||||||
__FILE__, __LINE__, i, i, j, port, i, tests[i].port);
|
__FILE__, __LINE__, i, i, j, port, i, tests[i].port);
|
||||||
problem = true;
|
problem = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -189,7 +189,7 @@ UNITTEST_START
|
||||||
|
|
||||||
if(port != tests[i].port) {
|
if(port != tests[i].port) {
|
||||||
fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
|
fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
|
||||||
"for tests[%d].address[%d] is %ld but tests[%d].port is %d.\n",
|
"for tests[%d].address[%d] is %d but tests[%d].port is %d.\n",
|
||||||
__FILE__, __LINE__, i, i, j, port, i, tests[i].port);
|
__FILE__, __LINE__, i, i, j, port, i, tests[i].port);
|
||||||
problem = true;
|
problem = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -94,7 +94,7 @@ UNITTEST_START
|
||||||
fp = fopen(arg, "rb");
|
fp = fopen(arg, "rb");
|
||||||
abort_unless(fp != NULL, "Cannot open testfile");
|
abort_unless(fp != NULL, "Cannot open testfile");
|
||||||
|
|
||||||
fprintf(stderr, "Test %d...", i);
|
fprintf(stderr, "Test %zd...", i);
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 0:
|
case 0:
|
||||||
line = Curl_get_line(buf, len, fp);
|
line = Curl_get_line(buf, len, fp);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user