Bug 1199615 - Fixed toolkit/mozapps/update/ compilation on mingw. r=rstrong
authorJacek Caban <jacek@codeweavers.com>
Tue, 15 Sep 2015 13:12:03 +0200
changeset 262591 fc2d9885c70827ca939fb6195083ae296e641aa0
parent 262590 9ad6f8144c5b5b6c2cee2d6b6e2563a89cb59ca4
child 262592 2c316ea16e94fe84eeb6d48f1c21e41383e02284
push id15198
push userkwierso@gmail.com
push dateWed, 16 Sep 2015 00:21:31 +0000
treeherderfx-team@dbfddd6efb5d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs1199615
milestone43.0a1
Bug 1199615 - Fixed toolkit/mozapps/update/ compilation on mingw. r=rstrong
toolkit/mozapps/update/common/updatedefines.h
toolkit/mozapps/update/tests/TestAUSHelper.cpp
--- a/toolkit/mozapps/update/common/updatedefines.h
+++ b/toolkit/mozapps/update/common/updatedefines.h
@@ -24,26 +24,32 @@
 #if defined(XP_WIN)
 # include <windows.h>
 # include <shlwapi.h>
 # include <direct.h>
 # include <io.h>
 # include <stdio.h>
 # include <stdarg.h>
 
-# define F_OK 00
-# define W_OK 02
-# define R_OK 04
+# ifndef F_OK
+#   define F_OK 00
+# endif
+# ifndef W_OK
+#   define W_OK 02
+# endif
+# ifndef R_OK
+#   define R_OK 04
+# endif
 # define S_ISDIR(s) (((s) & _S_IFMT) == _S_IFDIR)
 # define S_ISREG(s) (((s) & _S_IFMT) == _S_IFREG)
 
 # define access _access
 
 # define putenv _putenv
-# if _MSC_VER < 1900
+# if defined(_MSC_VER) && _MSC_VER < 1900
 #  define stat _stat
 # endif
 # define DELETE_DIR L"tobedeleted"
 # define CALLBACK_BACKUP_EXT L".moz-callback"
 
 # define LOG_S "%S"
 # define NS_T(str) L ## str
 # define NS_SLASH NS_T('\\')
--- a/toolkit/mozapps/update/tests/TestAUSHelper.cpp
+++ b/toolkit/mozapps/update/tests/TestAUSHelper.cpp
@@ -6,20 +6,26 @@
 # include <windows.h>
 # include <wintrust.h>
 # include <tlhelp32.h>
 # include <softpub.h>
 # include <direct.h>
 # include <io.h>
   typedef WCHAR NS_tchar;
 # define NS_main wmain
-# define F_OK 00
-# define W_OK 02
-# define R_OK 04
-# if _MSC_VER < 1900
+# ifndef F_OK
+#   define F_OK 00
+# endif
+# ifndef W_OK
+#   define W_OK 02
+# endif
+# ifndef R_OK
+#   define R_OK 04
+# endif
+# if defined(_MSC_VER) && _MSC_VER < 1900
 #  define stat _stat
 # endif
 # define NS_T(str) L ## str
 # define NS_tsnprintf(dest, count, fmt, ...) \
   { \
     int _count = count - 1; \
     _snwprintf(dest, _count, fmt, ##__VA_ARGS__); \
     dest[_count] = L'\0'; \