libtest: fix MSVC warning C4706

With warning level 4, MSVC warns about assignments within conditional
expressions. Change the while loop to a do-while loop to fix this. This
change is also consistent with CODE_STYLE.md.
This commit is contained in:
Marcel Raad 2017-07-16 13:44:54 +02:00
parent 0bdb811250
commit fb3b0f25ef
No known key found for this signature in database
GPG Key ID: 07ADACB610D796DA
3 changed files with 12 additions and 9 deletions

View File

@ -95,12 +95,13 @@ static int do_one_request(CURLM *m, char *URL, char *resolve)
abort_on_test_timeout();
}
while((msg = curl_multi_info_read(m, &msgs_left))) {
if(msg->msg == CURLMSG_DONE && msg->easy_handle == curls) {
do {
msg = curl_multi_info_read(m, &msgs_left);
if(msg && msg->msg == CURLMSG_DONE && msg->easy_handle == curls) {
res = msg->data.result;
break;
}
}
} while(msg);
test_cleanup:

View File

@ -127,12 +127,13 @@ int test(char *URL)
} while(still_running);
/* See how the transfers went */
while((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
if(msg->msg == CURLMSG_DONE) {
do {
msg = curl_multi_info_read(multi_handle, &msgs_left);
if(msg && msg->msg == CURLMSG_DONE) {
printf("HTTP transfer completed with status %d\n", msg->data.result);
break;
}
}
} while(msg);
curl_multi_cleanup(multi_handle);

View File

@ -189,8 +189,9 @@ int test(char *URL)
abort_on_test_timeout();
/* See how the transfers went */
while((msg = curl_multi_info_read(m, &msgs_left))) {
if(msg->msg == CURLMSG_DONE) {
do {
msg = curl_multi_info_read(m, &msgs_left);
if(msg && msg->msg == CURLMSG_DONE) {
int i, found = 0;
/* Find out which handle this message is about */
@ -203,7 +204,7 @@ int test(char *URL)
printf("Handle %d Completed with status %d\n", i, msg->data.result);
curl_multi_remove_handle(m, handles[i]);
}
}
} while(msg);
if(handlenum == num_handles && !running) {
break; /* done */