summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2009-03-21 18:48:19 +0000
committerChris Wilson <chris+github@qwirx.com>2009-03-21 18:48:19 +0000
commit4d33206efeeacf0a20d6daabb0f5bcfa6da78a39 (patch)
tree23283a52f7dead12a340f96a194582fc3974fb07 /lib/common
parenta3d70474128afaab98bbd6fa343760eb61178302 (diff)
Fix tests (hopefully) on Win32 for struct stat ino_t change from 16 to
64 bits.
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/BoxPlatform.h4
-rw-r--r--lib/common/FileModificationTime.h6
-rw-r--r--lib/common/FileStream.cpp4
-rw-r--r--lib/common/Test.cpp16
-rw-r--r--lib/common/Utils.cpp8
5 files changed, 17 insertions, 21 deletions
diff --git a/lib/common/BoxPlatform.h b/lib/common/BoxPlatform.h
index 269ca85f..01bdbcf1 100644
--- a/lib/common/BoxPlatform.h
+++ b/lib/common/BoxPlatform.h
@@ -38,10 +38,6 @@
// must define this before importing <sys/types.h>
#define __MSVCRT_VERSION__ 0x0601
#endif
-
- // stop sys/types.h from defining its own ino_t as short,
- // because we want a bigger one :)
- #define _INO_T_
#endif
#ifdef HAVE_SYS_TYPES_H
diff --git a/lib/common/FileModificationTime.h b/lib/common/FileModificationTime.h
index c64ca848..5f13c015 100644
--- a/lib/common/FileModificationTime.h
+++ b/lib/common/FileModificationTime.h
@@ -14,7 +14,7 @@
#include "BoxTime.h"
-inline box_time_t FileModificationTime(struct stat &st)
+inline box_time_t FileModificationTime(EMU_STRUCT_STAT &st)
{
#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC
box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL);
@@ -26,7 +26,7 @@ inline box_time_t FileModificationTime(struct stat &st)
return datamodified;
}
-inline box_time_t FileAttrModificationTime(struct stat &st)
+inline box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st)
{
box_time_t statusmodified =
#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC
@@ -45,7 +45,7 @@ inline box_time_t FileAttrModificationTime(struct stat &st)
return statusmodified;
}
-inline box_time_t FileModificationTimeMaxModAndAttr(struct stat &st)
+inline box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st)
{
#ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC
box_time_t datamodified = ((int64_t)st.st_mtime) * (MICRO_SEC_IN_SEC_LL);
diff --git a/lib/common/FileStream.cpp b/lib/common/FileStream.cpp
index 09296d79..d6a3c5da 100644
--- a/lib/common/FileStream.cpp
+++ b/lib/common/FileStream.cpp
@@ -224,8 +224,8 @@ int FileStream::Read(void *pBuffer, int NBytes, int Timeout)
// --------------------------------------------------------------------------
IOStream::pos_type FileStream::BytesLeftToRead()
{
- struct stat st;
- if(::fstat(mOSFileHandle, &st) != 0)
+ EMU_STRUCT_STAT st;
+ if(EMU_FSTAT(mOSFileHandle, &st) != 0)
{
THROW_EXCEPTION(CommonException, OSFileError)
}
diff --git a/lib/common/Test.cpp b/lib/common/Test.cpp
index 7cf4859b..04d778c1 100644
--- a/lib/common/Test.cpp
+++ b/lib/common/Test.cpp
@@ -25,28 +25,28 @@
bool TestFileExists(const char *Filename)
{
- struct stat st;
- return ::stat(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0;
+ EMU_STRUCT_STAT st;
+ return EMU_STAT(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0;
}
bool TestFileNotEmpty(const char *Filename)
{
- struct stat st;
- return ::stat(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0 &&
+ EMU_STRUCT_STAT st;
+ return EMU_STAT(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0 &&
st.st_size > 0;
}
bool TestDirExists(const char *Filename)
{
- struct stat st;
- return ::stat(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == S_IFDIR;
+ EMU_STRUCT_STAT st;
+ return EMU_STAT(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == S_IFDIR;
}
// -1 if doesn't exist
int TestGetFileSize(const char *Filename)
{
- struct stat st;
- if(::stat(Filename, &st) == 0)
+ EMU_STRUCT_STAT st;
+ if(EMU_STAT(Filename, &st) == 0)
{
return st.st_size;
}
diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp
index 408eaa57..f45ed26b 100644
--- a/lib/common/Utils.cpp
+++ b/lib/common/Utils.cpp
@@ -163,8 +163,8 @@ void DumpStackBacktrace()
// --------------------------------------------------------------------------
bool FileExists(const char *Filename, int64_t *pFileSize, bool TreatLinksAsNotExisting)
{
- struct stat st;
- if(::lstat(Filename, &st) != 0)
+ EMU_STRUCT_STAT st;
+ if(EMU_LSTAT(Filename, &st) != 0)
{
if(errno == ENOENT)
{
@@ -208,8 +208,8 @@ bool FileExists(const char *Filename, int64_t *pFileSize, bool TreatLinksAsNotEx
// --------------------------------------------------------------------------
int ObjectExists(const std::string& rFilename)
{
- struct stat st;
- if(::stat(rFilename.c_str(), &st) != 0)
+ EMU_STRUCT_STAT st;
+ if(EMU_STAT(rFilename.c_str(), &st) != 0)
{
if(errno == ENOENT)
{