summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/File.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/OSSupport/File.cpp')
-rw-r--r--src/OSSupport/File.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp
index 7f0f0ad2f..8c24fa541 100644
--- a/src/OSSupport/File.cpp
+++ b/src/OSSupport/File.cpp
@@ -67,15 +67,15 @@ bool cFile::Open(const AString & iFileName, eMode iMode)
case fmRead: Mode = "rb"; break;
case fmWrite: Mode = "wb"; break;
case fmReadWrite: Mode = "rb+"; break;
- default:
- {
- ASSERT(!"Unhandled file mode");
- return false;
- }
+ }
+ if (Mode == NULL)
+ {
+ ASSERT(!"Unhandled file mode");
+ return false;
}
#ifdef _WIN32
- fopen_s(&m_File, (FILE_IO_PREFIX + iFileName).c_str(), Mode);
+ m_File = _fsopen((FILE_IO_PREFIX + iFileName).c_str(), Mode, _SH_DENYWR);
#else
m_File = fopen((FILE_IO_PREFIX + iFileName).c_str(), Mode);
#endif // _WIN32
@@ -88,7 +88,7 @@ bool cFile::Open(const AString & iFileName, eMode iMode)
// Simply re-open for read-writing, erasing existing contents:
#ifdef _WIN32
- fopen_s(&m_File, (FILE_IO_PREFIX + iFileName).c_str(), "wb+");
+ m_File = _fsopen((FILE_IO_PREFIX + iFileName).c_str(), "wb+", _SH_DENYWR);
#else
m_File = fopen((FILE_IO_PREFIX + iFileName).c_str(), "wb+");
#endif // _WIN32
@@ -143,7 +143,7 @@ bool cFile::IsEOF(void) const
-int cFile::Read (void * iBuffer, int iNumBytes)
+int cFile::Read (void * iBuffer, size_t iNumBytes)
{
ASSERT(IsOpen());
@@ -159,7 +159,7 @@ int cFile::Read (void * iBuffer, int iNumBytes)
-int cFile::Write(const void * iBuffer, int iNumBytes)
+int cFile::Write(const void * iBuffer, size_t iNumBytes)
{
ASSERT(IsOpen());