From: Frank Lichtenheld Date: Wed, 8 Oct 2025 17:01:57 +0000 (+0200) Subject: options_util: Fix conversion warning in atoi_constrained X-Git-Tag: v2.7_beta3~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fd8c4fa5d6c113925ebf42d47d9e8d3f292309f;p=thirdparty%2Fopenvpn.git options_util: Fix conversion warning in atoi_constrained The whole purpose of the function is to make sure that cast is safe. Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1261 Message-Id: <20251008170202.10333-1-gert@greenie.muc.de> URL: https://sourceforge.net/p/openvpn/mailman/message/59244107/ Signed-off-by: Gert Doering --- diff --git a/src/openvpn/options_util.c b/src/openvpn/options_util.c index 8a1c08370..eba7d3960 100644 --- a/src/openvpn/options_util.c +++ b/src/openvpn/options_util.c @@ -162,11 +162,6 @@ atoi_warn(const char *str, msglvl_t msglevel) return (int)i; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - bool atoi_constrained(const char *str, int *value, const char *name, int min, int max, msglvl_t msglevel) { @@ -194,14 +189,10 @@ atoi_constrained(const char *str, int *value, const char *name, int min, int max return false; } - *value = i; + *value = (int)i; return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static const char *updatable_options[] = { "block-ipv6", "block-outside-dns", "dhcp-option", "dns", "ifconfig", "ifconfig-ipv6",