]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Updates to the Windows support files.
authorTim Kientzle <kientzle@gmail.com>
Thu, 11 Sep 2008 22:20:22 +0000 (18:20 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 11 Sep 2008 22:20:22 +0000 (18:20 -0400)
Submitted by: Ivailo Petrov

SVN-Revision: 199

libarchive/archive_windows.h
libarchive/config_windows.h

index 9bc21e4de8fd01cde83c17ed3e0e59d9b46ef1f6..1b63992ed07a5ab58590487be44884a52799ba09 100644 (file)
 #include <errno.h>
 #define set_errno(val) ((errno)=val)
 #include <io.h>
+#include <stdlib.h>   //brings in NULL
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <process.h>
 #include <direct.h>
 
-#define        EFTYPE 7
-#define        STDIN_FILENO 0
-#define        STDOUT_FILENO 1
-#define        STDERR_FILENO 2
+//#define      EFTYPE 7
 
+#if !defined(STDIN_FILENO)
+#define STDIN_FILENO 0
+#endif
+
+#if !defined(STDOUT_FILENO)
+#define STDOUT_FILENO 1
+#endif
+
+#if !defined(STDERR_FILENO)
+#define STDERR_FILENO 2
+#endif
+
+
+#if defined(_MSC_VER)
 /* TODO: Fix the code, don't suppress the warnings. */
 #pragma warning(disable:4244)   /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */
 #pragma warning(disable:4146)   /* unary minus operator applied to unsigned type, result still unsigned */
-#pragma warning(disable:4996)  /* 'function': was declared deprecated */
-#pragma warning(disable:4267)   /* Conversion, possible loss of data */
-
-/* Basic definitions for system and integer types. */
-#ifndef _SSIZE_T_
-# define SSIZE_MAX LONG_MAX
-#define _SSIZE_T_
-#endif /* _SSIZE_T_ */
+//#pragma warning(disable:4996)        /* 'function': was declared deprecated */
+//#pragma warning(disable:4267)   /* Conversion, possible loss of data */
+#endif
 
 #ifndef NULL
 #ifdef  __cplusplus
 #define        minor(x) ((int)(0xffff00ff & (x)))
 #define        makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min)))
 
-#define        EFTYPE 7
-#ifndef STDERR_FILENO
-#define        STDERR_FILENO 2
-#endif /* STDERR_FILENO  */
-
 /* Alias the Windows _function to the POSIX equivalent. */
 #define        chdir           _chdir
 #define        chmod           _chmod
 #define        close           _close
-#define        fileno          _fileno
+//#define      fileno          _fileno
 #define        fstat           _fstat
 #define        lseek           _lseek
-#define        open                    _open
-#define        stat                    _stat
+#define lstat          _stat
+#define        open            _open
+#define        stat            _stat
 #define        mkdir(d,m)      _mkdir(d)
 #define        mktemp          _mktemp
-#define        read                    _read
+#define        read            _read
 #define        rmdir           _rmdir
 #define        strdup          _strdup
 #define        tzset           _tzset
 #define        O_CREAT         _O_CREAT
 #define        O_EXCL          _O_EXCL
 
-#define        S_ISUID 0004000
-#define        S_ISGID 0002000
-#define        S_ISVTX 0001000
+#ifndef _S_IFIFO
+  #define _S_IFIFO        0010000   /* pipe */
+#endif
+#ifndef _S_IFCHR
+  #define _S_IFCHR        0020000   /* character special */
+#endif
+#ifndef _S_IFDIR
+  #define _S_IFDIR        0040000   /* directory */
+#endif
+#ifndef _S_IFBLK
+  #define _S_IFBLK        0060000   /* block special */
+#endif
+#ifndef _S_IFLNK
+  #define _S_IFLNK        0120000   /* symbolic link */
+#endif
+#ifndef _S_IFSOCK
+  #define _S_IFSOCK       0140000   /* socket */
+#endif
+#ifndef        _S_IFREG
+  #define _S_IFREG        0100000   /* regular */
+#endif
+#ifndef        _S_IFMT
+  #define _S_IFMT         0170000   /* file type mask */
+#endif
+
+#define S_IFIFO     _S_IFIFO
+//#define S_IFCHR  _S_IFCHR
+//#define S_IFDIR  _S_IFDIR
+#define S_IFBLK     _S_IFBLK
+#define S_IFLNK     _S_IFLNK
+#define S_IFSOCK    _S_IFSOCK
+//#define S_IFREG  _S_IFREG
+//#define S_IFMT   _S_IFMT
+
+#define        S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)     /* block special */
+#define        S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)     /* fifo or socket */
+#define        S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)     /* char special */
+#define        S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)     /* directory */
+#define        S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)     /* regular file */
+#define S_ISLNK(m)  (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */
+
+#define  _S_ISUID        0004000   /* set user id on execution */
+#define  _S_ISGID        0002000   /* set group id on execution */
+#define  _S_ISVTX        0001000   /* save swapped text even after use */
+
+#define   S_ISUID        _S_ISUID
+#define   S_ISGID        _S_ISGID
+#define   S_ISVTX        _S_ISVTX
+
+#define         _S_IRWXU            (_S_IREAD | _S_IWRITE | _S_IEXEC)
+#define  _S_IXUSR           _S_IEXEC  /* read permission, user */
+#define         _S_IWUSR            _S_IWRITE /* write permission, user */
+#define         _S_IRUSR            _S_IREAD  /* execute/search permission, user */
+#define  _S_IRWXG        (_S_IRWXU >> 3)
+#define  _S_IXGRP        (_S_IXUSR >> 3) /* read permission, group */
+#define  _S_IWGRP        (_S_IWUSR >> 3) /* write permission, group */
+#define  _S_IRGRP        (_S_IRUSR >> 3) /* execute/search permission, group */
+#define  _S_IRWXO        (_S_IRWXG >> 3) 
+#define  _S_IXOTH        (_S_IXGRP >> 3) /* read permission, other */
+#define  _S_IWOTH        (_S_IWGRP >> 3) /* write permission, other */
+#define  _S_IROTH        (_S_IRGRP  >> 3) /* execute/search permission, other */
+
+#define          S_IRWXU            _S_IRWXU
+#define   S_IXUSR           _S_IXUSR
+#define          S_IWUSR            _S_IWUSR
+#define          S_IRUSR            _S_IRUSR
+#define   S_IRWXG        _S_IRWXG
+#define   S_IXGRP        _S_IXGRP
+#define   S_IWGRP        _S_IWGRP
+#define   S_IRGRP        _S_IRGRP
+#define   S_IRWXO        _S_IRWXO
+#define   S_IXOTH        _S_IXOTH
+#define   S_IWOTH        _S_IWOTH
+#define   S_IROTH        _S_IROTH
+
+#define        F_DUPFD         0       /* Duplicate file descriptor.  */
+#define        F_GETFD         1       /* Get file descriptor flags.  */
+#define        F_SETFD         2       /* Set file descriptor flags.  */
+#define        F_GETFL         3       /* Get file status flags.  */
+#define        F_SETFL         4       /* Set file status flags.  */
+#define        F_GETOWN                5       /* Get owner (receiver of SIGIO).  */
+#define        F_SETOWN                6       /* Set owner (receiver of SIGIO).  */
+#define        F_GETLK         7       /* Get record locking info.  */
+#define        F_SETLK         8       /* Set record locking info (non-blocking).  */
+#define        F_SETLKW                9       /* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64      7       /* Get record locking info.  */
+#define F_SETLK64      8       /* Set record locking info (non-blocking).  */
+#define F_SETLKW64     9       /* Set record locking info (blocking).  */
+
+/* File descriptor flags used with F_GETFD and F_SETFD.  */
+#define        FD_CLOEXEC      1       /* Close on exec.  */
+
+//NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else...
+#define O_NONBLOCK 0x0004 /* Non-blocking I/O.  */
+//#define O_NDELAY   O_NONBLOCK
+
+/* Symbolic constants for the access() function */
+#if !defined(F_OK)
+    #define R_OK    4       /*  Test for read permission    */
+    #define W_OK    2       /*  Test for write permission   */
+    #define X_OK    1       /*  Test for execute permission */
+    #define F_OK    0       /*  Test for existence of file  */
+#endif
 
-#define        S_IFMT  0170000
-#define        S_IFDIR _S_IFDIR
-#define        S_IFREG _S_IFREG
 
-#define        S_ISDIR(m)      (((m) & 0170000) == _S_IFDIR)   /* directory */
-#define        S_ISCHR(m)      (((m) & 0170000) == _S_IFCHR)   /* char special */
-#define        S_ISREG(m)      (((m) & 0170000) == _S_IFREG)   /* regular file */
+#ifdef _LARGEFILE_SOURCE
+# define __USE_LARGEFILE 1             /* declare fseeko and ftello */
+#endif
 
-/* Windows doesn't have the following, so they're trivial. */
-#define        S_ISBLK(m)      (0)     /* block special */
-#define        S_ISFIFO(m)     (0)     /* fifo or socket */
-#define        S_ISLNK(m)    (0)       /* Symbolic link */
-#define        S_ISSOCK(m)   (0)       /* Socket */
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# define __USE_FILE_OFFSET64  1        /* replace 32-bit functions by 64-bit ones */
+#endif
 
+#if __USE_LARGEFILE && __USE_FILE_OFFSET64
 /* replace stat and seek by their large-file equivalents */
 #undef stat
 #define   stat         _stati64
 # define ftello     ftello64
 # define ftell64    ftello64
 #endif /* __MINGW32__ */
+#endif /* LARGE_FILES */
 
 /* End of Win32 definitions. */
 
index 4144f8120f5540117a67cb437fd8f9a549cb18f3..062f249f29b5c8ea0a297d5d71f3983812c1b534 100644 (file)
   #elif defined( __WATCOMC__ ) || defined(__WATCOMCPP__) /* Watcom compilers */
     #define IS_WATCOM  1
     /* Define to 1 if __INT64 is defined */
-    #define HAVE___INT64  1
-
-    /* Define to 1 if UID should be unsigned */
-    #define USE_UNSIGNED_UID 1
-
-    /* Define to 1 if UID should be unsigned */
-    #define USE_UNSIGNED_GID 1
-
   #elif defined(__IBMC__) || defined(__IBMCPP__) /* IBM compilers */
   #elif defined( __SC__ ) /* Symantec C++ compilers */
   #elif defined( M_I86 ) && defined( MSDOS ) /* Microsoft DOS/Win 16 compilers */
   #elif defined( _M_IX86 ) || defined( _68K_ ) /* Microsoft Win32 compilers */
     #define IS_VISUALC 1
     /* Define to 1 if __INT64 is defined */
-    #define HAVE___INT64  1
   #else
   #endif
 
+  /* Define to 1 if UID should be unsigned */
+  #define USE_UNSIGNED_UID 1
+
+  /* Define to 1 if UID should be unsigned */
+  #define USE_UNSIGNED_GID 1
 #endif
 ///////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////
 
 /* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
    don't. */
+#if defined(_MSC_VER) 
 /* #undef HAVE_DECL_INT64_MAX */
+#else
+#define HAVE_DECL_INT64_MAX 1
+#endif
 
 /* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
    don't. */
+#if defined(_MSC_VER) 
 /* #undef HAVE_DECL_INT64_MIN */
+#else
+#define HAVE_DECL_INT64_MIN 1
+#endif
 
 /* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
    */
 
 /* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
    don't. */
-/* #undef HAVE_DECL_SIZE_MAX */
-
-#if defined(_MSC_VER) && _MSC_VER >= 1400
+#if defined(_MSC_VER) 
+       #if _MSC_VER >= 1400
+       #define HAVE_DECL_SIZE_MAX 1
+       #else
+       /* #undef HAVE_DECL_SIZE_MAX */
+       #endif
+#else
 #define HAVE_DECL_SIZE_MAX 1
 #endif
 
+/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_SSIZE_MAX */
+
 /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
    don't. */
 /* #undef HAVE_DECL_STRERROR_R */
 
 /* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
    don't. */
+#if defined(_MSC_VER) 
 /* #undef HAVE_DECL_UINT32_MAX */
+#else
+#define HAVE_DECL_UINT32_MAX 1
+#endif
 
 /* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
    don't. */
+#if defined(_MSC_VER) 
 /* #undef HAVE_DECL_UINT64_MAX */
+#else
+#define HAVE_DECL_UINT64_MAX 1
+#endif
 
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 /* #undef HAVE_D_MD_ORDER */
 
 /* A possible errno value for invalid file format errors */
-#if ((IS_WATCOM) || (IS_VISUALC))
-#define HAVE_EFTYPE 0
-#else
-#define HAVE_EFTYPE 1
-#endif
+/* #undef HAVE_EFTYPE */
 
 /* A possible errno value for invalid file format errors */
 #define HAVE_EILSEQ 1
 /* #undef HAVE_FCHOWN */
 
 /* Define to 1 if you have the <fcntl.h> header file. */
-/* #undef HAVE_FCNTL_H 1 */
+#define HAVE_FCNTL_H 1
 
 /* Define to 1 if you have the fcntl() function. */
 /* #undef HAVE_FCNTL_FN */
 #define HAVE_STDARG_H 1
 
 /* Define to 1 if you have the <stdint.h> header file. */
+#if defined(_MSC_VER)
 /* #undef HAVE_STDINT_H */
+#else
+#define HAVE_STDINT_H 1
+#endif
 
 /* Define to 1 if you have the <stdlib.h> header file. */
 #define HAVE_STDLIB_H 1
 #define HAVE_SYS_STAT_H 1
 
 /* Define to 1 if you have the <sys/time.h> header file. */
+#if defined(_MSC_VER)
 /* #undef HAVE_SYS_TIME_H */
+#else
+#define HAVE_SYS_TIME_H 1
+#endif
 
 /* Define to 1 if you have the <sys/types.h> header file. */
 #define HAVE_SYS_TYPES_H 1
 #define HAVE_TIME_H 1
 
 /* Define to 1 if the system has the type `uintmax_t'. */
+#if defined(_MSC_VER)
 /* #undef HAVE_UINTMAX_T */
+#else
+#define HAVE_UINTMAX_T 1
+#endif
 
 /* Define to 1 if you have the <unistd.h> header file. */
+#if defined(_MSC_VER)
 /* #undef HAVE_UNISTD_H */
+#else
+#define HAVE_UNISTD_H 1
+#endif
 
 /* Define to 1 if the system has the type `unsigned long long'. */
 #define HAVE_UNSIGNED_LONG_LONG 1
 /* #undef HAVE_WMEMCPY */
 
 /* Define to 1 if you have the <zlib.h> header file. */
-#define HAVE_ZLIB_H 1
+/* #undef HAVE_ZLIB_H */
 
 /* Version number of libarchive as a single integer */
-#define LIBARCHIVE_VERSION_NUMBER "2005000"
+#define LIBARCHIVE_VERSION_NUMBER "2005005"
 
 /* Version number of libarchive */
-#define LIBARCHIVE_VERSION_STRING "2.5.0b"
+#define LIBARCHIVE_VERSION_STRING "2.5.5"
 
 /* Define to 1 if `lstat' dereferences a symlink specified with a trailing
    slash. */
 #define PACKAGE_NAME "libarchive"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libarchive 2.4.12"
+#define PACKAGE_STRING "libarchive 2.5.5"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libarchive"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "2.4.12"
+#define PACKAGE_VERSION "2.5.5"
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
 #define TIME_WITH_SYS_TIME 1
 
 /* Version number of package */
-#define VERSION "2.4.12"
+#define VERSION "2.5.5"
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
 
 /* Define to the type of a signed integer type of width exactly 64 bits if
    such a type exists and the standard includes do not define it. */
-#if (HAVE___INT64)
-typedef __int64 int64_t;
-#else
+#if defined(_MSC_VER)
 #define int64_t long long
+#else
+/* #undef int64_t */
 #endif
 
 /* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
    not define. */
-#if (HAVE___INT64)
-typedef __int64 intmax_t;
-#else
+#if defined(_MSC_VER)
 #define intmax_t long long
+#else
+/* #undef intmax_t */
 #endif
 
 /* Define to `int' if <sys/types.h> does not define. */
+#if defined(_MSC_VER)
 #define mode_t unsigned short
+#else
+/* #undef mode_t */
+#endif
 
 /* Define to `long long' if <sys/types.h> does not define. */
 /* #undef off_t */
@@ -535,148 +571,36 @@ typedef __int64 intmax_t;
 
 /* Define to the type of an unsigned integer type of width exactly 64 bits if
    such a type exists and the standard includes do not define it. */
-#if (HAVE___INT64)
-typedef unsigned __int64 uint64_t;
-#else
+#if defined(_MSC_VER)
 #define uint64_t unsigned long long
+#else
+/* #undef uint64_t */
 #endif
 
 /* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
    do not define. */
-#if (HAVE___INT64)
-typedef unsigned __int64 uintmax_t;
-#else
+#if defined(_MSC_VER)
 #define uintmax_t unsigned long long
+#else
+/* #undef uintmax_t */
 #endif
 
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 /* #undef uintptr_t */
 
 /* Define to `unsigned int' if <sys/types.h> does not define. */
+#if defined(_MSC_VER)
 #define pid_t unsigned int
+#else
+/* #undef pid_t */
+#endif
 
+#if defined(_MSC_VER)
 #define uint32_t unsigned long
 #define uint16_t unsigned short
 #define ssize_t long
-
-
-///////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-#if (IS_VISUALC)
-  #include <io.h>
-  #include <stdlib.h>   //brings in NULL
-  #include <sys/stat.h> //brings in S_IFMT(), etc...
-
-  #define HAVE_UINTPTR  0
-
-  #if !defined(STDIN_FILENO)
-    #define STDIN_FILENO 0
-  #endif
-
-  #if !defined(STDOUT_FILENO)
-    #define STDOUT_FILENO 1
-  #endif
-
-  #if !defined(STDERR_FILENO)
-    #define STDERR_FILENO 2
-  #endif
-
-  /* Define to 1 if ino_t is defined (possibly in sys/types.h) */
-  #define HAVE_INO_T  1
-
-  #define S_IFFIFO         _S_IFIFO
-
-  #define S_ISBLK( m )     0
-  #define S_ISFIFO( m )    (((m) & S_IFMT) == S_IFFIFO)
-  #define S_ISCHR( m )     (((m) & S_IFMT) == S_IFCHR)
-  #define S_ISDIR( m )     (((m) & S_IFMT) == S_IFDIR)
-  #define S_ISREG( m )     (((m) & S_IFMT) == S_IFREG)
-  #define S_ISUID  0004000
-  #define S_ISGID  0002000
-  #define S_ISVTX  0001000
-
-  //NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else...
-  #define O_NONBLOCK 0x0004 /* Non-blocking I/O.  */
-  //#define O_NDELAY   O_NONBLOCK
-
-  #define lstat  _stat
-
-  /* Symbolic constants for the access() function */
-  #if !defined(F_OK)
-    #define R_OK    4       /*  Test for read permission    */
-    #define W_OK    2       /*  Test for write permission   */
-    #define X_OK    1       /*  Test for execute permission */
-    #define F_OK    0       /*  Test for existence of file  */
-  #endif
-
 #endif
 
-//////////////////////////////////////////////////////////////////////////
-#if (IS_WATCOM)
-  #include <io.h>  //brings in STDERR/OUT/IN_FILENO, dup(), dup2(), close(), write(), etc...
-  #include <process.h>  //brings in execlp() and _exit()
-  #include <stdlib.h>   //brings in NULL
-  #include <sys/stat.h>
-
-  /* Define to 1 if ino_t is defined (possibly in sys/types.h) */
-  #define HAVE_INO_T  1
-
-  //NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else...
-  #define O_NONBLOCK 0x0004 /* Non-blocking I/O.  */
-  //#define O_NDELAY   O_NONBLOCK
-
-  //Prototypes for functions which we'll define in archive_windows.c
-  extern unsigned int sleep (unsigned int seconds);
-
-  #define lstat  _stat
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
-#if !(HAVE_UINTPTR)
-  typedef unsigned int *uintptr_t;
-  #if defined(HAVE_UINTPTR)
-    #undef  HAVE_UINTPTR
-  #endif
-  #define HAVE_UINTPTR 1
-#endif
-
-#if !defined(SSIZE_MAX)
-  //#define _POSIX_SSIZE_MAX    32767
-  #if defined(_POSIX_SSIZE_MAX)
-    #define SSIZE_MAX   _POSIX_SSIZE_MAX
-  #else
-    #define SSIZE_MAX   ((ssize_t)((size_t)-1 >> 1))
-  #endif
-#endif
-
-#if !(HAVE_FCNTL_FN)
-  #define F_SETFL   4 /* Set file status flags.  */
-
-  #if defined(HAVE_FCNTL_FN)
-    #undef HAVE_FCNTL_FN
-  #endif
-  #define HAVE_FCNTL_FN 1
-#endif
-
-  #define  _S_IFLNK        0xA000    /* symbolic link */
-  #if !defined(_S_IFMT)
-    #define _S_IFMT  S_IFMT
-  #endif
-
-  #define  _S_ISLNK(m)     (((m) & _S_IFMT) == _S_IFLNK)
-  #define   S_ISLNK(m)    _S_ISLNK(m)
-
-
-/* Replacement for major/minor/makedev. */
-#if !(MAJOR_IN_MKDEV) && !(MAJOR_IN_SYSMACROS)
-  #define major(x) ((int)(0x00ff & ((x) >> 8)))
-  #define minor(x) ((int)(0xffff00ff & (x)))
-  #define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min)))
-#endif
-
-#define set_errno(val) ((errno)=val)
-
+#include "archive_windows.h"
 
 #endif /* CONFIG_H_INCLUDED */