lib:util: Use portable integer constants
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Sun, 10 Dec 2023 23:55:05 +0000 (12:55 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 21 Dec 2023 20:21:34 +0000 (20:21 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/time.c

index bfeb6f4a63c6572edf5925d2ad260d7a4e40fc23..31bb0a7aad9fccedbed944548feb034a541901ef 100644 (file)
@@ -136,7 +136,7 @@ _PUBLIC_ void unix_to_nt_time(NTTIME *nt, time_t t)
        uint64_t t2;
 
        if (t == (time_t)-1) {
-               *nt = (NTTIME)-1LL;
+               *nt = UINT64_MAX;
                return;
        }
 
@@ -897,7 +897,7 @@ struct timespec nt_time_to_unix_timespec(NTTIME nt)
 {
        struct timespec ret;
 
-       if (nt == 0 || nt == (int64_t)-1) {
+       if (nt == 0 || nt == UINT64_MAX) {
                ret.tv_sec = 0;
                ret.tv_nsec = 0;
                return ret;
@@ -1049,7 +1049,7 @@ _PUBLIC_ NTTIME unix_timespec_to_nt_time(struct timespec ts)
                return 0x7fffffffffffffffLL;
        }
        if (ts.tv_sec == (time_t)-1) {
-               return (uint64_t)-1;
+               return UINT64_MAX;
        }
 
        d = ts.tv_sec;