]> granicus.if.org Git - curl/commitdiff
tests: fix multiple may be used uninitialized warnings
authorDaniel Stenberg <daniel@haxx.se>
Tue, 5 Mar 2019 12:51:30 +0000 (13:51 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 5 Mar 2019 13:38:25 +0000 (14:38 +0100)
tests/libtest/lib1537.c
tests/libtest/lib1555.c
tests/libtest/lib1900.c
tests/libtest/lib1905.c
tests/libtest/lib556.c
tests/unit/unit1650.c

index 9832c3a30bed14fd064085267d2e2eeaa9bc1822..7c5dde0429a6d02360553899fec6743e9b617d6a 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -30,7 +30,7 @@ int test(char *URL)
   CURLcode res = CURLE_OK;
   char *ptr = NULL;
   int asize;
-  int outlen;
+  int outlen = 0;
   char *raw;
 
   (void)URL; /* we don't use this */
index e4f2255ac17172d197c2158ea7ca9d32c39fdaf1..f7193b5be6fd9896524fd5040b9587fa1f436e04 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2015, 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -36,14 +36,16 @@ static int progressCallback(void *arg,
                             double ulnow)
 {
   CURLcode res = 0;
+  char buffer[256];
+  size_t n = 0;
   (void)arg;
   (void)dltotal;
   (void)dlnow;
   (void)ultotal;
   (void)ulnow;
-  res = curl_easy_recv(curl, NULL, 0, NULL);
+  res = curl_easy_recv(curl, buffer, 256, &n);
   printf("curl_easy_recv returned %d\n", res);
-  res = curl_easy_send(curl, NULL, 0, NULL);
+  res = curl_easy_send(curl, buffer, n, &n);
   printf("curl_easy_send returned %d\n", res);
 
   return 1;
index 1e10bdf34c608ffad911aa2fa3c48e28144c0865..2a70f8eba5ddecb3daf4b4c55666358f0817f079 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing, <linus@haxx.se>
+ * Copyright (C) 2013 - 2019, Linus Nielsen Feltzing, <linus@haxx.se>
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -138,7 +138,7 @@ int test(char *URL)
   CURLM *m = NULL;
   CURLMsg *msg; /* for picking up messages with the transfer status */
   int msgs_left; /* how many messages are left */
-  int running;
+  int running = 0;
   int handlenum = 0;
   struct timeval last_handle_add;
 
index 1d1de27e7b9ae3b13ec48b1566b598c8fa119fb0..b09c4f526e984a606dd5fa259ac73fb70e898054 100644 (file)
@@ -55,7 +55,7 @@ int test(char *URL)
 
   unfinished = 1;
   while(unfinished) {
-    int MAX;
+    int MAX = 0;
     long max_tout;
     fd_set R, W, E;
     struct timeval timeout;
index 69b2c09dd744998590ecc40432be023d971c8016..0595000cef8a51e96e5498603d19bc20aa97a169 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -70,7 +70,7 @@ int test(char *URL)
       "GET /556 HTTP/1.2\r\n"
       "Host: ninja\r\n\r\n";
 #endif
-    size_t iolen;
+    size_t iolen = 0;
 
     res = curl_easy_send(curl, request, strlen(request), &iolen);
 
index adc91236a5ed77aea889e0de0491b8ac6f14fb36..cd6f519f72865faf9d2ee745326a32da5ee25af2 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -152,7 +152,7 @@ static struct dohresp resp[] = {
 
 UNITTEST_START
 {
-  size_t size;
+  size_t size = 0;
   unsigned char buffer[256];
   size_t i;
   unsigned char *p;