From 2c23886134296f884b6354449a726a99295e00d6 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 15 Oct 2016 08:40:39 -1000 Subject: [PATCH] rename stat64_t definition to atStat64_t to avoid collisions --- include/athena/Global.hpp | 16 +++++++--------- src/athena/Dir.cpp | 7 +++---- src/athena/FileInfo.cpp | 17 ++++++++--------- src/athena/Utility.cpp | 7 +++---- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/include/athena/Global.hpp b/include/athena/Global.hpp index 4a80b4c..af4ff44 100644 --- a/include/athena/Global.hpp +++ b/include/athena/Global.hpp @@ -49,17 +49,15 @@ #ifdef GEKKO #include "gekko_support.h" -typedef struct stat stat64_t; -#define stat64 stat +typedef struct stat atStat64_t; +#define atStat64 stat #elif _WIN32 -typedef struct _stat64 stat64_t; -#elif __FreeBSD__ -typedef struct stat stat64_t; -#define stat64 stat -#define fseeko64 fseeko -#define ftello64 ftello +typedef struct _stat64 atStat64_t; +#elif __APPLE__ || __FreeBSD__ +typedef struct stat atStat64_t; +#define atStat64 stat #else -typedef struct stat64 stat64_t; +typedef struct stat64 atStat64_t; #endif #ifndef BLOCKSZ diff --git a/src/athena/Dir.cpp b/src/athena/Dir.cpp index 4d11d0d..0aefe1b 100644 --- a/src/athena/Dir.cpp +++ b/src/athena/Dir.cpp @@ -14,7 +14,6 @@ #endif #ifdef _MSC_VER -#define stat64 __stat64 #define realpath(__name, __resolved) _fullpath((__name), (__resolved), 4096) #endif @@ -32,8 +31,8 @@ std::string Dir::absolutePath() const bool Dir::isDir() const { - stat64_t st; - int e = stat64(m_path.c_str(), &st); + atStat64_t st; + int e = atStat64(m_path.c_str(), &st); if (e < 0) return false; @@ -72,7 +71,7 @@ bool Dir::mkdir(const std::string& dir, mode_t mode) { #if _WIN32 return !(::_mkdir(dir.c_str()) < 0); -#else +#else return !(::mkdir(dir.c_str(), mode) < 0); #endif } diff --git a/src/athena/FileInfo.cpp b/src/athena/FileInfo.cpp index a7af385..b55fb3c 100644 --- a/src/athena/FileInfo.cpp +++ b/src/athena/FileInfo.cpp @@ -26,7 +26,6 @@ #ifdef _MSC_VER #include #include -#define stat64 __stat64 #define realpath(__name, __resolved) _fullpath((__resolved), (__name), 4096) #endif @@ -83,8 +82,8 @@ atUint64 FileInfo::size() const bool FileInfo::exists() const { - stat64_t st; - int e = stat64(m_path.c_str(), &st); + atStat64_t st; + int e = atStat64(m_path.c_str(), &st); if (e < 0) return false; @@ -94,8 +93,8 @@ bool FileInfo::exists() const bool FileInfo::isLink() const { - stat64_t st; - int e = stat64(m_path.c_str(), &st); + atStat64_t st; + int e = atStat64(m_path.c_str(), &st); if (e < 0) return false; @@ -104,8 +103,8 @@ bool FileInfo::isLink() const bool FileInfo::isFile() const { - stat64_t st; - int e = stat64(m_path.c_str(), &st); + atStat64_t st; + int e = atStat64(m_path.c_str(), &st); if (e < 0) return false; @@ -115,8 +114,8 @@ bool FileInfo::isFile() const bool FileInfo::touch() const { #if defined(__GNUC__) && !(defined(HW_DOL) || defined(HW_RVL) || defined(GEKKO)) - stat64_t st; - if (stat64(m_path.c_str(), &st) < 0) { + atStat64_t st; + if (atStat64(m_path.c_str(), &st) < 0) { (void)athena::io::FileWriter(m_path); return true; } diff --git a/src/athena/Utility.cpp b/src/athena/Utility.cpp index 19c0a6b..ed93832 100644 --- a/src/athena/Utility.cpp +++ b/src/athena/Utility.cpp @@ -15,7 +15,6 @@ #ifdef _MSC_VER #include #include -#define stat64 __stat64 #endif namespace athena @@ -166,15 +165,15 @@ int countChar(const std::string& str, const char chr, int* lastOccur) atUint64 fileSize(const std::string& filename) { - stat64_t st; - stat64(filename.c_str(), &st); + atStat64_t st; + atStat64(filename.c_str(), &st); return st.st_size; } #ifdef _MSC_VER atUint64 fileSize(const std::wstring& filename) { - stat64_t st; + atStat64_t st; _wstati64(filename.c_str(), &st); return st.st_size; }