]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Do not redefine stat and file mode macros
authorBrad King <brad.king@kitware.com>
Wed, 11 Nov 2009 14:19:55 +0000 (09:19 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 11 Nov 2009 14:19:55 +0000 (09:19 -0500)
Some windows compilers define macros like O_RDONLY and S_ISBLK with
leading underscores (e.g. _O_RDONLY and _S_ISBLK).  In our windows
compatibility header "archive_windows.h" we define the non-prefixed
names so that the rest of our code can use them everywhere.  However,
some windows compilers also define the non-prefixed names.  On these
compilers we should not redefine them.

SVN-Revision: 1638

libarchive/archive_windows.h

index e65be916c0916746ad341a3688a6b8c025e8df57..17fb6f5f48d090889cbc7f73d9463583f0f8b308 100644 (file)
 #define        waitpid         __la_waitpid
 #define        write           __la_write
 
+#ifndef O_RDONLY
 #define        O_RDONLY        _O_RDONLY
 #define        O_WRONLY        _O_WRONLY
 #define        O_TRUNC         _O_TRUNC
 #define        O_CREAT         _O_CREAT
 #define        O_EXCL          _O_EXCL
 #define        O_BINARY        _O_BINARY
+#endif
 
 #ifndef _S_IFIFO
   #define      _S_IFIFO        0010000   /* pipe */
   #define      _S_IFMT         0170000   /* file type mask */
 #endif
 
+#ifndef S_IFIFO
 #define        S_IFIFO     _S_IFIFO
+#endif
 //#define      S_IFCHR  _S_IFCHR
 //#define      S_IFDIR  _S_IFDIR
+#ifndef S_IFBLK
 #define        S_IFBLK     _S_IFBLK
+#endif
+#ifndef S_IFLNK
 #define        S_IFLNK     _S_IFLNK
+#endif
+#ifndef S_IFSOCK
 #define        S_IFSOCK    _S_IFSOCK
+#endif
 //#define      S_IFREG  _S_IFREG
 //#define      S_IFMT   _S_IFMT
 
+#ifndef S_ISBLK
 #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 */
+#endif
 #define        S_ISLNK(m)  (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */
 #define        S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */
 
 #define        _S_IWOTH        (_S_IWGRP >> 3) /* write permission, other */
 #define        _S_IROTH        (_S_IRGRP  >> 3) /* execute/search permission, other */
 
+#ifndef S_IRWXU
 #define        S_IRWXU      _S_IRWXU
 #define        S_IXUSR      _S_IXUSR
 #define        S_IWUSR      _S_IWUSR
 #define        S_IRUSR      _S_IRUSR
+#endif
 #define        S_IRWXG        _S_IRWXG
 #define        S_IXGRP        _S_IXGRP
 #define        S_IWGRP        _S_IWGRP