[Box Backup-commit] COMMIT r3639 - box/trunk/lib/win32

subversion at boxbackup.org subversion at boxbackup.org
Sat Aug 29 10:56:48 BST 2015


Author: chris
Date: 2015-08-29 09:56:48 +0000 (Sat, 29 Aug 2015)
New Revision: 3639

Modified:
   box/trunk/lib/win32/emu.h
Log:
Fix warnings when compiling with MinGW64 headers.

These headers define things that aren't defined by MinGW32 or MSVC, so make
the definitions in emu.h conditional (feature detection).


Modified: box/trunk/lib/win32/emu.h
===================================================================
--- box/trunk/lib/win32/emu.h	2015-08-29 08:47:09 UTC (rev 3638)
+++ box/trunk/lib/win32/emu.h	2015-08-29 09:56:48 UTC (rev 3639)
@@ -115,21 +115,29 @@
 	return &gTempPasswd;
 }
 
-#define S_IRWXG 1
-#define S_IRWXO 2
+#ifndef S_IRGRP
+	// these constants are only defined in MinGW64, not the original MinGW headers,
+	// nor MSVC, so use poor man's feature detection to define them only if needed.
+	//not sure if these are correct
+	//S_IWRITE -   writing permitted
+	//_S_IREAD -   reading permitted
+	//_S_IREAD | _S_IWRITE - 
+#	define S_IRUSR S_IWRITE
+#	define S_IWUSR S_IREAD
+#	define S_IRGRP S_IWRITE
+#	define S_IWGRP S_IREAD
+#	define S_IROTH S_IWRITE | S_IREAD
+#	define S_IWOTH S_IREAD | S_IREAD
+#	define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC)
+#	define S_IRWXG 1
+#	define S_IRWXO 2
+#endif
+
 #define S_ISUID 4
 #define S_ISGID 8
 #define S_ISVTX 16
 
 #ifndef __MINGW32__
-	//not sure if these are correct
-	//S_IWRITE -   writing permitted
-	//_S_IREAD -   reading permitted
-	//_S_IREAD | _S_IWRITE - 
-	#define S_IRUSR S_IWRITE
-	#define S_IWUSR S_IREAD
-	#define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC)
-
 	#define S_ISREG(x) (S_IFREG & x)
 	#define S_ISDIR(x) (S_IFDIR & x)
 #endif
@@ -200,11 +208,6 @@
 	typedef int socklen_t;
 #endif
 
-#define S_IRGRP S_IWRITE
-#define S_IWGRP S_IREAD
-#define S_IROTH S_IWRITE | S_IREAD
-#define S_IWOTH S_IREAD | S_IREAD
-
 //again need to verify these
 #define S_IFLNK 1
 #define S_IFSOCK 0




More information about the Boxbackup-commit mailing list