]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
replace time64 functions with normal ones (#1830)
authorRosen Penev <rosenp@gmail.com>
Mon, 9 Jan 2023 14:15:55 +0000 (06:15 -0800)
committerGitHub <noreply@github.com>
Mon, 9 Jan 2023 14:15:55 +0000 (15:15 +0100)
Otherwise there are 32/64-bit pointer conversions going on. In Windows
since MSVC2005, time_t has been 64-bit. MinGW needs a hack to get 64-bit
time_t.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
20 files changed:
CMakeLists.txt
build/cmake/config.h.in
configure.ac
contrib/android/config/windows_host.h
cpio/cpio.c
cpio/test/test_option_t.c
libarchive/archive_getdate.c
libarchive/archive_read_support_format_iso9660.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_read_support_format_warc.c
libarchive/archive_read_support_format_xar.c
libarchive/archive_write_set_format_iso9660.c
libarchive/archive_write_set_format_warc.c
libarchive/archive_write_set_format_xar.c
libarchive/archive_write_set_format_zip.c
libarchive/test/test_write_format_zip_compression_store.c
libarchive/test/test_write_format_zip_file.c
libarchive/test/test_write_format_zip_file_zip64.c
tar/util.c
test_utils/test_main.c

index 1130b8c0d3c7597d8c2d059610c88ac4f6520a12..f5fb821c29a33cfc13327a8e6866e5f60d7bd033 100644 (file)
@@ -299,6 +299,7 @@ ENDIF()
 
 IF(MINGW)
   ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO)
+  ADD_DEFINITIONS(-D__MINGW_USE_VC2005_COMPAT)
 ENDIF()
 
 #
@@ -1412,12 +1413,12 @@ CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP)
 CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY)
 CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN)
 CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
-CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S)
 CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
 CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE)
-CHECK_FUNCTION_EXISTS_GLIBC(_gmtime64_s HAVE__GMTIME64_S)
-CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S)
-CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64)
+CHECK_SYMBOL_EXISTS(ctime_s "time.h" HAVE_CTIME_S)
+CHECK_SYMBOL_EXISTS(gmtime_s "time.h" HAVE_GMTIME_S)
+CHECK_SYMBOL_EXISTS(localtime_s "time.h" HAVE_LOCALTIME_S)
+CHECK_SYMBOL_EXISTS(_mkgmtime "time.h" HAVE__MKGMTIME)
 
 SET(CMAKE_REQUIRED_LIBRARIES "")
 CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)
index 5012ad2cc4a78acf2972a0c7c56ccd3d4b09ce38..c8ae4ecc4c3c31b6d6f176bc89b19db803c77ce5 100644 (file)
@@ -1212,8 +1212,8 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the <zstd.h> header file. */
 #cmakedefine HAVE_ZSTD_H 1
 
-/* Define to 1 if you have the `_ctime64_s' function. */
-#cmakedefine HAVE__CTIME64_S 1
+/* Define to 1 if you have the `ctime_s' function. */
+#cmakedefine HAVE_CTIME_S 1
 
 /* Define to 1 if you have the `_fseeki64' function. */
 #cmakedefine HAVE__FSEEKI64 1
@@ -1221,14 +1221,14 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the `_get_timezone' function. */
 #cmakedefine HAVE__GET_TIMEZONE 1
 
-/* Define to 1 if you have the `_gmtime64_s' function. */
-#cmakedefine HAVE__GMTIME64_S 1
+/* Define to 1 if you have the `gmtime_s' function. */
+#cmakedefine HAVE_GMTIME_S 1
 
-/* Define to 1 if you have the `_localtime64_s' function. */
-#cmakedefine HAVE__LOCALTIME64_S 1
+/* Define to 1 if you have the `localtime_s' function. */
+#cmakedefine HAVE_LOCALTIME_S 1
 
-/* Define to 1 if you have the `_mkgmtime64' function. */
-#cmakedefine HAVE__MKGMTIME64 1
+/* Define to 1 if you have the `_mkgmtime' function. */
+#cmakedefine HAVE__MKGMTIME 1
 
 /* Define as const if the declaration of iconv() needs const. */
 #define ICONV_CONST @ICONV_CONST@
index e2715cfdefaafe200f88dcedf56ea5119b760216..f078f2cf09ba0e58143a98b53ec1b7b25d677b21 100644 (file)
@@ -99,7 +99,7 @@ AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
 dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
 PLATFORMCPPFLAGS=
 case "$host_os" in
-  *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;;
+  *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO -D__MINGW_USE_VC2005_COMPAT ;;
 esac
 AC_SUBST(PLATFORMCPPFLAGS)
 
@@ -689,8 +689,24 @@ AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
 AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink])
 AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork])
 AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove])
-AC_CHECK_FUNCS([_ctime64_s _fseeki64])
-AC_CHECK_FUNCS([_get_timezone _gmtime64_s _localtime64_s _mkgmtime64])
+AC_CHECK_FUNCS([_fseeki64 _get_timezone])
+AC_CHECK_DECL([cmtime_s],
+               [AC_DEFINE(HAVE_CMTIME_S, 1, [cmtime_s function])],
+               [],
+               [#include <time.h>])
+AC_CHECK_DECL([gmtime_s],
+               [AC_DEFINE(HAVE_GMTIME_S, 1, [gmtime_s function])],
+               [],
+               [#include <time.h>])
+AC_CHECK_TYPE([localtime_s],
+               [AC_DEFINE(HAVE_LOCALTIME_S, 1, [localtime_s function])],
+               [],
+               [#include <time.h>])
+AC_CHECK_DECL([_mkgmtime],
+               [AC_DEFINE(HAVE__MKGMTIME, 1, [_mkgmtime function])],
+               [],
+               [#include <time.h>])
+
 # detects cygwin-1.7, as opposed to older versions
 AC_CHECK_FUNCS([cygwin_conv_path])
 
index 2d899d1e75c64007ed1d08143b84c58fb8fca732..d82ca810cc2bec245578f30023de959dcfbae3df 100644 (file)
 /* Define to 1 if you have the <zlib.h> header file. */
 /* #undef HAVE_ZLIB_H */
 
-/* Define to 1 if you have the `_ctime64_s' function. */
-#define HAVE__CTIME64_S 1
+/* Define to 1 if you have the `ctime_s' function. */
+#define HAVE_CTIME_S 1
 
 /* Define to 1 if you have the `_fseeki64' function. */
 #define HAVE__FSEEKI64 1
 /* Define to 1 if you have the `_get_timezone' function. */
 /* #undef HAVE__GET_TIMEZONE */
 
-/* Define to 1 if you have the `_localtime64_s' function. */
-#define HAVE__LOCALTIME64_S 1
+/* Define to 1 if you have the `localtime_s' function. */
+#define HAVE_LOCALTIME_S 1
 
-/* Define to 1 if you have the `_mkgmtime64' function. */
-/* #define HAVE__MKGMTIME64 1 */
+/* Define to 1 if you have the `_mkgmtime' function. */
+/* #define HAVE__MKGMTIME 1 */
 
 /* Define as const if the declaration of iconv() needs const. */
 /* #undef ICONV_CONST */
index de0144fa00d52e879955cdd3503ac61e23f6b676..f2d83d94b647245a3759ced4f8e5c71dc185777d 100644 (file)
@@ -1153,7 +1153,7 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
        time_t                   mtime;
        static time_t            now;
        struct tm               *ltime;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm               tmbuf;
 #endif
 
@@ -1203,8 +1203,8 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
        else
                fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
 #endif
-#if defined(HAVE__LOCALTIME64_S)
-       ltime = _localtime64_s(&tmbuf, &mtime) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       ltime = localtime_s(&tmbuf, &mtime) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        ltime = localtime_r(&mtime, &tmbuf);
 #else
index 52bcff5233b79c0860fa65da1e14e5921811e2fa..9eef0da571c44e9953fdb2878677368912b060e9 100644 (file)
@@ -37,7 +37,7 @@ DEFINE_TEST(test_option_t)
        char date[32];
        char date2[32];
        struct tm *tmptr;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm tmbuf;
 #endif
 
@@ -91,8 +91,8 @@ DEFINE_TEST(test_option_t)
 #ifdef HAVE_LOCALE_H
        setlocale(LC_ALL, "");
 #endif
-#if defined(HAVE__LOCALTIME64_S)
-        tmptr = _localtime64_s(&tmbuf, &mtime) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+        tmptr = localtime_s(&tmbuf, &mtime) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
         tmptr = localtime_r(&mtime, &tmbuf);
 #else
index 47dcecc146a0e4f8b50728ca98ee3ad2ccff38f5..20ab1b1588fe0f542109463ae759c999be92e33a 100644 (file)
@@ -698,7 +698,7 @@ Convert(time_t Month, time_t Day, time_t Year,
        time_t          Julian;
        int             i;
        struct tm       *ltime;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm       tmbuf;
 #endif
 
@@ -727,8 +727,8 @@ Convert(time_t Month, time_t Day, time_t Year,
        Julian *= DAY;
        Julian += Timezone;
        Julian += Hours * HOUR + Minutes * MINUTE + Seconds;
-#if defined(HAVE__LOCALTIME64_S)
-       ltime = _localtime64_s(&tmbuf, &Julian) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       ltime = localtime_s(&tmbuf, &Julian) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        ltime = localtime_r(&Julian, &tmbuf);
 #else
@@ -746,19 +746,19 @@ DSTcorrect(time_t Start, time_t Future)
        time_t          StartDay;
        time_t          FutureDay;
        struct tm       *ltime;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm       tmbuf;
 #endif
-#if defined(HAVE__LOCALTIME64_S)
-       ltime = _localtime64_s(&tmbuf, &Start) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       ltime = localtime_s(&tmbuf, &Start) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        ltime = localtime_r(&Start, &tmbuf);
 #else
        ltime = localtime(&Start);
 #endif
        StartDay = (ltime->tm_hour + 1) % 24;
-#if defined(HAVE__LOCALTIME64_S)
-       ltime = _localtime64_s(&tmbuf, &Future) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       ltime = localtime_s(&tmbuf, &Future) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        ltime = localtime_r(&Future, &tmbuf);
 #else
@@ -775,13 +775,13 @@ RelativeDate(time_t Start, time_t zone, int dstmode,
 {
        struct tm       *tm;
        time_t  t, now;
-#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
+#if defined(HAVE_GMTIME_R) || defined(HAVE_GMTIME_S)
        struct tm       tmbuf;
 #endif
 
        t = Start - zone;
-#if defined(HAVE__GMTIME64_S)
-       tm = _gmtime64_s(&tmbuf, &t) ? NULL : &tmbuf;
+#if defined(HAVE_GMTIME_S)
+       tm = gmtime_s(&tmbuf, &t) ? NULL : &tmbuf;
 #elif defined(HAVE_GMTIME_R)
        tm = gmtime_r(&t, &tmbuf);
 #else
@@ -802,14 +802,14 @@ RelativeMonth(time_t Start, time_t Timezone, time_t RelMonth)
        struct tm       *tm;
        time_t  Month;
        time_t  Year;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm       tmbuf;
 #endif
 
        if (RelMonth == 0)
                return 0;
-#if defined(HAVE__LOCALTIME64_S)
-       tm = _localtime64_s(&tmbuf, &Start) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       tm = localtime_s(&tmbuf, &Start) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        tm = localtime_r(&Start, &tmbuf);
 #else
@@ -959,8 +959,8 @@ __archive_get_date(time_t now, const char *p)
        gds = &_gds;
 
        /* Look up the current time. */
-#if defined(HAVE__LOCALTIME64_S)
-       tm = _localtime64_s(&local, &now) ? NULL : &local;
+#if defined(HAVE_LOCALTIME_S)
+       tm = localtime_s(&local, &now) ? NULL : &local;
 #elif defined(HAVE_LOCALTIME_R)
        tm = localtime_r(&now, &local);
 #else
@@ -969,14 +969,14 @@ __archive_get_date(time_t now, const char *p)
 #endif
        if (tm == NULL)
                return -1;
-#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE__LOCALTIME64_S)
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S)
        local = *tm;
 #endif
 
        /* Look up UTC if we can and use that to determine the current
         * timezone offset. */
-#if defined(HAVE__GMTIME64_S)
-       gmt_ptr = _gmtime64_s(&gmt, &now) ? NULL : &gmt;
+#if defined(HAVE_GMTIME_S)
+       gmt_ptr = gmtime_s(&gmt, &now) ? NULL : &gmt;
 #elif defined(HAVE_GMTIME_R)
        gmt_ptr = gmtime_r(&now, &gmt);
 #else
@@ -1020,8 +1020,8 @@ __archive_get_date(time_t now, const char *p)
         * time components instead of the local timezone. */
        if (gds->HaveZone && gmt_ptr != NULL) {
                now -= gds->Timezone;
-#if defined(HAVE__GMTIME64_S)
-               gmt_ptr = _gmtime64_s(&gmt, &now) ? NULL : &gmt;
+#if defined(HAVE_GMTIME_S)
+               gmt_ptr = gmtime_s(&gmt, &now) ? NULL : &gmt;
 #elif defined(HAVE_GMTIME_R)
                gmt_ptr = gmtime_r(&now, &gmt);
 #else
index 596c14ac282b90676e88252996533396822317c5..f5414be2a565db353df602100c89c632fd79e550 100644 (file)
@@ -3180,8 +3180,8 @@ isodate17(const unsigned char *v)
 static time_t
 time_from_tm(struct tm *t)
 {
-#if HAVE__MKGMTIME64
-        return (_mkgmtime64(t));
+#if HAVE__MKGMTIME
+        return _mkgmtime(t);
 #elif HAVE_TIMEGM
         /* Use platform timegm() if available. */
         return (timegm(t));
index b7adb2ba844f3f05d59511388f6420caf5ee781b..8f239da9b39d471c345e1c15fcd4ec499ff95b62 100644 (file)
@@ -1830,7 +1830,7 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
   struct tm *tm;
   time_t t;
   long nsec;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
   struct tm tmbuf;
 #endif
 
@@ -1864,8 +1864,8 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
         rem = (((unsigned)(unsigned char)*p) << 16) | (rem >> 8);
         p++;
       }
-#if defined(HAVE__LOCALTIME64_S)
-      tm = _localtime64_s(&tmbuf, &t) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+      tm = localtime_s(&tmbuf, &t) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
       tm = localtime_r(&t, &tmbuf);
 #else
index b34c7fe3f79a7ec821dbe8932d50c76d3ca24cb3..61ab29ea145dc5750ad67dd8e0b426cb3da3df39 100644 (file)
@@ -530,8 +530,8 @@ strtoi_lim(const char *str, const char **ep, int llim, int ulim)
 static time_t
 time_from_tm(struct tm *t)
 {
-#if HAVE__MKGMTIME64
-        return (_mkgmtime64(t));
+#if HAVE__MKGMTIME
+        return _mkgmtime(t);
 #elif HAVE_TIMEGM
         /* Use platform timegm() if available. */
         return (timegm(t));
index f9e2de125048db42b2f61a13e9c0e4b16ced2168..ec9cb1981f3dcf10065b853b3985d25934de91de 100644 (file)
@@ -1139,8 +1139,8 @@ atohex(unsigned char *b, size_t bsize, const char *p, size_t psize)
 static time_t
 time_from_tm(struct tm *t)
 {
-#if HAVE__MKGMTIME64
-        return (_mkgmtime64(t));
+#if HAVE__MKGMTIME
+        return _mkgmtime(t);
 #elif HAVE_TIMEGM
         /* Use platform timegm() if available. */
         return (timegm(t));
index 22e36f62b38d31a3453b5664132d997d0a0f8d78..197b0ee6d293f2a0f5fec5a59b386a7d96415f38 100644 (file)
@@ -2521,9 +2521,8 @@ get_gmoffset(struct tm *tm)
 static void
 get_tmfromtime(struct tm *tm, time_t *t)
 {
-#if HAVE__LOCALTIME64_S
-       __time64_t tmp_t = (__time64_t) *t; //time_t may be shorter than 64 bits
-       _localtime64_s(tm, &tmp_t);
+#if HAVE_LOCALTIME_S
+       localtime_s(tm, t);
 #elif HAVE_LOCALTIME_R
        tzset();
        localtime_r(t, tm);
@@ -4074,11 +4073,8 @@ write_information_block(struct archive_write *a)
        }
        memset(info.s, 0, info_size);
        opt = 0;
-#if defined(HAVE__CTIME64_S)
-       {
-               __time64_t iso9660_birth_time_tmp = (__time64_t) iso9660->birth_time; //time_t may be shorter than 64 bits
-               _ctime64_s(buf, sizeof(buf), &(iso9660_birth_time_tmp));
-       }
+#if defined(HAVE_CTIME_S)
+       ctime_s(buf, sizeof(buf), &(iso9660->birth_time));
 #elif defined(HAVE_CTIME_R)
        ctime_r(&(iso9660->birth_time), buf);
 #else
index 6f0a45d88c50969dafa84e71e1a1888b10351181..0ef003e2fc94fd511253fef7c6dfa62742903126 100644 (file)
@@ -329,14 +329,14 @@ xstrftime(struct archive_string *as, const char *fmt, time_t t)
 {
 /** like strftime(3) but for time_t objects */
        struct tm *rt;
-#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
+#if defined(HAVE_GMTIME_R) || defined(HAVE_GMTIME_S)
        struct tm timeHere;
 #endif
        char strtime[100];
        size_t len;
 
-#if defined(HAVE__GMTIME64_S)
-       rt = _gmtime64_s(&timeHere, &t) ? NULL : &timeHere;
+#if defined(HAVE_GMTIME_S)
+       rt = gmtime_s(&timeHere, &t) ? NULL : &timeHere;
 #elif defined(HAVE_GMTIME_R)
        rt = gmtime_r(&t, &timeHere);
 #else
index 9529ee9167bd6d6bbabb42eeab777f7a245d6fc3..7849062c53d7fe11345febb0138e925f9528f305 100644 (file)
@@ -907,8 +907,8 @@ xmlwrite_time(struct archive_write *a, xmlTextWriterPtr writer,
        char timestr[100];
        struct tm tm;
 
-#if defined(HAVE__GMTIME64_S)
-       _gmtime64_s(&tm, &t);
+#if defined(HAVE_GMTIME_S)
+       gmtime_s(&tm, &t);
 #elif defined(HAVE_GMTIME_R)
        gmtime_r(&t, &tm);
 #else
index 86fa4858d323cd414f5b619d09ef548022f90218..6821049c945a5ea30975619ba3899f1f0a32c81f 100644 (file)
@@ -1382,12 +1382,12 @@ dos_time(const time_t unix_time)
 {
        struct tm *t;
        unsigned int dt;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm tmbuf;
 #endif
 
-#if defined(HAVE__LOCALTIME64_S)
-       t = _localtime64_s(&tmbuf, &unix_time) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       t = localtime_s(&tmbuf, &unix_time) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        t = localtime_r(&unix_time, &tmbuf);
 #else
index 4d086edf5c8bb3763bebb87572959fa788eb17e2..b52d170ccea02091e7ebe79162b8ec9ee7a723aa 100644 (file)
@@ -129,15 +129,15 @@ static void verify_uncompressed_contents(const char *buff, size_t used)
        /* Misc variables */
        unsigned long crc;
        struct tm *tm;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm tmbuf;
 #endif
        /* p is the pointer to walk over the central directory,
         * q walks over the local headers, the data and the data descriptors. */
        const char *p, *q, *local_header, *extra_start;
 
-#if defined(HAVE__LOCALTIME64_S)
-       tm = _localtime64_s(&tmbuf, &now) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       tm = localtime_s(&tmbuf, &now) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        tm = localtime_r(&now, &tmbuf);
 #else
index afd0eb6e96f19f5fd48e369d5b2590b817229d3e..4ccc30360691e77fcc9880099081e614e19d4312 100644 (file)
@@ -74,7 +74,7 @@ DEFINE_TEST(test_write_format_zip_file)
        struct archive_entry *ae;
        time_t t = 1234567890;
        struct tm *tm;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm tmbuf;
 #endif
        size_t used, buffsize = 1000000;
@@ -94,8 +94,8 @@ DEFINE_TEST(test_write_format_zip_file)
        zip_compression = 0;
 #endif
 
-#if defined(HAVE__LOCALTIME64_S)
-       tm = _localtime64_s(&tmbuf, &t) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       tm = localtime_s(&tmbuf, &t) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        tm = localtime_r(&t, &tmbuf);
 #else
index 8a506226b8541690763981b56af303527637933d..6a00fe14c38937c4296d5710e8f56d2eb24ac507 100644 (file)
@@ -76,7 +76,7 @@ DEFINE_TEST(test_write_format_zip_file_zip64)
        struct archive_entry *ae;
        time_t t = 1234567890;
        struct tm *tm;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm tmbuf;
 #endif
        size_t used, buffsize = 1000000;
@@ -95,8 +95,8 @@ DEFINE_TEST(test_write_format_zip_file_zip64)
        zip_compression = 0;
 #endif
 
-#if defined(HAVE__LOCALTIME64_S)
-       tm = _localtime64_s(&tmbuf, &t) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       tm = localtime_s(&tmbuf, &t) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        tm = localtime_r(&t, &tmbuf);
 #else
index 9664c16b4a86605079f972f623b8b513b99d604e..403d7ff35c50ca383ae3eb8877007b1dd5210f26 100644 (file)
@@ -668,7 +668,7 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
        time_t                   tim;
        static time_t            now;
        struct tm               *ltime;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm               tmbuf;
 #endif
 
@@ -742,8 +742,8 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
                fmt = bsdtar->day_first ? DAY_FMT " %b  %Y" : "%b " DAY_FMT "  %Y";
        else
                fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M";
-#if defined(HAVE__LOCALTIME64_S)
-       ltime = _localtime64_s(&tmbuf, &tim) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+       ltime = localtime_s(&tmbuf, &tim) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
        ltime = localtime_r(&tim, &tmbuf);
 #else
index 81b5002f3bcc1b0d87b9e9c63b8126daa9735e6f..3250423a14c27a9d53cc46752e91b50d4a7552c8 100644 (file)
@@ -3868,7 +3868,7 @@ main(int argc, char **argv)
 #endif
        time_t now;
        struct tm *tmptr;
-#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
        struct tm tmbuf;
 #endif
        char *refdir_alloc = NULL;
@@ -4105,8 +4105,8 @@ main(int argc, char **argv)
         */
        now = time(NULL);
        for (i = 0; ; i++) {
-#if defined(HAVE__LOCALTIME64_S)
-               tmptr = _localtime64_s(&tmbuf, &now) ? NULL : &tmbuf;
+#if defined(HAVE_LOCALTIME_S)
+               tmptr = localtime_s(&tmbuf, &now) ? NULL : &tmbuf;
 #elif defined(HAVE_LOCALTIME_R)
                tmptr = localtime_r(&now, &tmbuf);
 #else