]> granicus.if.org Git - curl/commitdiff
libtest: fix MSVC warning C4706
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sun, 16 Jul 2017 11:44:54 +0000 (13:44 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Sun, 16 Jul 2017 12:02:59 +0000 (14:02 +0200)
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.

tests/libtest/lib1515.c
tests/libtest/lib1531.c
tests/libtest/lib1900.c

index 7763c2233f46c625b7dd9798bfb4f0aa7b400f81..c1499381aeed13e298b25825fcd94fcc813eed3b 100644 (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:
 
index e6386b2646f4d5a129d391cfc5ea58cd7b80a9eb..287acd6c653bdf02b452754c9c4350479677058d 100644 (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);
 
index b55f3b7d83354401365ee2e4599574b7c2fc9811..cac1dd1d97b25b9d1633b1f00a72a223afe2052c 100644 (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 */