Arne Schwabe has uploaded this change for review. (
https://gerrit.openvpn.net/c/openvpn/+/2014?usp=email )
Change subject: Fix cppcheck warnings on macOS
......................................................................
Fix cppcheck warnings on macOS
- Replace bzero with memset
memset is nowadays preferred to bzero
- add_route_ipv6: Fix %d used with unsigned int
- add const to two variables that can be const
Found-By: cppcheck on macOS
Change-Id: I10ebb5821829bf738e58fec23f9f9dd65d4626d3
---
M src/openvpn/route.c
M src/openvpn/tun.c
2 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/14/2014/1
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 9c80f3b..4e963c7 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1862,7 +1862,7 @@
#elif defined(TARGET_ANDROID)
char out[64];
- snprintf(out, sizeof(out), "%s/%d %s", network, r6->netbits, device);
+ snprintf(out, sizeof(out), "%s/%u %s", network, r6->netbits, device);
status = management_android_control(management, "ROUTE6", out);
@@ -3348,10 +3348,10 @@
rtm_addrs = RTA_DST | RTA_NETMASK | RTA_IFP;
#endif
- bzero(&m_rtmsg, sizeof(m_rtmsg));
- bzero(&so_dst, sizeof(so_dst));
- bzero(&so_mask, sizeof(so_mask));
- bzero(&rtm, sizeof(struct rt_msghdr));
+ memset(&m_rtmsg, 0, sizeof(m_rtmsg));
+ memset(&so_dst, 0, sizeof(so_dst));
+ memset(&so_mask, 0, sizeof(so_mask));
+ memset(&rtm, 0, sizeof(struct rt_msghdr));
rtm.rtm_type = RTM_GET;
rtm.rtm_flags = RTF_UP | RTF_GATEWAY;
@@ -3566,10 +3566,10 @@
rtm_addrs = RTA_DST | RTA_NETMASK | RTA_IFP;
#endif
- bzero(&m_rtmsg, sizeof(m_rtmsg));
- bzero(&so_dst, sizeof(so_dst));
- bzero(&so_mask, sizeof(so_mask));
- bzero(&rtm, sizeof(struct rt_msghdr));
+ memset(&m_rtmsg, 0, sizeof(m_rtmsg));
+ memset(&so_dst, 0, sizeof(so_dst));
+ memset(&so_mask, 0, sizeof(so_mask));
+ memset(&rtm, 0, sizeof(struct rt_msghdr));
rtm.rtm_type = RTM_GET;
rtm.rtm_flags = RTF_UP;
@@ -3654,7 +3654,7 @@
/* get gateway addr and interface name */
if (gate != NULL)
{
- struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)gate;
+ const struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)gate;
struct in6_addr gw = s6->sin6_addr;
#ifndef TARGET_SOLARIS
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 2c2766f..a61efaf 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1833,7 +1833,7 @@
for (int i = 0; i < 256; ++i)
{
/* some platforms have a dedicated directory per driver */
- char *sep = "";
+ const char *sep = "";
#if defined(TARGET_HAIKU)
sep = "/";
#endif
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2014?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I10ebb5821829bf738e58fec23f9f9dd65d4626d3
Gerrit-Change-Number: 2014
Gerrit-PatchSet: 1
Gerrit-Owner: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel