diff options
author | Zoltán Mizsei <zmizsei@extrowerk.com> | 2019-05-09 20:03:01 +0200 |
---|---|---|
committer | Zoltán Mizsei <zmizsei@extrowerk.com> | 2019-05-09 20:03:01 +0200 |
commit | 138adb600408cb0032654e275dffa4c33cd49164 (patch) | |
tree | 8b62f17817bc0053059e451778942ee2b8efae39 /src/FileStream.cpp | |
parent | f12d9db778ccd60f927d19aff1a3fa3e3cd85df8 (diff) |
FileStream.cpp: Add Haiku platform support
Diffstat (limited to 'src/FileStream.cpp')
-rw-r--r-- | src/FileStream.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/FileStream.cpp b/src/FileStream.cpp index 514a683..43a5f4f 100644 --- a/src/FileStream.cpp +++ b/src/FileStream.cpp @@ -89,7 +89,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;
@@ -138,7 +138,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;
@@ -207,7 +207,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;
@@ -278,7 +278,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;
@@ -345,7 +345,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)
{
@@ -389,7 +389,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)
{
@@ -409,7 +409,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
}
@@ -488,7 +488,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;
@@ -557,7 +557,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
|