From: Aki Tuomi Date: Wed, 29 Oct 2025 11:00:24 +0000 (+0200) Subject: lib: Fix signedness in assert in time_to_uint32() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6535a1c5e1c992ed5e6171633e2bfbdd684fb411;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix signedness in assert in time_to_uint32() If time_t is signed and 32-bit, this can cause warnings. --- diff --git a/src/lib/lib.h b/src/lib/lib.h index 46b6776d79..d933dc07ad 100644 --- a/src/lib/lib.h +++ b/src/lib/lib.h @@ -142,7 +142,9 @@ static inline uint32_t i_rand_minmax(uint32_t min_val, uint32_t max_val) static inline uint32_t time_to_uint32(time_t ts) { i_assert(ts >= 0); +#if TIME_T_MAX_BITS > 32 i_assert(ts <= UINT32_MAX); +#endif return (uint32_t)(ts & 0xffffffff); } /* Cast time_t to uint32_t, truncate the value if it does not fit. */