From: "flichtenheld (Code Review)"
Date: Tue, 7 Apr 2026 20:06:24 +0000
In-Reply-To:
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, gert@...1296...
Message-ID:
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="ZuPiQtncVzE="; charset=UTF-8
Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Clarify operator
precedence in a & b ? c : d
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos
Cc: openvpn-devel
--ZuPiQtncVzE=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
Hello cron2, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1619?usp=3Demail
to look at the new patch set (#2).
Change subject: Clarify operator precedence in a & b ? c : d
......................................................................
Clarify operator precedence in a & b ? c : d
As suggested by cppcheck.
Change-Id: Ia153e0de888c0ee21199b192f3471ce4c08cb5c7
Signed-off-by: Frank Lichtenheld
---
M src/openvpn/error.h
M src/openvpn/options.c
M src/openvpnserv/common.c
3 files changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/19/1619/2
diff --git a/src/openvpn/error.h b/src/openvpn/error.h
index 62389af..03d880f 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -399,7 +399,7 @@
static inline msglvl_t
nonfatal(const msglvl_t err)
{
- return err & M_FATAL ? (err ^ M_FATAL) | M_NONFATAL : err;
+ return (err & M_FATAL) ? (err ^ M_FATAL) | M_NONFATAL : err;
}
static inline int
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 186b2d2..e4905c9 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -7043,12 +7043,12 @@
if (options->routes->flags & RG_REROUTE_GW)
{
setenv_int(es, "route_redirect_gateway_ipv4",
- options->routes->flags & RG_BLOCK_LOCAL ? 2 : 1);
+ (options->routes->flags & RG_BLOCK_LOCAL) ? 2 : 1);
}
if (options->routes_ipv6 && (options->routes_ipv6->flags & RG_RERO=
UTE_GW))
{
setenv_int(es, "route_redirect_gateway_ipv6",
- options->routes->flags & RG_BLOCK_LOCAL ? 2 : 1);
+ (options->routes->flags & RG_BLOCK_LOCAL) ? 2 : 1);
}
#ifdef _WIN32
/* we need this here to handle pushed --redirect-gateway */
diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c
index f60e2f2..7fc8c14 100644
--- a/src/openvpnserv/common.c
+++ b/src/openvpnserv/common.c
@@ -276,7 +276,7 @@
const WCHAR *mesg[] =3D { msg[0], msg[1] };
ReportEvent(hEventSource,
- flags & MSG_FLAGS_ERROR ? EVENTLOG_ERROR_TYPE : EVENTL=
OG_INFORMATION_TYPE,
+ (flags & MSG_FLAGS_ERROR) ? EVENTLOG_ERROR_TYPE : EVEN=
TLOG_INFORMATION_TYPE,
0,
EVT_TEXT_2,
NULL,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1619?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia153e0de888c0ee21199b192f3471ce4c08cb5c7
Gerrit-Change-Number: 1619
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: cron2
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
--ZuPiQtncVzE=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is cur=
rently required from: flichtenheld, plaisthos.
flichtenheld uploaded patch set #2 to this change.
<=
p>View C=
hange
Clarify operator precedence in a & b ? c : d=
As suggested by cppcheck.
Change-Id: Ia153e0de888c0ee21199b1=
92f3471ce4c08cb5c7
Signed-off-by: Frank Lichtenheld <frank@...2641...=
>
---
M src/openvpn/error.h
M src/openvpn/options.c
M src/op=
envpnserv/common.c
3 files changed, 4 insertions(+), 4 deletions(-)
<=
br>
git pull ssh://gerrit.openvpn.net:29418/openvpn refs=
/changes/19/1619/2
diff --git a/src/openvpn/error.h b/src/openvpn/e=
rror.h
index 62389af..03d880f 100644
--- a/=
src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -399,7 +399,7 @@
static inline msglvl_t
nonfatal(const msglvl_t err)
{
- return err & M_FATAL ? (err ^ M_FAT=
AL) | M_NONFATAL : err;
+ return (err & M_FATAL) ? (err ^ M_FATAL) | M_NONFATAL : err;
}
static inline int
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 186b2d2..e4905c9 100644
--- a/src/openvpn/=
options.c
+++ b/src/openvpn/options.c
@@ -7=
043,12 +7043,12 @@
if (options->routes->flag=
s & RG_REROUTE_GW)
{
=
setenv_int(es, "route_redirect_gateway_ipv4",
- options->ro=
utes->flags & RG_BLOCK_LOCAL ? 2 : 1);
+ (options->routes->fl=
ags & RG_BLOCK_LOCAL) ? 2 : 1);
}
if (options->routes_ipv6 && (options->routes_ipv=
6->flags & RG_REROUTE_GW))
{
setenv_int(es, "route_redirect_gateway_ipv6",
- opt=
ions->routes->flags & RG_BLOCK_LOCAL ? 2 : 1);
+ (options->ro=
utes->flags & RG_BLOCK_LOCAL) ? 2 : 1);
}=
span>
#ifdef _WIN32
/* we need this here=
to handle pushed --redirect-gateway */
diff --git a/src/op=
envpnserv/common.c b/src/openvpnserv/common.c
index f60e2f2=
..7fc8c14 100644
--- a/src/openvpnserv/common.c
<=
span>+++ b/src/openvpnserv/common.c
@@ -276,7 +276,7 @@
const WCHAR *mesg[] =3D { msg[0], m=
sg[1] };
ReportEvent(hEventSource,
- flags & MSG_F=
LAGS_ERROR ? EVENTLOG_ERROR_TYPE : EVENTLOG_INFORMATION_TYPE,
+ (flags & =
MSG_FLAGS_ERROR) ? EVENTLOG_ERROR_TYPE : EVENTLOG_INFORMATION_TYPE,<=
br> 0,
EVT_T=
EXT_2,
NULL,
To view, visit change 1619. To unsubscribe, or for help writing mail=
filters, visit =
settings.
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia153e0de888c0ee21199b192f34=
71ce4c08cb5c7
Gerrit-Change-Number: 1619
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
=
--ZuPiQtncVzE=--