|
| 1 | +From c45360d4633850839bb9c2d77dbf8a8285e9ad49 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Marian Klymov <nekto1989@gmail.com> |
| 3 | +Date: Sat, 2 Jun 2018 23:52:56 +0300 |
| 4 | +Subject: [PATCH] cppcheck: fix warnings |
| 5 | + |
| 6 | +- Get rid of variable that was generating false positive warning |
| 7 | +(unitialized) |
| 8 | + |
| 9 | +- Fix issues in tests |
| 10 | + |
| 11 | +- Reduce scope of several variables all over |
| 12 | + |
| 13 | +etc |
| 14 | + |
| 15 | +Closes #2631 |
| 16 | +--- |
| 17 | + lib/base64.c | 3 +-- |
| 18 | + lib/connect.c | 6 +----- |
| 19 | + lib/content_encoding.c | 8 +++----- |
| 20 | + lib/cookie.c | 7 +++---- |
| 21 | + lib/curl_sasl.c | 3 +-- |
| 22 | + lib/dict.c | 6 +++--- |
| 23 | + lib/escape.c | 6 ++---- |
| 24 | + lib/file.c | 6 +++--- |
| 25 | + lib/formdata.c | 3 +-- |
| 26 | + lib/ftp.c | 13 ++++++------- |
| 27 | + lib/hash.c | 11 ++++------- |
| 28 | + lib/http.c | 10 ++++------ |
| 29 | + lib/http_proxy.c | 2 +- |
| 30 | + lib/imap.c | 8 ++++---- |
| 31 | + lib/mime.c | 32 +++++++++++--------------------- |
| 32 | + lib/multi.c | 7 +++---- |
| 33 | + lib/pingpong.c | 3 +-- |
| 34 | + lib/pop3.c | 4 ++-- |
| 35 | + lib/progress.c | 39 ++++++++++++++++++++------------------- |
| 36 | + lib/rtsp.c | 6 ++---- |
| 37 | + lib/select.c | 8 +++++--- |
| 38 | + lib/sendf.c | 2 +- |
| 39 | + lib/sendf.h | 4 ++-- |
| 40 | + lib/sha256.c | 12 ++++++------ |
| 41 | + lib/smtp.c | 2 +- |
| 42 | + lib/socks.c | 8 ++++---- |
| 43 | + lib/splay.c | 3 +-- |
| 44 | + lib/telnet.c | 32 ++++++++++++++++---------------- |
| 45 | + lib/tftp.c | 16 +++++++--------- |
| 46 | + lib/transfer.c | 2 +- |
| 47 | + lib/url.c | 15 +++++++-------- |
| 48 | + lib/vauth/digest.c | 6 +++--- |
| 49 | + src/tool_cb_dbg.c | 10 +++++----- |
| 50 | + src/tool_cb_prg.c | 12 ++++++------ |
| 51 | + src/tool_formparse.c | 5 ++--- |
| 52 | + src/tool_getparam.c | 6 ++---- |
| 53 | + src/tool_libinfo.c | 2 +- |
| 54 | + src/tool_msgs.c | 2 +- |
| 55 | + src/tool_paramhlp.c | 10 +++++----- |
| 56 | + src/tool_parsecfg.c | 8 +++----- |
| 57 | + src/tool_urlglob.c | 2 +- |
| 58 | + src/tool_writeout.c | 4 ++-- |
| 59 | + tests/libtest/lib1537.c | 15 +++++---------- |
| 60 | + tests/libtest/lib1554.c | 3 +-- |
| 61 | + tests/libtest/lib1900.c | 8 ++++---- |
| 62 | + tests/libtest/lib506.c | 2 +- |
| 63 | + tests/libtest/lib512.c | 6 ++---- |
| 64 | + tests/libtest/lib556.c | 2 +- |
| 65 | + tests/libtest/lib579.c | 3 +-- |
| 66 | + tests/libtest/lib586.c | 2 +- |
| 67 | + tests/libtest/testtrace.c | 2 +- |
| 68 | + tests/server/getpart.c | 2 +- |
| 69 | + tests/server/rtspd.c | 18 +++++++----------- |
| 70 | + tests/server/sockfilt.c | 29 ++++++++++++----------------- |
| 71 | + tests/server/sws.c | 5 ++--- |
| 72 | + tests/server/testpart.c | 6 +++--- |
| 73 | + tests/server/tftpd.c | 16 +++++++--------- |
| 74 | + tests/server/util.c | 5 ++--- |
| 75 | + tests/unit/unit1300.c | 2 +- |
| 76 | + tests/unit/unit1303.c | 2 +- |
| 77 | + tests/unit/unit1307.c | 4 ++-- |
| 78 | + 61 files changed, 213 insertions(+), 273 deletions(-) |
| 79 | + |
| 80 | +diff --git a/lib/connect.c b/lib/connect.c |
| 81 | +index 1a27ae1353..12ae817e31 100644 |
| 82 | +--- a/lib/connect.c |
| 83 | ++++ b/lib/connect.c |
| 84 | +@@ -1237,8 +1237,6 @@ static int conn_is_conn(struct connectdata *conn, void *param) |
| 85 | + curl_socket_t Curl_getconnectinfo(struct Curl_easy *data, |
| 86 | + struct connectdata **connp) |
| 87 | + { |
| 88 | +- curl_socket_t sockfd; |
| 89 | +- |
| 90 | + DEBUGASSERT(data); |
| 91 | + |
| 92 | + /* this works for an easy handle: |
| 93 | +@@ -1264,12 +1262,10 @@ curl_socket_t Curl_getconnectinfo(struct Curl_easy *data, |
| 94 | + if(connp) |
| 95 | + /* only store this if the caller cares for it */ |
| 96 | + *connp = c; |
| 97 | +- sockfd = c->sock[FIRSTSOCKET]; |
| 98 | ++ return c->sock[FIRSTSOCKET]; |
| 99 | + } |
| 100 | + else |
| 101 | + return CURL_SOCKET_BAD; |
| 102 | +- |
| 103 | +- return sockfd; |
| 104 | + } |
| 105 | + |
| 106 | + /* |
0 commit comments