]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
options_util: Fix conversion warning in atoi_constrained
authorFrank Lichtenheld <frank@lichtenheld.com>
Wed, 8 Oct 2025 17:01:57 +0000 (19:01 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 9 Oct 2025 14:50:30 +0000 (16:50 +0200)
The whole purpose of the function is to make sure
that cast is safe.

Change-Id: Id08524661aa5bcc5cd42f27a1aacc636e2b2b004
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>
src/openvpn/options_util.c

index 8a1c0837020ac0a63e514850466eace5806bff79..eba7d396011dc993eb8b377e045701a6ae779a2e 100644 (file)
@@ -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",