]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Portability.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 25 Feb 2010 18:13:07 +0000 (13:13 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 25 Feb 2010 18:13:07 +0000 (13:13 -0500)
SVN-Revision: 1993

CMakeLists.txt
build/cmake/config.h.in
configure.ac
libarchive/archive_windows.h
libarchive/archive_write_set_format_iso9660.c

index 78ca81efcde335ae6c24f4d1a949e1d0010dbc2e..16921adae9e45def0d6c4987160c4f8bd90a3514 100644 (file)
@@ -390,6 +390,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS)
 CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
 CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
 CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK)
+CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R)
 CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT)
 CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES)
 CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC)
@@ -423,6 +424,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB)
 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(_localtime64_s HAVE_LOCALTIME64_S)
 CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64)
 CHECK_SYMBOL_EXISTS(wmemcmp "wchar.h" HAVE_WMEMCMP)
 CHECK_SYMBOL_EXISTS(wmemcpy "wchar.h" HAVE_WMEMCPY)
index 2669616a2b6b491c9857c0557d9e8b18c0544e54..73eb9a5e86fb7021662ef450736fc8acc2a1a6dd 100644 (file)
 /* Define to 1 if you have the <locale.h> header file. */
 #cmakedefine HAVE_LOCALE_H 1
 
+/* Define to 1 if you have the `localtime_r' function. */
+#cmakedefine HAVE_LOCALTIME_R 1
+
 /* Define to 1 if the system has the type `long long int'. */
 #cmakedefine HAVE_LONG_LONG_INT 1
 
 /* Define to 1 if you have the <zlib.h> header file. */
 #cmakedefine HAVE_ZLIB_H 1
 
+/* Define to 1 if you have the `_localtime64_s' function. */
+#cmakedefine HAVE__LOCALTIME64_S 1
+
 /* Define to 1 if you have the `_mkgmtime64' function. */
 #cmakedefine HAVE__MKGMTIME64 1
 
index 925d733978d93a81b2417d2815518361d60f245a..9c4ff397d4b1eb42a39d6f8ecf263cce342964e1 100644 (file)
@@ -400,7 +400,7 @@ AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
 AC_CHECK_FUNCS([chflags chown chroot])
 AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork])
 AC_CHECK_FUNCS([fstat ftruncate futimens futimes geteuid getpid])
-AC_CHECK_FUNCS([lchflags lchmod lchown link lstat])
+AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat])
 AC_CHECK_FUNCS([lutimes mbrtowc memmove memset mkdir mkfifo mknod mkstemp])
 AC_CHECK_FUNCS([nl_langinfo pipe poll readlink])
 AC_CHECK_FUNCS([select setenv setlocale sigaction])
index bd9e2e49bc858f0fffdd715c4b24b5b1c76f947d..1c90ddcf0f812699775c94888fca0b88c3eba3f3 100644 (file)
@@ -58,7 +58,6 @@
 #include <stdint.h>
 #endif
 #include <stdio.h>
-#include <time.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <process.h>
 #define link           __la_link
 #define        lseek           __la_lseek
 #define        lstat           __la_stat
-#define        localtime_r(time, tm)   localtime_s(tm, time)
 #define        mbstowcs        __la_mbstowcs
 #define        mkdir(d,m)      __la_mkdir(d, m)
 #define        open            __la_open
index 75e25125da61fd17b68ed71f0ef54c0e43ea7f3e..06369d83605badf20fb17c56052c37d0149be1aa 100644 (file)
@@ -2571,8 +2571,14 @@ set_date_time(unsigned char *p, time_t t)
 {
        struct tm tm;
 
+#if HAVE_LOCALTIME_R
        tzset();
        localtime_r(&t, &tm);
+#elif HAVE__LOCALTIME64_S
+       _localtime64_s(&tm, &t)
+#else
+       memcpy(&tm, localtime(&t), sizeof(tm));
+#endif
        set_digit(p, 4, tm.tm_year + 1900);
        set_digit(p+4, 2, tm.tm_mon + 1);
        set_digit(p+6, 2, tm.tm_mday);
@@ -2595,8 +2601,14 @@ set_time_915(unsigned char *p, time_t t)
 {
        struct tm tm;
 
+#if HAVE_LOCALTIME_R
        tzset();
        localtime_r(&t, &tm);
+#elif HAVE__LOCALTIME64_S
+       _localtime64_s(&tm, &t)
+#else
+       memcpy(&tm, localtime(&t), sizeof(tm));
+#endif
        set_num_711(p+0, tm.tm_year);
        set_num_711(p+1, tm.tm_mon+1);
        set_num_711(p+2, tm.tm_mday);