Renamed parameters in Read/WriteUserCmd and ReadRawData
This commit is contained in:
parent
569a482549
commit
284a99fff7
@ -10,14 +10,14 @@ DemoFileReader::DemoFileReader(FILE* fp):
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t DemoFileReader::ReadRawData(uint8_t* buffer, int32_t length)
|
int32_t DemoFileReader::ReadRawData(uint8_t* buffer, int32_t maxLength)
|
||||||
{
|
{
|
||||||
FILE* fp = m_demoFp;
|
FILE* fp = m_demoFp;
|
||||||
|
|
||||||
int32_t size;
|
int32_t size;
|
||||||
fread(&size, sizeof(int32_t), 1, fp);
|
fread(&size, sizeof(int32_t), 1, fp);
|
||||||
|
|
||||||
if (buffer && (length < size))
|
if (buffer && (maxLength < size))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -60,10 +60,10 @@ void DemoFileReader::ReadCmdHeader(unsigned char& cmd, int32_t& tick)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t DemoFileReader::ReadUserCmd(int32_t& sequenceNum, uint8_t* buffer, int32_t length)
|
int32_t DemoFileReader::ReadUserCmd(int32_t& cmdNum, uint8_t* buffer, int32_t maxLength)
|
||||||
{
|
{
|
||||||
fread(&sequenceNum, sizeof(int32_t), 1, m_demoFp);
|
fread(&cmdNum, sizeof(int32_t), 1, m_demoFp);
|
||||||
return ReadRawData(buffer, length);
|
return ReadRawData(buffer, maxLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DemoFileWriter
|
// DemoFileWriter
|
||||||
@ -109,8 +109,8 @@ void DemoFileWriter::WriteCmdHeader(unsigned char cmd, int32_t tick)
|
|||||||
fwrite(&tick, sizeof(int32_t), 1, fp);
|
fwrite(&tick, sizeof(int32_t), 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemoFileWriter::WriteUserCmd(int32_t sequenceNum, const uint8_t* buffer, int32_t length)
|
void DemoFileWriter::WriteUserCmd(int32_t cmdNum, const uint8_t* buffer, int32_t length)
|
||||||
{
|
{
|
||||||
fwrite(&sequenceNum, sizeof(int32_t), 1, m_demoFp);
|
fwrite(&cmdNum, sizeof(int32_t), 1, m_demoFp);
|
||||||
WriteRawData(buffer, length);
|
WriteRawData(buffer, length);
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ public:
|
|||||||
DemoFileReader(FILE* fp);
|
DemoFileReader(FILE* fp);
|
||||||
|
|
||||||
void ReadDemoHeader(demoheader_t& header);
|
void ReadDemoHeader(demoheader_t& header);
|
||||||
int32_t ReadRawData(uint8_t* buffer, int32_t length);
|
int32_t ReadRawData(uint8_t* buffer, int32_t maxLength);
|
||||||
void ReadSequenceInfo(int32_t& seqNum1, int32_t& seqNum2);
|
void ReadSequenceInfo(int32_t& seqNum1, int32_t& seqNum2);
|
||||||
void ReadCmdInfo(democmdinfo_t& info);
|
void ReadCmdInfo(democmdinfo_t& info);
|
||||||
void ReadCmdHeader(unsigned char& cmd, int32_t& tick);
|
void ReadCmdHeader(unsigned char& cmd, int32_t& tick);
|
||||||
int32_t ReadUserCmd(int32_t& sequenceNum, uint8_t* buffer, int32_t length);
|
int32_t ReadUserCmd(int32_t& cmdNum, uint8_t* buffer, int32_t maxLength);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE* m_demoFp;
|
FILE* m_demoFp;
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
void WriteSequenceInfo(int32_t seqNum1, int32_t seqNum2);
|
void WriteSequenceInfo(int32_t seqNum1, int32_t seqNum2);
|
||||||
void WriteCmdInfo(const democmdinfo_t& info);
|
void WriteCmdInfo(const democmdinfo_t& info);
|
||||||
void WriteCmdHeader(unsigned char cmd, int32_t tick);
|
void WriteCmdHeader(unsigned char cmd, int32_t tick);
|
||||||
void WriteUserCmd(int32_t sequenceNum, const uint8_t* buffer, int32_t length);
|
void WriteUserCmd(int32_t cmdNum, const uint8_t* buffer, int32_t length);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE* m_demoFp;
|
FILE* m_demoFp;
|
||||||
|
Loading…
Reference in New Issue
Block a user