Proper FileReader::readUBytesToBuf return value

This commit is contained in:
Jack Andersen 2015-11-28 11:43:40 -10:00
parent 9cd4b22c8a
commit 3dbc746ddd
1 changed files with 6 additions and 0 deletions

View File

@ -176,6 +176,12 @@ atUint64 FileReader::readUBytesToBuf(void* buf, atUint64 len)
return fread(buf, 1, len, m_fileHandle);
else
{
atUint64 fs = utility::fileSize(m_filename);
if (m_offset >= fs)
return 0;
if (m_offset + len >= fs)
len = fs - m_offset;
size_t block = m_offset / m_blockSize;
atUint64 cacheOffset = m_offset % m_blockSize;
atUint64 cacheSize;