From: "cron2 (Code Review)" Date: Wed, 8 Apr 2026 12:39:56 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <605980521e035331a4d70b2cc87d0adfd90226b3-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="a9cTF/b8Duo="; 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: flichtenheld Cc: plaisthos , openvpn-devel --a9cTF/b8Duo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/16= 19?usp=3Demail ) 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 Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1619 Message-Id: <20260407205235.31126-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36= 545.html Signed-off-by: Gert Doering --- M src/openvpn/error.h M src/openvpn/options.c M src/openvpnserv/common.c 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openvpn/error.h b/src/openvpn/error.h index 1198994..3b742d7 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -397,7 +397,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 713dcf4..b8d0f5a 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -7044,12 +7044,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: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ia153e0de888c0ee21199b192f3471ce4c08cb5c7 Gerrit-Change-Number: 1619 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --a9cTF/b8Duo= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

Clarify operator precedence in a & b ? c : d=


As suggested by cppcheck.

Change-Id: Ia153e0de888c0ee21199b1= 92f3471ce4c08cb5c7
Signed-off-by: Frank Lichtenheld <frank@...2641...= >
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: https= ://gerrit.openvpn.net/c/openvpn/+/1619
Message-Id: <20260407205235.31= 126-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-deve= l@lists.sourceforge.net/msg36545.html
Signed-off-by: Gert Doering <ge= rt@...1296...>
---
M src/openvpn/error.h
M src/openvpn/options.= c
M src/openvpnserv/common.c
3 files changed, 4 insertions(+), 4 dele= tions(-)

diff --git a/src/openvpn/error.h b/src/openvpn/error.h
i= ndex 1198994..3b742d7 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -397,7 +397,7 @@
static inline msglvl_t
nonfatal(const msgl= vl_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/s= rc/openvpn/options.c b/src/openvpn/options.c
index 713dcf4.= .b8d0f5a 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c

@@ -7044,12 +7044,12 @@=
if (options->routes->flags & RG_REROUTE_GW)
{
setenv_int(es, "= route_redirect_gateway_ipv4",
- options->routes->flags & RG_B= LOCK_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_B= LOCK_LOCAL) ? 2 : 1);
}
#ifdef _W= IN32
/* we need this here to handle pushed --redir= ect-gateway */
diff --git a/src/openvpnserv/common.c b/src/= openvpnserv/common.c
index f60e2f2..7fc8c14 100644--- a/src/openvpnserv/common.c
+++ b/src/openvpnser= v/common.c
@@ -276,7 +276,7 @@

= const WCHAR *mesg[] =3D { msg[0], msg[1] };
= ReportEvent(hEventSource,
- flags & MSG_FLAGS_ERROR ? EVENTLOG_ERR= OR_TYPE : EVENTLOG_INFORMATION_TYPE,
+ (flags & MSG_FLAGS_ERROR) ? EVENTL= OG_ERROR_TYPE : EVENTLOG_INFORMATION_TYPE,
= 0,
EVT_TEXT_2,
= NULL,

To view, visit= change = 1619. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia153e0de888c0ee21199b192f34= 71ce4c08cb5c7
Gerrit-Change-Number: 1619
Gerrit-PatchSet: 3
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>
= --a9cTF/b8Duo=--