IF(MINGW)
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO)
+ ADD_DEFINITIONS(-D__MINGW_USE_VC2005_COMPAT)
ENDIF()
#
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)
/* 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
/* 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@
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)
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])
/* 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 */
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
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
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
#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
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
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
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
{
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
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
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
#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
* 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
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));
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
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
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));
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));
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);
}
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
{
/** 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
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
{
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
/* 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
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;
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
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;
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
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
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
#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;
*/
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