Browse Source

Start fix for Haiku

pull/109/head
Zoltán Mizsei 7 years ago committed by Anders Jenbo
parent
commit
9af17fea8d
  1. 18
      3rdParty/StormLib/src/FileStream.cpp

18
3rdParty/StormLib/src/FileStream.cpp vendored

@ -91,7 +91,7 @@ static bool BaseFile_Create(TFileStream * pStream)
}
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
{
intptr_t handle;
@ -141,7 +141,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD
}
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
{
struct stat64 fileinfo;
int oflag = (dwStreamFlags & STREAM_FLAG_READ_ONLY) ? O_RDONLY : O_RDWR;
@ -212,7 +212,7 @@ static bool BaseFile_Read(
}
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
{
ssize_t bytes_read;
@ -283,7 +283,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const
}
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
{
ssize_t bytes_written;
@ -350,7 +350,7 @@ static bool BaseFile_Resize(TFileStream * pStream, ULONGLONG NewFileSize)
}
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
{
if(ftruncate64((intptr_t)pStream->Base.File.hFile, (off64_t)NewFileSize) == -1)
{
@ -394,7 +394,7 @@ static bool BaseFile_Replace(TFileStream * pStream, TFileStream * pNewStream)
return (bool)MoveFile(pNewStream->szFileName, pStream->szFileName);
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
// "rename" on Linux also works if the target file exists
if(rename(pNewStream->szFileName, pStream->szFileName) == -1)
{
@ -414,7 +414,7 @@ static void BaseFile_Close(TFileStream * pStream)
CloseHandle(pStream->Base.File.hFile);
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
close((intptr_t)pStream->Base.File.hFile);
#endif
}
@ -493,7 +493,7 @@ static bool BaseMap_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD
return false;
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
struct stat64 fileinfo;
intptr_t handle;
bool bResult = false;
@ -562,7 +562,7 @@ static void BaseMap_Close(TFileStream * pStream)
UnmapViewOfFile(pStream->Base.Map.pbFile);
#endif
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX)
#if defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) || defined(PLATFORM_HAIKU)
if(pStream->Base.Map.pbFile != NULL)
munmap(pStream->Base.Map.pbFile, (size_t )pStream->Base.Map.FileSize);
#endif

Loading…
Cancel
Save