diff options
Diffstat (limited to 'src/FileStream.cpp')
-rw-r--r-- | src/FileStream.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/FileStream.cpp b/src/FileStream.cpp index 45499e1..50f6ea5 100644 --- a/src/FileStream.cpp +++ b/src/FileStream.cpp @@ -105,15 +105,15 @@ static bool BaseFile_Create(TFileStream * pStream) }
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
{
intptr_t handle;
handle = open(pStream->szFileName, O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if(handle == -1)
{
- nLastError = errno;
pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
+ nLastError = errno;
return false;
}
@@ -155,7 +155,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD }
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
{
struct stat64 fileinfo;
int oflag = (dwStreamFlags & STREAM_FLAG_READ_ONLY) ? O_RDONLY : O_RDWR;
@@ -165,17 +165,17 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD handle = open(szFileName, oflag | O_LARGEFILE);
if(handle == -1)
{
- nLastError = errno;
pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
+ nLastError = errno;
return false;
}
// Get the file size
if(fstat64(handle, &fileinfo) == -1)
{
+ pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
nLastError = errno;
close(handle);
- pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
return false;
}
@@ -226,7 +226,7 @@ static bool BaseFile_Read( }
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
{
ssize_t bytes_read;
@@ -297,7 +297,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const }
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
{
ssize_t bytes_written;
@@ -364,7 +364,7 @@ static bool BaseFile_Resize(TFileStream * pStream, ULONGLONG NewFileSize) }
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
{
if(ftruncate64((intptr_t)pStream->Base.File.hFile, (off64_t)NewFileSize) == -1)
{
@@ -408,7 +408,7 @@ static bool BaseFile_Replace(TFileStream * pStream, TFileStream * pNewStream) return (bool)MoveFile(pNewStream->szFileName, pStream->szFileName);
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
// "rename" on Linux also works if the target file exists
if(rename(pNewStream->szFileName, pStream->szFileName) == -1)
{
@@ -428,7 +428,7 @@ static void BaseFile_Close(TFileStream * pStream) CloseHandle(pStream->Base.File.hFile);
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
close((intptr_t)pStream->Base.File.hFile);
#endif
}
@@ -567,7 +567,7 @@ static bool BaseMap_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStre return false;
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
struct stat64 fileinfo;
intptr_t handle;
bool bResult = false;
@@ -636,7 +636,7 @@ static void BaseMap_Close(TFileStream * pStream) UnmapViewOfFile(pStream->Base.Map.pbFile);
#endif
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX) || defined(STORMLIB_HAIKU)
+#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
if(pStream->Base.Map.pbFile != NULL)
munmap(pStream->Base.Map.pbFile, (size_t )pStream->Base.Map.FileSize);
#endif
|