From: "flichtenheld (Code Review)"
Date: Wed, 24 Sep 2025 14:34:50 +0000
In-Reply-To:
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, max@...2606...
Message-ID: <730af8a5411d6f005c05e0fd2e39f46e364b2829-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="N7n+8jbn/PU="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: event: Silence
conversion warning in tv_to_ms_timeout
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos , MaxF
Cc: openvpn-devel
--N7n+8jbn/PU=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
Hello MaxF, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1178?usp=3Demail
to look at the new patch set (#8).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied=
now.
Change subject: event: Silence conversion warning in tv_to_ms_timeout
......................................................................
event: Silence conversion warning in tv_to_ms_timeout
The APIs want int (at least on unixy systems), so we
use int. max_int() protects us against negative values.
Change-Id: Ie8a242838b6f8b42f36327c33fc62bb5f94ec43f
Signed-off-by: Frank Lichtenheld
---
M src/openvpn/event.c
1 file changed, 10 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/78/1178/8
diff --git a/src/openvpn/event.c b/src/openvpn/event.c
index 2f60b78..ca84d19 100644
--- a/src/openvpn/event.c
+++ b/src/openvpn/event.c
@@ -65,11 +65,15 @@
#define SELECT_MAX_FDS 256
#endif
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
+/** Convert \c timeval value (which is in seconds and microseconds)
+ to a value of milliseconds which is required by multiple polling
+ APIs.
+ @param tv \c timeval to convert
+
+ @return Milliseconds to wait. Zero if \p tv is zero.
+ Otherwise the return value is always greater than zero.
+*/
static inline int
tv_to_ms_timeout(const struct timeval *tv)
{
@@ -79,14 +83,11 @@
}
else
{
- return max_int(tv->tv_sec * 1000 + (tv->tv_usec + 500) / 1000, 1);
+ /* might overflow but not for practically useful numbers */
+ return max_int((int)(tv->tv_sec * 1000 + (tv->tv_usec + 500) / 100=
0), 1);
}
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
#ifdef _WIN32
struct we_set
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1178?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie8a242838b6f8b42f36327c33fc62bb5f94ec43f
Gerrit-Change-Number: 1178
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: MaxF
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
Gerrit-MessageType: newpatchset
--N7n+8jbn/PU=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
flichtenheld uploaded patch set #8 to this change.
<=
p>View C=
hange
The change is no longer submittable: checks~ChecksSubmitRul=
e is unsatisfied now.
event: Silence conversion warning in tv_to_ms_timeout=
The APIs want int (at least on unixy systems), so we
use int. ma=
x_int() protects us against negative values.
Change-Id: Ie8a242838b6=
f8b42f36327c33fc62bb5f94ec43f
Signed-off-by: Frank Lichtenheld <frank=
@...2641...>
---
M src/openvpn/event.c
1 file changed, 10 inser=
tions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/=
openvpn refs/changes/78/1178/8
diff --git a/src/openvpn/event.c b/s=
rc/openvpn/event.c
index 2f60b78..ca84d19 100644
=
--- a/src/openvpn/event.c
+++ b/src/openvpn/event.c=
span>
@@ -65,11 +65,15 @@
#define SELECT_MAX_FDS =
256
#endif
-#if defined(__GNUC__) || defined(__clang__)<=
br>-#pragma GCC diagnostic push=
span>
-#pragma GCC diagnostic =
ignored "-Wconversion"
-#endif
+/*=
* Convert \c timeval value (which is in seconds and microseconds)
+ to a value of millisecond=
s which is required by multiple polling
+ APIs.
+ @param tv \c timeval to convert
<=
span style=3D"color: hsl(120, 100%, 40%);">+
+ @return Milliseconds to wait. Zero if \p tv is=
zero.
+ Otherwis=
e the return value is always greater than zero.
+*/
static inline int
tv_to_ms_timeout(const struct timeval *tv)
{
@@ -79,14 +83,11 @@
}
=
else
{
- return max_int(tv->tv_sec * 1000 + (tv->tv_usec + 500) =
/ 1000, 1);
+ =
/* might overflow but not for practically useful numbers */
+ return max_int((int)(tv->=
;tv_sec * 1000 + (tv->tv_usec + 500) / 1000), 1);
}=
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
=
-#endif
-
#ifdef _WIN32
struct we_set
To vi=
ew, visit change 1178. To unsubscribe, or for help writing mail filters, visit =
settings.
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie8a242838b6f8b42f36327c33fc=
62bb5f94ec43f
Gerrit-Change-Number: 1178
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
Gerrit-Reviewer: MaxF <max@...2606...> <=
/div>
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...>
Gerrit-MessageType: newpatchset
--N7n+8jbn/PU=--