Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-cl warning in 'http/clients/ws-data.c' #13301

gvanem opened this issue Apr 6, 2024 · 4 comments

clang-cl warning in 'http/clients/ws-data.c' #13301

gvanem opened this issue Apr 6, 2024 · 4 comments


Copy link

gvanem commented Apr 6, 2024

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 @@

-  if(!res)
+  if(res == CURLE_OK)
   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


jay pushed a commit to jay/curl that referenced this issue Apr 6, 2024
- Init result code variable to fix clang warning that it may be used

Fixes curl#13301
Closes #xxxx
Copy link

jay commented 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

@jay jay added the build label Apr 6, 2024
Copy link
Contributor Author

gvanem commented Apr 7, 2024

Work w/o warnings.

let me know if you want it changed to yahoo

Yes, please.

@jay jay closed this as completed in a42de08 Apr 7, 2024
Copy link

jay commented Apr 7, 2024


Copy link

bagder commented Apr 9, 2024

I'll update the mailmap for Gisle to prefer the yahoo address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging a pull request may close this issue.

3 participants