Closed
Description
I did this
Another clang-cl warning similar to this:
ws-data.c(195,7): warning: variable 'res' may be uninitialized when used here [-Wconditional-uninitialized]
195 | if(!res)
| ^~~
ws-data.c(171,3): note: variable 'res' is declared here
171 | CURLcode res;
| ^
1 warning generated.
Small fix:
--- a/http/clients/ws-data.c 2023-09-06 13:15:12
+++ b/http/clients/ws-data.c 2024-04-06 09:30:31
@@ -168,7 +168,7 @@
static CURLcode data_echo(CURL *curl, size_t plen_min, size_t plen_max)
{
- CURLcode res;
+ CURLcode res = CURLE_OK; /* assume success */
size_t len;
char *send_buf;
size_t i;
@@ -192,7 +192,7 @@
}
out:
- if(!res)
+ if(res == CURLE_OK)
websocket_close(curl);
free(send_buf);
return res;
But not sure since I failed to find a suitable test for it.
All I'm getting is Not a websocket transfer
or HTTP/1.1 426 Upgrade Required
from some Mongoose examples.
I expected the following
No warning.
curl/libcurl version
git master
operating system
Win-10.
Activity
tests/http: fix compiler warning
jay commentedon Apr 6, 2024
Please try #13304. I used your gmail in the author field of the commit, let me know if you want it changed to yahoo
gvanem commentedon Apr 7, 2024
Work w/o warnings.
Yes, please.
jay commentedon Apr 7, 2024
Thanks
tests/http: fix compiler warning
bagder commentedon Apr 9, 2024
I'll update the mailmap for Gisle to prefer the yahoo address.