]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix signedness in assert in time_to_uint32()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 29 Oct 2025 11:00:24 +0000 (13:00 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 29 Oct 2025 11:05:51 +0000 (13:05 +0200)
If time_t is signed and 32-bit, this can cause warnings.

src/lib/lib.h

index 46b6776d79b674ca2039b653eda36392077eded4..d933dc07adcc17075fcecdcdd066c0dad315fdce 100644 (file)
@@ -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. */