From: Frank Lichtenheld Date: Mon, 13 Oct 2025 16:23:08 +0000 (+0200) Subject: schedule: Fix conversion warning X-Git-Tag: v2.7_rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f79221a9e0ee0ce4100b02ac5070f9d18fc7e8a8;p=thirdparty%2Fopenvpn.git schedule: Fix conversion warning Return value of random() is safe to cast. Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270 Message-Id: <20251013162313.2276-1-gert@greenie.muc.de> URL: https://sourceforge.net/p/openvpn/mailman/message/59246224/ Signed-off-by: Gert Doering --- diff --git a/src/openvpn/schedule.c b/src/openvpn/schedule.c index 1389889d4..bf6693fcd 100644 --- a/src/openvpn/schedule.c +++ b/src/openvpn/schedule.c @@ -65,25 +65,16 @@ schedule_entry_debug_info(const char *caller, const struct schedule_entry *e) } #endif -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static inline void schedule_set_pri(struct schedule_entry *e) { - e->pri = random(); + e->pri = (unsigned int)random(); if (e->pri < 1) { e->pri = 1; } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* This is the master key comparison routine. A key is * simply a struct timeval containing the absolute time for * an event. The unique treap priority (pri) is used to ensure