Skip to content

Commit

Permalink
Filesystem: replaced return type for elapsed() function to intptr_t
Browse files Browse the repository at this point in the history
This fixes critical bug with EOF check
  • Loading branch information
Xottab-DUTY committed Jul 6, 2019
1 parent ec743e9 commit a815afb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/utils/xrLC_Light/net_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class XRLC_LIGHT_API INetReader : public IReaderBase<INetReader>, public byte_co
// VERIFY(stream);
}
virtual ~INetReader();
IC size_t elapsed() const
IC intptr_t elapsed() const
{
VERIFY(false);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class XRCORE_API IReader : public IReaderBase<IReader>
size_t advance_term_string();

public:
IC size_t elapsed() const { return Size - Pos; }
IC intptr_t elapsed() const { return Size - Pos; }
IC size_t tell() const { return Pos; }
IC void seek(size_t ptr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/stream_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class XRCORE_API CStreamReader : public IReaderBase<CStreamReader>, Noncopyable
#elif defined(LINUX) || defined(FREEBSD)
IC const int& file_mapping_handle() const;
#endif
IC size_t elapsed() const;
IC intptr_t elapsed() const;
IC const size_t& length() const;
IC void seek(const int& offset);
IC size_t tell() const;
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/stream_reader_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ IC void CStreamReader::remap(const size_t& new_offset)
map(new_offset);
}

IC size_t CStreamReader::elapsed() const
IC intptr_t CStreamReader::elapsed() const
{
const size_t offset_from_file_start = tell();
VERIFY(m_file_size >= offset_from_file_start);
Expand Down

0 comments on commit a815afb

Please sign in to comment.