From 138adb600408cb0032654e275dffa4c33cd49164 Mon Sep 17 00:00:00 2001 From: Zoltán Mizsei Date: Thu, 9 May 2019 20:03:01 +0200 Subject: FileStream.cpp: Add Haiku platform support --- src/FileStream.cpp | 18 +++++++++--------- 1 file 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 -- cgit v1.2.3