Bug 1119072, Part 11: Do not conflate struct _stat with struct stat in MSVC 2015, r=rstrong

--HG--
extra : rebase_source : e7286c7e2de4a8500de19800e1b564348f4b0cce
This commit is contained in:
Brian Smith 2015-01-12 20:04:46 -08:00
Родитель dc162e25f3
Коммит 57309dc719
3 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -38,7 +38,9 @@
# define access _access
# define putenv _putenv
# if _MSC_VER < 1900
# define stat _stat
# endif
# define DELETE_DIR L"tobedeleted"
# define CALLBACK_BACKUP_EXT L".moz-callback"
@ -87,6 +89,7 @@ static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt, ...)
# define NS_trmdir _wrmdir
# define NS_tstat _wstat
# define NS_tlstat _wstat // No symlinks on Windows
# define NS_tstat_t _stat
# define NS_tstrcat wcscat
# define NS_tstrcmp wcscmp
# define NS_tstricmp wcsicmp
@ -130,6 +133,7 @@ static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt, ...)
# define NS_trename rename
# define NS_trmdir rmdir
# define NS_tstat stat
# define NS_tstat_t stat
# define NS_tlstat lstat
# define NS_tstrcat strcat
# define NS_tstrcmp strcmp

Просмотреть файл

@ -14,7 +14,9 @@
# define F_OK 00
# define W_OK 02
# define R_OK 04
# if _MSC_VER < 1900
# define stat _stat
# endif
# define NS_T(str) L ## str
# define NS_tsnprintf(dest, count, fmt, ...) \
{ \

Просмотреть файл

@ -473,7 +473,7 @@ static int ensure_remove_recursive(const NS_tchar *path)
{
// We use lstat rather than stat here so that we can successfully remove
// symlinks.
struct stat sInfo;
struct NS_tstat_t sInfo;
int rv = NS_tlstat(path, &sInfo);
if (rv) {
// This error is benign
@ -555,7 +555,7 @@ static FILE* ensure_open(const NS_tchar *path, const NS_tchar *flags, unsigned i
}
return nullptr;
}
struct stat ss;
struct NS_tstat_t ss;
if (NS_tstat(path, &ss) != 0 || ss.st_mode != options) {
if (f != nullptr) {
fclose(f);
@ -644,7 +644,7 @@ static int ensure_copy(const NS_tchar *path, const NS_tchar *dest)
}
return 0;
#else
struct stat ss;
struct NS_tstat_t ss;
int rv = NS_tlstat(path, &ss);
if (rv) {
LOG(("ensure_copy: failed to read file status info: " LOG_S ", err: %d",
@ -743,7 +743,7 @@ template <unsigned N>
static int ensure_copy_recursive(const NS_tchar *path, const NS_tchar *dest,
copy_recursive_skiplist<N>& skiplist)
{
struct stat sInfo;
struct NS_tstat_t sInfo;
int rv = NS_tlstat(path, &sInfo);
if (rv) {
LOG(("ensure_copy_recursive: path doesn't exist: " LOG_S ", rv: %d, err: %d",
@ -809,7 +809,7 @@ static int rename_file(const NS_tchar *spath, const NS_tchar *dpath,
if (rv)
return rv;
struct stat spathInfo;
struct NS_tstat_t spathInfo;
rv = NS_tstat(spath, &spathInfo);
if (rv) {
LOG(("rename_file: failed to read file status info: " LOG_S ", " \
@ -998,7 +998,7 @@ RemoveFile::Prepare()
LOG(("PREPARE REMOVEFILE " LOG_S, mFile));
// Make sure that we're actually a file...
struct stat fileInfo;
struct NS_tstat_t fileInfo;
rv = NS_tstat(mFile, &fileInfo);
if (rv) {
LOG(("failed to read file status info: " LOG_S ", err: %d", mFile,
@ -1107,7 +1107,7 @@ RemoveDir::Prepare()
LOG(("PREPARE REMOVEDIR " LOG_S "/", mDir));
// Make sure that we're actually a dir.
struct stat dirInfo;
struct NS_tstat_t dirInfo;
rv = NS_tstat(mDir, &dirInfo);
if (rv) {
LOG(("failed to read directory status info: " LOG_S ", err: %d", mDir,
@ -1440,7 +1440,7 @@ PatchFile::Execute()
// Rename the destination file if it exists before proceeding so it can be
// used to restore the file to its original state if there is an error.
struct stat ss;
struct NS_tstat_t ss;
rv = NS_tstat(mFile, &ss);
if (rv) {
LOG(("failed to read file status info: " LOG_S ", err: %d", mFile,