]> granicus.if.org Git - nethack/commitdiff
Avoid casting time_t to int
authorSHIRAKATA Kentaro <argrath@ub32.org>
Mon, 23 Jan 2023 07:34:24 +0000 (16:34 +0900)
committerSHIRAKATA Kentaro <argrath@ub32.org>
Tue, 24 Jan 2023 04:48:43 +0000 (13:48 +0900)
As time_t may not fit int, cast -1 to time_t instead.

src/hacklib.c

index 8ba5f917972b1de002e9034f03263655dcbf7818..2ad8d6c66969a4c425e1b54d2560713ab5feba10 100644 (file)
@@ -1157,7 +1157,7 @@ time_from_yyyymmddhhmmss(char *buf)
             t.tm_sec = atoi(s);
             timeresult = mktime(&t);
         }
-        if ((int) timeresult == -1)
+        if (timeresult == (time_t) -1)
             debugpline1("time_from_yyyymmddhhmmss(%s) would have returned -1",
                         buf ? buf : "");
         else