[Openvpn-devel,v3] Fix various issues found by cppcheck 2.21.0
Commit Message
From: Frank Lichtenheld <frank@lichtenheld.com>
- Fix several constVariablePointer issues that
were newly reported
- Fix one unreadVariable issue that was newly
reported
- Remove --showtime=summary from cppcheck args
again, it is now much more verbose
Change-Id: I6693b5aa2988102f5e7884a65119ebfc87dd07e1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1954
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1954
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>
@@ -33,7 +33,7 @@
--suppress-xml=${SCRIPT_DIR}/cppcheck-suppressions.xml --inline-suppr \
--cppcheck-build-dir=${CPPCHECK_DIR} \
--check-level=${CPPCHECK_CHECK_LEVEL} --max-configs=10 \
- --error-exitcode=1 --showtime=summary"
+ --error-exitcode=1"
set -x
@@ -534,7 +534,7 @@
ASSERT(sock->info.connection_established);
struct sockaddr *remoteaddr = &sock->info.lsa->actual.dest.addr.sa;
- struct tls_multi *multi = c->c2.tls_multi;
+ const struct tls_multi *multi = c->c2.tls_multi;
#ifdef TARGET_FREEBSD
/* In Linux in P2P mode the kernel automatically removes an existing peer
* when adding a new peer. FreeBSD needs to explicitly be told to do that */
@@ -316,10 +316,9 @@
multi_get_instance_udp_real(struct multi_context *m, struct mroute_addr *real)
{
struct hash *hash = m->hash;
- struct hash_element *he;
const uint64_t hv = hash_value(hash, real);
struct hash_bucket *bucket = hash_bucket(hash, hv);
- he = hash_lookup_fast(hash, bucket, real, hv);
+ const struct hash_element *he = hash_lookup_fast(hash, bucket, real, hv);
if (he)
{
return he->value;
@@ -184,7 +184,6 @@
{
tbs = buf;
tbslen = (size_t)buflen;
- sigalg.op = "Sign";
}
else
{
@@ -323,8 +323,7 @@
return port;
}
- struct servent *service;
- service = getservbyname(servname, NULL);
+ const struct servent *service = getservbyname(servname, NULL);
if (service)
{
return service->s_port;
@@ -101,7 +101,7 @@
bool
siphash_openssl_available(void *sip_context)
{
- struct siphash_context *sip = sip_context;
+ const struct siphash_context *sip = sip_context;
return (bool)(sip->mac);
}