summaryrefslogtreecommitdiff
path: root/libarchive/archive_windows.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-11-11 09:19:55 -0500
committerBrad King <brad.king@kitware.com>2009-11-11 09:19:55 -0500
commitef5931367c0025086756eb085b0ace4912e86b51 (patch)
treee456562e4b869f948b3aac9041c4fd96564eb6c0 /libarchive/archive_windows.h
parent134d82ac29e0cc7a4f9766b2aedfa18610d15794 (diff)
downloadlibarchive-ef5931367c0025086756eb085b0ace4912e86b51.tar.gz
Do not redefine stat and file mode macros
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
Diffstat (limited to 'libarchive/archive_windows.h')
-rw-r--r--libarchive/archive_windows.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h
index e65be916..17fb6f5f 100644
--- a/libarchive/archive_windows.h
+++ b/libarchive/archive_windows.h
@@ -122,12 +122,14 @@
#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 */
@@ -154,20 +156,30 @@
#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 */
@@ -192,10 +204,12 @@
#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