Windows build fix #2

This commit is contained in:
Phillip Stephens 2017-01-26 19:25:48 -08:00
parent 8f8edbbf16
commit fd84808762
3 changed files with 37 additions and 30 deletions

View File

@ -29,7 +29,7 @@ if(WIN32)
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapper.h
src/athena/FileWriterWin32.cpp src/athena/FileReaderWin32.cpp)
else()
list(APPEND CORE_EXTRA src/athena/FileWriter.cpp src/athena/FileReader.cpp)
list(APPEND CORE_EXTRA src/athena/FileWriterNix.cpp src/athena/FileReader.cpp)
if(APPLE OR GEKKO OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
if(GEKKO)
@ -42,6 +42,7 @@ add_library(athena-core
src/athena/Utility.cpp
src/athena/MemoryReader.cpp
src/athena/MemoryWriter.cpp
src/athena/FileWriterGeneric.cpp
src/athena/Global.cpp
src/athena/Checksums.cpp
src/athena/Compression.cpp

View File

@ -0,0 +1,35 @@
#include "athena/FileWriter.hpp"
namespace athena
{
namespace io
{
void TransactionalFileWriter::seek(atInt64 pos, SeekOrigin origin)
{
switch (origin)
{
case SeekOrigin::Begin:
m_position = pos;
break;
case SeekOrigin::Current:
m_position += pos;
break;
case SeekOrigin::End:
break;
}
}
void TransactionalFileWriter::writeUBytes(const atUint8* data, atUint64 len)
{
atUint64 neededSz = m_position + len;
if (neededSz > m_deferredBuffer.size())
{
m_deferredBuffer.reserve(neededSz * 2);
m_deferredBuffer.resize(neededSz);
}
memmove(m_deferredBuffer.data() + m_position, data, len);
m_position += len;
}
}
}

View File

@ -128,34 +128,5 @@ void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
setError();
}
}
void TransactionalFileWriter::seek(atInt64 pos, SeekOrigin origin)
{
switch (origin)
{
case SeekOrigin::Begin:
m_position = pos;
break;
case SeekOrigin::Current:
m_position += pos;
break;
case SeekOrigin::End:
break;
}
}
void TransactionalFileWriter::writeUBytes(const atUint8* data, atUint64 len)
{
atUint64 neededSz = m_position + len;
if (neededSz > m_deferredBuffer.size())
{
m_deferredBuffer.reserve(neededSz * 2);
m_deferredBuffer.resize(neededSz);
}
memmove(m_deferredBuffer.data() + m_position, data, len);
m_position += len;
}
}
} // Athena