Skip to content

Commit

Permalink
Check for all file errors in demo player
Browse files Browse the repository at this point in the history
Handle the return values of all uses of the `io_read`, `io_skip` and `io_tell` function in `CDemoPlayer`, to handle truncated demo files and other unexpected file errors during demo playback.

Improve log messages for demo player errors. Reduce duplicate logging code in demo player by adding static `Log` function with variadic arguments.
  • Loading branch information
Robyt3 committed Oct 18, 2023
1 parent 2a9e701 commit d3672c5
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 131 deletions.
6 changes: 3 additions & 3 deletions src/engine/demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ struct CMapInfo
{
char m_aName[MAX_MAP_LENGTH];
SHA256_DIGEST m_Sha256;
int m_Crc;
int m_Size;
unsigned m_Crc;
unsigned m_Size;
};

class IDemoPlayer : public IInterface
Expand Down Expand Up @@ -100,7 +100,7 @@ class IDemoPlayer : public IInterface
virtual bool IsPlaying() const = 0;
virtual const CInfo *BaseInfo() const = 0;
virtual void GetDemoName(char *pBuffer, size_t BufferSize) const = 0;
virtual bool GetDemoInfo(class IStorage *pStorage, const char *pFilename, int StorageType, CDemoHeader *pDemoHeader, CTimelineMarkers *pTimelineMarkers, CMapInfo *pMapInfo) const = 0;
virtual bool GetDemoInfo(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, int StorageType, CDemoHeader *pDemoHeader, CTimelineMarkers *pTimelineMarkers, CMapInfo *pMapInfo, IOHANDLE *pFileOut = nullptr) const = 0;
};

class IDemoRecorder : public IInterface
Expand Down
Loading

0 comments on commit d3672c5

Please sign in to comment.