mirror of https://github.com/libAthena/athena.git
Windows build fix #2
This commit is contained in:
parent
8f8edbbf16
commit
fd84808762
|
@ -29,7 +29,7 @@ if(WIN32)
|
||||||
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapper.h
|
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c include/win32_largefilewrapper.h
|
||||||
src/athena/FileWriterWin32.cpp src/athena/FileReaderWin32.cpp)
|
src/athena/FileWriterWin32.cpp src/athena/FileReaderWin32.cpp)
|
||||||
else()
|
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")
|
if(APPLE OR GEKKO OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
|
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c include/osx_largefilewrapper.h)
|
||||||
if(GEKKO)
|
if(GEKKO)
|
||||||
|
@ -42,6 +42,7 @@ add_library(athena-core
|
||||||
src/athena/Utility.cpp
|
src/athena/Utility.cpp
|
||||||
src/athena/MemoryReader.cpp
|
src/athena/MemoryReader.cpp
|
||||||
src/athena/MemoryWriter.cpp
|
src/athena/MemoryWriter.cpp
|
||||||
|
src/athena/FileWriterGeneric.cpp
|
||||||
src/athena/Global.cpp
|
src/athena/Global.cpp
|
||||||
src/athena/Checksums.cpp
|
src/athena/Checksums.cpp
|
||||||
src/athena/Compression.cpp
|
src/athena/Compression.cpp
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -128,34 +128,5 @@ void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
|
||||||
setError();
|
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
|
} // Athena
|
Loading…
Reference in New Issue