Added status check IsOk function for demo file reader/writer
This commit is contained in:
parent
3fd026efa9
commit
fbb73f1b75
@ -2,6 +2,7 @@
|
||||
#include "demofile.h"
|
||||
#include "demotypes.h"
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
// DemoFileReader
|
||||
|
||||
@ -10,6 +11,11 @@ DemoFileReader::DemoFileReader(FILE* fp):
|
||||
{
|
||||
}
|
||||
|
||||
bool DemoFileReader::IsOk() const
|
||||
{
|
||||
return ferror(m_demoFp) == 0;
|
||||
}
|
||||
|
||||
void DemoFileReader::ReadDemoHeader(demoheader_t& header)
|
||||
{
|
||||
fread(&header, sizeof(demoheader_t), 1, m_demoFp);
|
||||
@ -102,6 +108,11 @@ DemoFileWriter::DemoFileWriter(FILE* fp) :
|
||||
{
|
||||
}
|
||||
|
||||
bool DemoFileWriter::IsOk() const
|
||||
{
|
||||
return ferror(m_demoFp) == 0;
|
||||
}
|
||||
|
||||
void DemoFileWriter::WriteDemoHeader(const demoheader_t& header)
|
||||
{
|
||||
fwrite(&header, sizeof(demoheader_t), 1, m_demoFp);
|
||||
|
@ -13,6 +13,7 @@ class DemoFileReader
|
||||
public:
|
||||
DemoFileReader(FILE* fp);
|
||||
|
||||
bool IsOk() const;
|
||||
void ReadDemoHeader(demoheader_t& header);
|
||||
int32_t ReadRawData(uint8_t* buffer, int32_t maxLength);
|
||||
Array<uint8_t> ReadRawData(int32_t maxLength);
|
||||
@ -31,6 +32,7 @@ class DemoFileWriter
|
||||
public:
|
||||
DemoFileWriter(FILE* fp);
|
||||
|
||||
bool IsOk() const;
|
||||
void WriteDemoHeader(const demoheader_t& header);
|
||||
void WriteRawData(const uint8_t* buffer, int32_t length);
|
||||
void WriteSequenceInfo(int32_t seqNum1, int32_t seqNum2);
|
||||
|
Loading…
Reference in New Issue
Block a user